You are on page 1of 21

Uploading Customer Master data using Direct Input Method

By Ansumesh Kumar Samal, IBM


Description and Purpose

Customer Master Data is the key object in all Order-To-Cash related operations. It consists of General data (maintained on customer Level), Sales data (maintained on sales area level) and Company Code data (maintained on company code level). The following type of data is generally considered for a customer for data migration.
y y y y y

Customer Master ( Sold-To ) Customer Address Customer Sales Text Customer Partner Functions Customer Credit Data

All above type of data of a customer can be migrated to SAP from legacy system using a single LSMW object or by different LSMW objects. It all depends and decided based on what is customers requirement, how it want to migrate all customer data and what is the format of data in input file Here I have tried to explain the different approaches which I followed in one of our project for developing Customer Master Conversion. I did it using Standard Batch/Direct Input method to migrate customer master general data (that includes General data, Company code data, Bank data, Contact Person details, Dunning Area data, Payer data, Sales data, Tax data .I used standard program RFBIDE00 to migrate successfully above mentioned data. However there were few specific issues which lead us to use separate LSMW objects for uploading Address data, Customer Partner Function data and Sales Text data are mentioned below. Reasons ADDRESS: There were many additional address fields which are not available in the structure of standard program RFBIDE00.In an alternative approach we created one more LSMW object using BAPI method available under LSMW and used Business Object BUS4001 & Method SAVEREPLICA for address migration. SALES: There is no structure available for Sales Text migration in the standard program RFBIDE00. So we used standard program /SAPDMC/SAP_LSMW_IMPORT_TEXTS of object 0001 for Sales Text migration.

PARTNER: In this project for this customer, the customer number range was internal generation and the customer number was required for migrating Partner Function data. So we first created all the customers in the system using the standard program RFBIDE00 through a LSMW object and then taking all created customer numbers we updated the corresponding partners for them through a separate LSMW object which used the same program. Assumptions
y y y Data cleansing is performed Customer Number ranges are customized for all account groups used All field values are configured where necessary, in particular for the following fields y y y y y y y y y y y y y Sales Org Distribution channel Division Account group Company code Credit control area. Customer group Pricing Procedure Shipping condition Incoterms 1 Terms of payment Tax category Customer condition groups 1-5

User(s) executing conversion should have access to XD01/VD01/FD32 transaction

Please find below all the steps followed in details with with screen-shots and explanations.
For LSMW: General Customer Master Data.

LSMW : Initial Screen

Created One project ZDEMO_O2C and a sub-project OTC under that in t-code LSMW Created a LSMW object 2_CUSTOM_MASTER under sub-project OTC

Click on Execute button which will display initial screen with all the available steps for all techniques. However after first step based on the techniques used for the LSMW, few steps will be removed. y STEP 1: Maintain Object Attributes

In this step we decide what techniques needs to be used for LSMW.For this requirement as stated by me already we used Direct Input method. To select the appropriate standard program for direct input, click on the search help for the field Object and it would display all possible standard programs which are available for data migration. Short list/Filter based on the description given at RHS.

After choosing the object from above list, we required to choose the method which is show below. And selection of method will auto populate the other two fields with the respective program name and program type. Then SAVE and GO BACK

STEP 2: Maintain Source Structures

Created a header structure with name as CUSTOMER for Legacy data customer master.

Click here to continue...

STEP 3: Maintain Source Fields Created all Source fields under the above Source Structure. And one point is very important here i.e. field sequence under the source structure should be created in the same sequence what it is given by the customer in the flat file. Click here for the file format used here. Before uploading we saved the XLS file into TXT format and then passed to the LSMW object. Steps to create a source field under the source structure: Put the cursor on the Source Structure and click on create button as shown below

Then it would ask details like field name, its description, and length and data type

Following above steps you can create all the source fields under the source structure one by one. Or else we can create all the fields at a time in Table maintenance mode as shown below.

STEP 4: Maintain Structure Relations

Here in this step we need to map the custom source structure created by us with the standard structure available in the standard program interface. We need not to map the custom source structure with all available standard structure available. So here is one question arise which are the sources structures of the standard program do we need to consider for mapping out of all the available structures? As per my understanding if any particular field value which is under scope of LSMW migration and it is present in the source fields list created by us, then we need to consider corresponding source structure of standard program which contains that particular field in the program interface. Screen-shot for Source structure mapping

y STEP 5: Maintain field mappings and conversion rules This is a very important step and needs to be done very carefully. Here we need to carry out mapping between custom sources fields with the standard structure fields. Used menu path EXTRAS-> Auto field mapping and also did the manually mapping where ever required

For manual mapping put the cursor on the destination structure field and then click on Source field button. For Example lets do manual mapping for field KTOKD (Customer Account Group)

If we are doing mapping for a field, then we should not pass null/empty values. To avoid this we can use initial check rule from the rule button in the similar way. Click here to continue... Put the cursor on respective field and then click on Rule button.

Now after rule insertion, mapping looks like below.

Defined initial check rule for each and every field in the source structure which are used in the mapping and used conversion exit to provide leading zeros to the input field value for few selected fields where ever it is necessary. Follow similar steps for rules button and choose this radio button.

Provided constants where ever necessary lime below

There are also few other possible features are available under Rule button which can be used according and effectively based on the requirement. To ensure that we have done field mapping for each and every field which is present in the source structure and we have not left any field with un-mapping, we can follow below path to check.

These above are the basic steps which need to be considered while doing any LSMW objects. Apart from this there are few sections available in the LSMW design where we can also insert some custom code to achieve few other things. Below shown are the different processing blocks of a LSMW object.

One single record in the input flat file refers to one transaction in LSMW.And this one transaction contains data which bellows to different structure available in the standard program interface. Each structure got a Begin of record and End of record event, where we can write our custom code to manipulate the whole record. If we would like to skip some record of any transaction, we can write some custom logic here it self. Logic written here wont affect the while transaction but that specific structure record.

You can double click on the code section and Implement your new custom code.

Similarly we can write our custom code at Begin of transaction & --End of transaction to manipulate the whole transaction record.

When all the records from flat file/or all the transactions at LSMW level got processed, the event --End of processing gets trigger where we can write some custom code giving the summary of all transaction processing.

Errors will be calculated during each record processing stage if any and if any error is found then input data is not transferred to transaction level but error details will be provided at the end of processing. Implemented logic to do date formatting as per the requirement. Used PERFORM F_GET_DATE to convert incoming date format MM/DD/YYYY to YYYYMMDD.So the perform we can call in LSMW level and the form routine can be written at Form Routinesection. This routine is local to the LSMW object only. For doing all these custom coding we can do data declaration in Global Datasection.

You can make use of button

to change the layout

Click here to continue...

STEP 6: Maintain Fixed Values, Translations, User-Defined Routines

The routine which I explained in step number 5 is a local routine declaration. It means that routine will only be available for that particular LSMW object at which it is defined.

If there are more than one LSMW object which makes use of a similar section of code, in that case a global routine can be defined at this steps which will be accessible by all LSMW objects under a LSMW Project.

Double click on the routine; you can see the source code.

STEP 7: Specify Files

In this step we specify the path and different other attributes of the input flat file which is there in your presentation server of the system.
Create one source file with following properties.

File contents: Select data for one source structure (table) Radio button. Delimiter: Select as per the source file (In my case TAB as already explained) File structure: Check Field names at start of file if 1st row belongs to the filed names. Maintain fields in the same order as source structure and check field structure matches Source structure definition. File type: Check record end marker radio button. Code page: Check ASCII radio button.

At the end of this step two files will be created in the application server as shown above. First file will contain data which read from presentation server. Second file will contain data which is the converted format of read data in LSMW program format.

STEP 8: Assign Files

Assign the respective files defined in Step 7 to the custom source structures for LSMW object defined in step number 2.So that when ever data read from the flat file, it will sit in respective fields under the custom source structure.

STEP 9: Read Data

The Data has to be read from the Presentation Server or the Application Server files for each LWMS objects. When we execute this step data from the read from the presentation server and store in respective files which explained in earlier step.

Click here to continue...

STEP 10: Display read data

The data read can also be displayed by executing this step. Double click at yellow section to see the data at field level

STEP 11: Convert Data

Execute the this step to convert the read data into a format for posting which system can understand

STEP 12: Display converted data

The data converted following the above step are store in a respective file in the application server as mentioned in earlier step can also be displayed by executing this step.

Double click on each structure if you want to see structure wise converted LSMW data y STEP 13: Create Batch Input Session

Executing this step, the standard program RFBIDE00 will run with all the converted data in its respective structures and it will create one session for processing of all records .The session can be visualised and processed in transaction code SM35 also. If session will not get created successfully, output screen will list out all the errors as shown below

If some error is there, errors will be list out in above screen y STEP 14: Run Batch Input Session

The above created session can be processed in t-code SM35 and also executing this step will also lead to t-code SM35.

Select the session and click on

and then process it

Click on Session Overview

and then go to LOG section