Page 1
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 1/228
Uploading Vendor Master data using Direct Input Method
Go to transaction LSMW.
Click on “Create Entry”.
Create Project:
Click on “Continue”.
Create ‘Subproject’:
Page 2
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 2/228
Click on “Continue” and create Object.
Click on Continue.
Click on Continue again.
Page 3
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 3/228
1. Select the first step “Maintain Object Attributes” and click on “Execute”.
Here mention object and method in standard batch/Direct input radio button and press enter ,it will give
standard program name . SAVE and go back.
Page 4
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 4/228
Save and go back .
2. Select the step “Maintain Source Structures ” and click on “Execute”.
Save and Go back.
3. Select “Maintain Source Fields” and Execute
Page 5
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 5/228
Place cursor on structure name and click on
Here mention the what ever fields we require and flat file should be in the same structure .
Save and come back.
Save and come back.
4 . Select “Maintain Structure Relations” and Execute :
Page 6
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 6/228
Here to maintain structure relations click on BGR00 and ‘click relation ship’ as shown in above screenshot it will assigned to structure. Repeat this for all required relations in that screen.
5: Maintain field mappings and conversion rules ;
Nothing should be done in this step .(we will go for this step rarely).
6. specify files :
Here to specify files take file from legacy data ( on the pc front end ) .
click on legacy data and click create button. And browse for your flat file on your pc . (create flat file foryour structure in second step.). here in imported data it will take only 45 characters .
Page 7
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 7/228
7 : Assign Files
To assign files click cursor on structure and click assignment .it will assign to file .
8: Read Data
9: Display read data
10: Convert Data
Page 8
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 8/228
11. Display converted data.
12. create the batch input session to create session.13. Run the batch input session to create session.
Uploading Vendor Master data using Recording Method
This tutorials details about uploading vendor master data using recording method.Go to transaction LSMW.
Click on “Create Entry”.
Page 9
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 9/228
Create Project:
Click on “Continue”.Create ‘Subproject’:
Click on “Continue” and create Object.
Click on Continue.
Click on Continue again.
Page 10
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 10/228
Select the first step “Maintain Object Attributes” and click on “Execute”.
Select the check box “Batch input Recording” and click on :Create a recording for the transaction XK01 with the required fields. In this example, onlymandatory fields are used.Save the recording.<Once the recording is done, please remember to mention the field name for each field by
double-clicking on it and removing the default value that appears in the recording (the defaultvalues shown are the values you entered during your recording). See the screenshot below>
Page 11
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 11/228
Page 12
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 12/228
Select the check box “Maintain Source Structures” and click on Execute:
Select the “Source Structures” and click on “Create”:
Click on “Continue”.
SAVE and click on “Back”.
Select the radio button “Maintain Source Fields” and click on Execute
Select the Source structure and click on “Create Field”
Page 13
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 13/228
In our scenario for creating vendor master records, we would define only the mandatory fields.
Page 14
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 14/228
Page 15
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 15/228
Save and click on Back.
Select “Maintain Structure Relations” and click on “Execute”.
Page 16
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 16/228
Save and go back to the previous screen.
Now select ‘Maintain Field Mapping and Conversion Rules’ and click Execute
Now we need to assign the relationship between source structure (of the input file) and the targetstructure (from the recording).
Select the field from the list and click on “assign source field”:
Page 17
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 17/228
Save and go back to the previous screen.
Select the option “Specify files” and click on Execute.
Page 18
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 18/228
Select the option “Legacy Data” (on the PC) and click on Add entry.
Provide the location of the test data file and other details as shown below:
Page 19
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 19/228
Click on Continue, next SAVE.
Page 20
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 20/228
If you get any error like this:
Then click on Converted data file, and reduce the file name.
Now select the option “Assign files” and click on Execute:
Page 21
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 21/228
Since we have only one file to upload, the file is already assigned to the structure.
Save and go back to the previous screen.
Now click on Read data and select Execute button
Page 22
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 22/228
Click on Execute
The file is successfully read.
To see the data that is read, use “Display read data” on the main screen.
Page 23
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 23/228
Double-click on the record.
Now come back to the main screen and select “Convert data”
Page 24
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 24/228
To check, if the data has successfully converted from source structure to target structure, select “DisplayConverted data”
Page 25
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 25/228
Double-click on the record.
Page 26
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 26/228
Now create batch input session and the run the same.
Page 27
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 27/228
Now run the session to upload the data.
Migrating Customer data along with relationships (CRM) using LSMW
Page 28
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 28/228
1 Introduction This document provides a simple and user-friendly step-by-step approach for working with LSMW. The
document mostly covers the practical usage of LSMW with respect to Batch input Recording Method.
This document may be used to gain an insight of LSMW process in SAP CRM environment and may be
used as a guide to help the consultants during the initial loading of master data into SAP database tables.
2 LSMW The Legacy System Migration Workbench (LSMW) is a tool that supports data migration from legacy
systems (non-SAP systems) to SAP systems. It is a cross-platform component of the SAP system. The
tool has interfaces with the Data Transfer Center and with batch input and direct input processing as well
as standard interfaces BAPI and IDoc.
The tool migrates user-defined datasets (known as objects), which are combined according to business
criteria instead of individual tables or field contents. In addition to using standard import techniques, theuser-specific objects can be generated.
The LSMW supports a one-time transfer of data (initial data load) and also offers a restricted support of
permanent interfaces. Thus, a periodic transfer of data is possible. The LSMW, however, does not include
any functions for monitoring of permanent interfaces. The tool does not support any data export interfaces
(outbound interfaces).
Fig : LSMW-Process flow diagram
Page 29
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 29/228
3 Creation of Project Hierarchy Use the Transaction Code LSMW to go to the initial screen. Create a project, corresponding subproject
and object using Edit -> Create entry on menu bar. This is a hierarchy maintained in LSMW for all the
data transfer done.
Page 30
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 30/228
Page 31
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 31/228
Fig-03: LSMW initial screen with user menu for selection of various steps.
Page 32
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 32/228
4 Step by Step Process for uploading BP master data: The screenshot as in Fig-04 displays the fourteen steps required for loading Business partner data
along with their relationships:
Fig-04: Fourteen steps involved in LSMW
The following pages describe each of those fourteen steps and key points to be remembered in eachstep.
Page 33
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 33/228
4.1 Maintain Object Attributes In this step a Recording needs to be created (using GOTO -> Recordings overview in menu bar as
shown in Fig-05) using Transaction code BP.
Fig-05: Create Recording.
Once recordings overview is clicked the following screen as in Fig-06 will be displayed. Enter a name and
description to the recording.
Page 34
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 34/228
Fig-06: Enter details for the Recording.
Enter the transaction for which the recording is to be done as shown in Fig-07
Page 35
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 35/228
Fig-07: Transaction BP has been entered.
Here the Business partner category needs to be chosen, under which the customers should be created.
Click on Organization as shown in Fig-08:
Page 36
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 36/228
Fig-08: Click on Organization
Select a Grouping and a Business Partner number in that Grouping and the role under which thecustomers needs to be created. Enter all the necessary details for business partner that needs to beloaded from the flat file:
Page 37
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 37/228
Fig-09: Shows Business partner number, Grouping and Role and other details entered. “ExternalGrouping for loading the Customers and Accounts” has been used.
Maintain relationships for the Business partner, as shown in fig-10 if relationships also need to bemapped from flat file.
Page 38
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 38/228
Fig-10: Displays three Relationships of BP number 1100.
Once all the details have been entered save the Business Partner and click on back icon to go to
recording that we created.
Click on the fields displayed in orange color to change the name and default value of the fields. Andlet the other fields remain same whose values need to be defaulted to existing values.
Page 39
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 39/228
Fig-11: Displays the first screen of Recording ZRECORDC
Page 40
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 40/228
Fig-12: Displays the second screen of Recording ZRECORDC
Page 41
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 41/228
Fig-13: Displays the third screen of Recording ZRECORDC asking details for relationships.
Now once recording is done, this is the first step of LSMW menu where the way or method of Import
needs to be decided. There are generally four choices:
1. Standard Batch/ Direct Import Method
- Direct insertion of data through Batch input programs.
2. Batch input Recording method
- In this method a Recording of the transaction needs to be created which is later run asa Batch input Session.
3. Business object Method (BAPI)
- Here the BAPI takes care of the data conversions and updating any database table.So the function module is responsible for the import of data into the system.
4. IDoc (Intermediate documents)
- Here the data is written into an IDoc and passed to the LSMW to get it imported intothe system.
Page 42
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 42/228
However This Document discusses the import of data through Batch input Recording Method.
Fig-14: Choose the “Batch input recording” radio button and give the name of the recording that hasbeen done earlier. Then save the object attributes.
The LSMW system has to have the prior knowledge of what kind of data it is getting from the sourcethat has to be imported into the system. For this reason the following three steps are very importantthat describe the structure of the files that has to be imported.
Page 43
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 43/228
4.2 Maintain Source Structure
Go to main menu in LSMW as shown in Fig-04 and click on second step: Maintain Source Structure
and the following screen as in Fig-15 will be displayed:
Click on create icon, enter a name and description to the source structure and click on continue.
Then save the source structure and click on Back icon on the top of the screen.
Fig-15: Entering details of source structure
4.3 Maintain Source Fields Go to LSMW Menu screen as shown in Fig-04 and Go to Third step: Maintain Source Fields.
Select the source structure that was created and click on Table maintenance as shown in Fig-16
Page 44
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 44/228
Fig-16: Maintain Source Fields
Once Table Maintenance has been clicked, enter Field name, Data type and Length of all the fields under
the required structure as it will appear in the input file. Even it is important to keep the sequence of the
fields according to their position in the file. Give name to the fields and save it. Fields, that have constant
value like Grouping, Role etc need not be maintained in this table and those fields need not be included in
the flat file.
Page 45
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 45/228
Fig-17: Enter details of source fields and save
Generally it is important to keep the data type and size of the fields same as that of the corresponding
field in database table. However this might not be possible in all the cases, then the issue needs to be
handled through the conversion routines.
4.4 Maintain Structure Relations Go to LSMW Menu screen as shown in Fig-04 and Go to Next step: Maintain Structure Relations. The
following screen as shown in Fig-18 will be displayed. Save it and go to next step.
Structure relations are the mapping between the structures we have declared in the previous steps with
the recording done. However the one to one mapping of the fields will take place in the next step. Here
only the high level correspondence is shown
Page 46
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 46/228
Fig-18: Structure relationship
4.5 Maintain Filed Mapping and Conversion Rules In the previous step the recording is mapped to the structure. There it automatically creates a one to one
correspondence with the fields of both the sides and show in this stage as tree structure. Here each
source field needs to be assigned to its corresponding target field in the recording side. A simple way to
do this is to select the field from recording and press the tab “Assign source field” which will give a list of
fields in the source structure and then select the filed that needs to be mapped to field in recording.
Page 47
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 47/228
Fig-19: Field Mapping-Initial Screen
Page 48
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 48/228
Fig-20: Field Mapping-Next Screen
To maintain constant value to a field select that field in the recording and click on Constant (Ctrl+F9) Icon
as shown in Fig-20 and a constant value can be assigned to that field.
The following fields have been assigned constant values as displayed below:
a. Grouping : 0002(PB Number Account & Customer –External)b. Role : 000000(Business partner-General)c. Time zone: PSTd. Relationship category: FBUR001e. Overview: A
4.6 Maintain Fixed Values, Translations , User-Defined Routines
Here the conversion rules for processing project data need to be defined. The system generates the
conversion program from the structure and field relationships as well as the conversion rules.
Customization required for migration of data also needs to be specified here. That is, fixed values and
translation values can be assigned and definite variants for the conversion rules can also be specified
here.
Fig-21: Maintain Fixed Values, Translations, User-Defined Routines
Page 49
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 49/228
4.7 Specify Files Once the previous step of mapping each field to the source structure has been done, the next step is
mentioning the file path to be selected for importing.
Fig-22: Specify the path for the file etc.
Here apart from the physical path, other attributes of the file that is to be imported also need to be
specified. For example if it is a comma separated or tab delimitated file and if the file contains the field
name as Start of File etc.
There are other file-paths that can be mentioned, such as the file for imported data, converted data, etc. if
necessary we can choose to change the existing file path that has been defaulted.
4.8 Assign Files Once the file has been specified as in previous step, this file needs to be assigned.
Page 50
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 50/228
Page 51
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 51/228
Fig-24: Import / Read data
Fig-25: Result of the execution of import program.
Page 52
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 52/228
4.10 Display Read/Imported Data Once the data is imported, it can be displayed using this step. Once this step is selected and continue
icon is clicked, system would display the following screen where all the imported data can be seen . Eachrow can be selected to see all the details of each customer.
Fig-26: Display Imported/Read data
4.11 Convert Data Once the data is imported to the structure then go to the next step in the main menu that is- Generate
conversion program, Convert data and display converted data. The first step generates the program that
converts the data imported into the structure to the structure of Recording - ZRECORDC. This take care
of all the conversion earlier mentioned. This step converts the data executing above program and store it
in the filename given earlier. The result is shown as in Fig-27 & Fig 28. Also the converted data can be
seen as in Fig-29.
Page 53
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 53/228
Fig-27: Convert Data
Page 54
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 54/228
Fig-28: Converted Data
4.12 Display Converted Data Once the data is converted, all the Converted data can be seen in this step. Once this step is selected
and continue icon is clicked, system would display the following screen where all the Converted data can
be seen. Each row can be selected to see more details of each customer.
Fig-29: Display of Converted Data
Page 55
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 55/228
4.13 Create Batch input session In this step a Batch input session needs to be created. For creating a Batch Input Session, Go to main
menu in LSMW as shown in Fig-04 and click on next step: Create Batch input session and the following
screen will be displayed. Click on execute.
Fig-26: Intermediate screen showing the file path for creating Batch input Session.
Once execute is clicked, system will display the following screen with the number of transactions
(Business Partners) being created.
Page 56
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 56/228
Fig-26: Intermediate screen showing the number of transactions created.
4.14 Run Batch input session
This is the final step where system processes the session to get all the data upload into the database
through the given transaction (here BP- creating a Business Partner). For this it takes to the session over
view screen as in Fig-27 and asks about the way of execution whether it should execute in the foreground
or in the back ground. So select the line item and click on process icon on top. A new window pops up as
shown. Then the type of processing mode needs to be selected. Processing mode Display errors only
has been used which would display any errors encountered during creating business partners.
Page 57
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 57/228
Fig-27: Session overview and selection of Processing Mode.
Once this step is processed, system will upload all the 450 Business Partners as in flat file into the
respective database tables.
In this document since BP transaction has been used, so it will create 450 Business Partners in SAP
CRM Database tables. To see the Business Partner data updated in the system use Transaction SE16
and follow the steps as displayed in Fig-28, Fig-29 and Fig-30. Now all the business partners along with
their relationship data can be seen that have been uploaded into the CRM System using Transaction BP.
Page 58
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 58/228
Fig-28: Transaction SE16 and enter table BUT000
Page 59
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 59/228
Fig-29: Intermediate screen asking for certain criteria to display Business partners. Enter the criteria and
click on execute.
Page 60
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 60/228
Fig-30: Business partners uploaded into SAP CRM Database tables.
Step-By-Step Guide for LSMW using ALE/IDOC Method
Business Case:
In Business scenario, it is required to upload the data into R/3 and process the data in the IDOC form
only. The data can be migrated to R/3 SAP system using IDOC Generation Method in LSMW. The data to
be uploaded can be regarding material, vendor, customer etc. IDOC is the container, which stores the
data in structured format and is used to communicate between R/3 systems. IDOC structure includes
Status Record for storing status information of IDOC dispatch, Data Record for storing data into
segments and its corresponding fields and Control Record has receiver and source system details etc.
This document contains Step‐by‐Step instructions to use LSMW to generate and process IDOC from the
data file available. In first part user‐defined IDOC structure is created and required ALE settings are done
.In the Second part, this IDOC structure is used in the LSMW IDOC.
Part One: To create IDOC structure
Page 61
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 61/228
Step One: Run transaction WE31.Create Segment with name ‘ZEMP_SEG’.
Step Two: Input the fields for the segment structure, which would be required in LSMW for mapping
purpose.
Step Three: Now, Go to Edit ‐> Set Release, so that you can use this segment in the R/3 system further.
Page 62
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 62/228
Step Four: Run transaction ‘we30’ and enter IDOC structure name we want to create.
Here, IDOC
structure
name
is
‘ZEMP_IDC’.
Step Five:
(A)Add segment created earlier to this IDOC type ‘ZEMP_IDC’.
The maximum and minimum repetitions can be from 000000000000 to 99999999999.
Choose any number rang as per requirement.
Now, Go back to earlier page and Click Edit‐> Set Release.
(B)Create new Message type in transaction ‘WE81’.
Page 63
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 63/228
(C) Attach message type and IDOC type with the help of transaction ‘WE82’.
Step Six: Go to transaction ‘SALE’. Click as marked in red color.
Now add two logical system names for sender and receiver ex. IDC64 and IDC87.
Page 64
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 64/228
Step Seven: Now assign clients to the logical systems created.
Select the client of your current system as per decision to make that system sender or receiver.
Page 65
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 65/228
After clicking on to Goto->Details , you come to following screen. Input receiver system
‘IDC87’ to client 800.
Here in our LSMW using IDOC method, no need to assign client to sender as we are doing
Inbound IDOC Processing (i.e. Receiver side).
Step Eight: Run transaction ‘WE21’ to create File port. Give directory name as the location of
your file to be read. Give dummy name for ‘Outbound file’ field.
StepNine: Run ‘SM59’ transaction to create RFC connection. Please make sure here connection type
Page 66
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 66/228
Page 67
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 67/228
Page 68
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 68/228
Part Two:
Following are the steps to be performed on LSMW side.
Step One:
Enter the project, sub-project and Object name for our scenario.
Step Two:
Click the first radio button ‘Maintain Object Attributes’ , execute and enter the message name
and IDOC name into the screen as follows.
Page 69
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 69/228
Page 70
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 70/228
Step Six:
Click radio button ‘ Maintain Field Mapping and Conversion Rules’ and execute to create field
mapping and a conversion rules between source structure and target structure.
Step Seven:
Click radio button ‘ Maintain Fixed Values, Translations, User-Defined Routines’ and execute toassign fixed values to any field, to call user defined routines etc. These activities are not required
in our scenario.
Page 71
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 71/228
Step Eight:
Click radio button ‘Specify Files’ and execute to assign file on the local workstation to the
LSMW to read. The file has contents as shown below.
And now we specify the location of file here.
Page 72
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 72/228
Step Nine:
Click radio button ‘Specify Files’ and execute to specify file to source structure as follows.
Step Ten:
Click radio button ‘Read Data’ and execute to read file from local workstation as per pathspecified.
Step Eleven:
Click radio button ‘Display Read Data’ and execute to display data just read.
Page 73
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 73/228
Step Twelve:
Click radio button ‘Convert Data’ and execute to create a file with extension ‘.conv ’.
Step Thirteen:
Click radio button ‘Display Converted Data’ and execute to display the converted data.
Step Fourteen:
Click radio button ‘Start IDoc Generation’ and execute to generate the IDOC from the data
provided and structure mapping done earlier in this document. For this purpose, we cam use the
Page 74
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 74/228
converted file in step twelve. After successful generation of IDOC, below shown message is
displayed.
Step Fifteen:
Click radio button ‘Start IDoc Processing’ and execute to process the IDOC by inputting
necessary selection parameters.
Step Sixteen:
Click radio button ‘Create IDoc Overview’ and execute to show status and details of IDOC
generated. This screen is similar to ‘WE02’ or ‘WE05’ transaction.
Page 75
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 75/228
Here , as you can see , the status of IDOC is OK (Green color Bubble) and hence confirms
successful processing of IDOC.
Step Seventeen:
Click radio button ‘Start IDoc Follow-Up’ and execute to reprocess the IDOC if not posted or
generated properly initially.
Uploading Purchase Info records using IDOC Method
Requirement is to convert Purchase info records data from an excel sheet into SAP ECC using IDOC.
Step1 : Create project using transaction LSMW .
Page 76
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 76/228
Step2: Select maintain attributes Radio Button:
Step3: Maintain attributes
Select IDOC radio button and give "Message Type and " Basic Type".
Page 77
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 77/228
Click on Save .
Step4: Activating IDOC Inbound processing.
The following screen shots explain the activating IDOC Inbound processing.
Page 78
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 78/228
Click " IDOC inbound processing “ under settings.
Here maintain ' port ' and 'partner type ' and partner number here and press 'Activate Idoc inboundprocessing ".
Here for message type "SRCLST” process code is "SRCL”. This has to maintain while maintainingpartner type.
Step5: Maintain source structures
Page 79
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 79/228
Click on "Maintain source structures “ Radio Button. Click on source structures and then click on create.
Step6: Maintain Source fields
Page 80
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 80/228
Page 81
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 81/228
Step7: Maintain structure relations
Page 82
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 82/228
Click on structure relation and click on relation ship as shown above to maintain relationship.
Step8: Maintain field mapping
And press F8.
Page 83
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 83/228
Extras -> Auto field mapping. Press enter until you get a popup message field mapping completed.
Step9: Specify Files
Page 84
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 84/228
Click on legacy data while taking file from presentation server and click create.
Page 85
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 85/228
Step10: Assign files:
Step 11: Read data:
Page 86
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 86/228
Step12: Display Read data:
Page 87
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 87/228
Step13: Convert Data:
Page 88
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 88/228
Page 89
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 89/228
Click on
Step 15: Create IDOC overview:
We will get idocs created for such records.
For e.g as shown below.
Page 90
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 90/228
Here the status "GREEN" means IDOC got posted in status 53.
Uploading Bank data using BAPI in LSMW
This tutorial illustrates the usage of BAPI method in the LSMW, a tool provided by SAP for migrating thedata from Legacy Systems into SAP.
This example demonstrates the migration of BANK data into SAP In ECC6.0.
The various entities used for this example:
1. Business Object: BUS10111
2. Method: Create
3. Message Type: BANK_CREATE
4. Basic Type: BANK_CREATE_01
5. Process code: BAPI
1.Execute T-Code BAPI.
Page 91
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 91/228
2. Go to transaction LSMW.
Provide Project, subproject, object.
Page 92
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 92/228
From menu bar->settings->IDOC inbound processing.
Then it displays the following screen.
Click on Maintain port provide select port type FILE and click on create
Page 93
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 93/228
Provide Port name as FILE_PORT.
Description Port for Transferring Data
Function module EDI_PATH_CREATE_MESTYP_DOCNUM
Click on save.
Page 94
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 94/228
Then it displays our created FILE_PORT as Below.
Back and provide Port name as we created FILE_PORT.
And partner type as LS.
NOTE: Before Providing Partner no go to transaction SALE and do the following settings.
Page 95
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 95/228
Page 96
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 96/228
Enter Provide Logical system name as we created.
And save.
Page 97
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 97/228
NOTE END.
Click on Maintain Partner Numbers.
Select partner type as LS and click on create
Page 98
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 98/228
Provide Partner no as LSMW_BAPI.
Partn Type LS.
Click on SAVE.
Page 99
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 99/228
PROVIDE Partner number as LSMW_BAPI.
Click on Activate Inbound IDOC Processing.
Page 100
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 100/228
Click on YES.
Now go back to the main screen.
Then it Displays the following screen.
NOTE: Then it shows a screen With 17 Steps, which are to be executed sequentially as below.
STEP1.
Maintain Object Attributes.
And execute (ctrl+F8).
Page 101
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 101/228
Select Business Object Method (BAPI) , Provide Business Object and Method
And press Enter.
NOTE: Make sure that Message type and Basic type Comes Automatically.
Save.
Page 102
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 102/228
BACK.
STEP2.
Maintain Source structures and Execute.
Select Source Structure and click on create Provide source structure name and Description.
Page 103
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 103/228
Enter and Save.
Back.
STEP3.
Maintain Source Fields
Select Source Structure and click on Table Maintenance as shown below.
Page 104
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 104/228
Provide Fieldnames, type, length, and description.
Save and go back to the previous screen.
STEP4.
Maintain Structure Relations.
Page 105
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 105/228
Create Relationships as shown below.
STEP5.
Maintain Field mapping and conversion Rules.
Execute.
Page 106
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 106/228
Select BANK_CTRY, BANK_KEY,BANK_NAME and click on source field.
Page 107
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 107/228
Now Double click on corresponding fields from the above popup window.
Then the field mapping will be as shown below.
Page 108
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 108/228
Page 109
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 109/228
Save.
STEP8.
Assign Files.
Page 110
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 110/228
Page 111
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 111/228
Execute.
10.Display Read Data.
Execute.
Page 112
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 112/228
Page 113
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 113/228
EXECUTE.
Execute.
Go back to the previous screen.
STEP 12.
Display Convert Data.
Page 114
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 114/228
EXECUTE.
Enter.
Page 115
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 115/228
Back.
STEP13.
Start IDOC Generation.
Execute.
And Execute.
Page 116
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 116/228
STEP14.
Start IDOC Processing.
Execute.
Page 117
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 117/228
Execute.
NOTE: Observe that Data was Posted into Database successfully.
STEP15.
Create IDOC overview.
Page 118
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 118/228
Execute.
Execute.
Page 119
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 119/228
Double click on IDOC Number.
Double click on second IDOC number
Page 120
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 120/228
Back and Back.
STEP 16.
Page 121
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 121/228
Start IDOC follow-up.
Page 122
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 122/228
Test the posted data in the database table.
Go to SE11
Check the Database table BNKA.
Using BAPI in LSMW
Page 123
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 123/228
Step‐by‐Step Guide for using BAPI in LSMW
Note! The screen prints in this article are from ECC 5.0. They may differ slightly in other versions.
Introduction:
This document details the usage of BAPI in LSMW. We have used the example of migration of the
purchase order data into SAP.
Pre‐requisites:
It is assumed that the reader of this article has the minimum knowledge required on the Business
Object, BAPI, Message Types and IDoc Types.
Step‐by‐Step Procedure:
Details of the BAPI used in this scenario:
Business Object: BUS2012
Method: CreateFromData
Details of Message Type and Basic IDoc Type:
Message Type: PORDCR
Basic IDoc
Type:
PORDCR02
Let’s have a look at the BAPI first, before proceeding to the LSMW :
1. Go to Transaction BAPI2. Click on Search Button3. Enter the value “BUS2012” and select “Obj.type(Technical Object Name”
Page 124
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 124/228
4. Press ENTER5. Following screen appears:
6. On the left side of the screen, Expand the “PurchaseOrder”.7. Select “PurchaseOrder” and double-click on the same for details.
Page 125
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 125/228
Building LSMW using BAPI:
1. Go to Transaction LSMW.
2. Enter the Project, Subproject and Object information and click on CREATE.
Page 126
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 126/228
3. Enter the descriptions for Project, Subproject and Object as prompted.
4. Now select Settings IDoc Inbound Processing
Page 127
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 127/228
5. “IDoc Inbound Processing” screen appears. Enter the required details as shown below:
6. Click on “Activate IDoc Inbound Processing”.
7. Click on “Yes” when prompted for “Activate IDoc Inbound?”
Page 128
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 128/228
8. Hit on “Back” to return to the main screen.
9. Click on Continue (F8). Following Screen appears:
10. Select the Step 1 “Maintain Object Attributes” and select “Execute”.
Page 129
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 129/228
11. Select the radio button “Business Object Method” and enter the following details:
Business Object: BUS2012
Method: CreateFromData
Hit ENTER
Page 130
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 130/228
12. Save and click on BACK button. Following information message is displayed.
13. Now select step 2 “Maintain Source Structures” and click “Execute”.
14. In this step, we need to maintain the source structure. In our example, lets consider the
example of a file with 2 structures Head and Item data as shown below:
Click on Create and name the source structure as HEADERDATA. Now select
HEADERDATA and click on “Create” again to create the child structure. Following popup
appears:
Select “Lower Level” and click on Continue. Enter the Item data structure name.
Page 131
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 131/228
Click Save and hit BACK button to go to the main screen.
15. Select step 3 “Maintain Source Fields” and hit execute.
16. Enter the fields as shown below:
17. Click SAVE and return to main screen.
18. Select step 4 “Maintain Structure Relations” and click Execute.
Page 132
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 132/228
Select E1PORDCR and click on CREATE RelationShip. Following screen appears:
Select HEADERDATA and hit ENTER
Similarly do the same for the structure E1BPEKKOA, E1BPEKPOC and E1BPPEKET.
Page 133
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 133/228
Click Save and return to main screen.
19. Select the step “Maintain Field Mapping and Conversion Rules” and click on execute.Maintain the Field Mapping as seen below:
Page 134
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 134/228
Page 135
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 135/228
20. Select step 7 “Maintain Source Files” and provide the link for the test file created. (Create a
test file with the same structure as defined earlier).
Save and return to main screen.
21. Select the step “Assign Files” and click on Execute.
Assign the file provided to the source structure. Here the same file is provided for both the
structures.
Page 136
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 136/228
Save and return to the main screen.
22. Select the step “Read Data” and click on Execute.
Click on Execute.
Return to the main screen.
23. Select the step “Display read data” and click on execute.
Page 137
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 137/228
Click on the structure name to get the field level values.
24. Return to main screen and now select “Convert Data”.
Page 138
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 138/228
25. Return to the main screen and select “Display Converted data”.
26. Return to main screen and select “Start IDoc generation”.
27. Now select the step “Start IDoc Processing” on the main screen.
Page 139
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 139/228
28. Return to main screen and click on “Create IDoc overview”. Here the data record and status
records of the IDoc could be viewed:
Uploading Material Master data using BAPI method in LSMW
Page 140
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 140/228
Step1: Use the transaction code LSMW to upload the data using Legacy System Migration Work Bench. Here
in this scenario, uploading Material Master Data using BAPI.
Provide descriptions for Project, Subproject and Object respectively. And press execution button.
Step2: Select Settings -> IDOC Inbound Processing
Step3: “IDOC Inbound Processing” screen appears. Enter the required details as shown below:
Page 141
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 141/228
Step4: Define port and partner profile.
Page 142
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 142/228
Now come back to initial screen and click execute button.
Step5: The following screen appears.
Page 143
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 143/228
Step6: Select step1 ‘Maintain Object Attributes’ and Execute.
Provide business object details
Provide Method
Page 144
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 144/228
Save and click BACK button.
Step7: Now select step2 ‘Maintain Source Structure’ and click execute button.
Step8: Place the cursor on Source structure and click create. Provide name and description
Save and click BACK button.
Step9: Select step3 ‘Maintain Source Fields’ and click execute button.
Press create button and provide details for Field Name, Field Description and Field Length.
Page 145
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 145/228
Step10: Enter all required fields as shown below.
Save and back to main screen.
Step 11: Select step4 ‘’Maintain Source Relations’.
Page 146
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 146/228
Save and click BACK button.
Step12: Select step5 ‘Maintain Field Mapping and Conversion Rules’.
Page 147
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 147/228
Page 148
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 148/228
Step13: Select step7 ‘Specify Files’. Create a test file with the same structure as defined earlier.
Save and return to main screen.
Step14: Select step8 ‘Assign Files’ and click execute.
Assign File Structure to Source Structure.
Save and return to main screen.
Step15: Select step9 ‘Read Data’ and click execute.
Click Execute button.
Page 149
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 149/228
Click BACK button and return to main screen.
Step16: Select step10 ‘Display Read Data’ and execute.
Step17: Select step11 ‘Convert Data’ and execute.
Click execution button.
Page 150
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 150/228
Step18: Select step12 ‘Display Converted Data’ and execute.
Step19: Select step13 ‘3 Start IDoc Generation’.
Click the execution button.
Page 151
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 151/228
Step20: Select step 14 ‘Start IDoc Processing’.
And click execute button.
Step21: Select the step 15 ‘Create IDoc Overview’.
Page 152
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 152/228
Check the data in the data records.
Step-by-Step Guide for using LSMW to Update Customer Master Records
Note! The screenprints in this article are from IDES Release 4.6. They may differ slightly in
other versions.
Call Legacy System Migration Workbench by entering transaction code LSMW. Everyconversion task is grouped together as Project / Subproject / Object structure. Create a Project
called LSMW_DEMO and a Subproject as CUSTOMERS and Object as CUST_REC as
shown in Figure 1.
Page 153
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 153/228
Figure 1 Conversion Task with Project, Subproject and Object
The main screen of LSMW provides wizard-like step-by-step tasks, as shown in Figure 2. To complete yourdata conversion, you need to execute these steps in sequence. Once a step is executed, the cursor isautomatically positioned to the next step.
Note that these steps may look different depending upon your Personal menu settings. You
could make step numbers visible by ‘Numbers on’ icon or hidden by ‘Numbers off’ icon. Youcan execute a step by double-clicking on the row. Toggle icon ‘Doubleclick=Display’ or
‘Doubleclick=Edit’, makes the step in ‘display’ mode or ‘change’ mode.
Page 154
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 154/228
Figure 2 LSMW Wizard – initial screen
Step 1: Maintain Object attributes
In this example, you will be updating the customer master records with the help of recording atransaction (XD02). Choose radio button Batch Input Recording and click on the recording
overview icon to record the R/3 transaction. Enter the Recording name as XD02_REC, the
description as Customer Master Updates Recording, and the transaction code as XD02.
Figure 3 Object type ‘Transaction Recording’
The system calls the transaction code XD02 and prompts you to complete the Change
Customer transaction, as shown in Figure 4. Enter the key customer information (I entered
customer number 1000, sales organization 1000, distribution channel 01, and division 00) and
choose ‘Sales’ view within ‘Sales area data’. Make changes to these three fields (I entered, sales
office 1010, sales group 110, and customer group 01) and save the transaction.
Page 155
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 155/228
Figure 4 Transaction recording for Transaction Code ‘XD02’
Once the transaction is completed, R/3 records the flow of screens and fields and saves the
information, as shown in Figure 5.
Default Values
Field Names
Page 156
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 156/228
Page 157
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 157/228
Figure 7 Transaction Recording Overview – with screen field attributes
Save your changes. When you go back to the initial screen, you will see that the initial screen
steps have changed. Since you want to import data via the BDC method, the Direct Input and
IDoc-related steps are hidden, as they are not relevant.
Step 2. Maintain Source Structures
Give a name and a description to the source structure (Figure 8).
Figure 8 Source Structure
Step 3. Maintain Source Fields
In this step, you need to list what fields are present in the source structure. The easiest way is to
click on ‘Table Maintenance’ icon to enter Fieldname, Type and Length for each field as
shown in Figure 9.
Page 158
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 158/228
Figure 9 Source fields of source Structure
Note that your input file will have four fields as key fields and you need to update three fields in
the system.
Step 4: Maintain Structure Relations
Execute a step to ‘Maintain Structure Relations’. (See Figure 10.) Since, there is only one Source and TargetStructure, the relationship is defaulted automatically.
Figure 10 Structure Relation
Step 5: Maintain field mapping and conversion rules
Field RF02D-D0310 represents that you chose ‘Sales view’ for the customer Master screen accordingly itsvalue should be set to X. Keep your cursor on field RF02D-D0310 and click on Constant rule icon to choosethe constant value of ‘X’.
If your source file already has the field value, you choose rule ‘Source Field’.
Keep cursor on field ‘KUNNR’ and click on ‘Assign Source field’ icon to choose source field
CUSTOMER from structure XD02S as shown in Figure 11.
Page 159
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 159/228
Figure 11 Assign source fields
Similarly, assign ‘Source Field’ rules to the remaining fields.
Once all the fields are mapped, you should have an overview screen as shown in Figure 12.
Figure 12 Field mapping and Conversion rules overview
Page 160
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 160/228
Step 6: Maintain fixed values, translations, user-defined routines
You can also maintain re-usable translations and user-defined routines, which can be used across
conversion tasks. In this case, that step is not required.
Step 7: Specify files
In this step, we define how the layout of the input file is. The input file is a [Tab] delimited with
the first row as field names. It is present on my PC (local drive) as C:\XD02.txt. (See Figure 13.)
Page 161
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 161/228
Figure 13 File attributes
Create an Excel file (Figure 14) with your data and save it as a Tab-delimited text file on your
local drive (C:\) and name it XD02.txt.
Figure 14 Source data in Excel file (saved as Tab delimited file)
Step 8: Assign files
Execute step ‘Assign Files’ (Figure 15) and the system automatically defaults the filename to the
source structure.
Page 162
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 162/228
Figure 15 Assign file to Source Structure
Step 9: Read data
In this step, LSMW reads the data (Figure 16) from the source file (from your PC’s local drive).
You have the option to read only selected rows and convert data values to Internal format.
Figure 16 Read Data
Step 10: Display read data
This step (Figure 17) is optional. If required, you can review the field contents for the rows ofdata read.
Figure 17 Display Read Data
Page 163
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 163/228
Step 11: Convert data
This is the step that actually converts the source data (in source format) to a target format. Based
on the conversion rules defined, source fields are mapped to target fields.
Step 12: Display Converted data
Again this is an optional step to view how the source data is converted to internal SAP format
(Figure 18).
Figure 18 Display Converted Data
Step 13: Create batch input session
Once the source data is converted in an internal format, you can create a batch session to process
updates (Figure 19).
Figure 19 Create Batch Input Session
Step 14: Run Batch Input Session
You can execute the BDC session by Run Batch input session. Executing a batch input session is a standard
SM35 transaction for managing BDC sessions. Once you have successfully executed the batch input session,
Page 164
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 164/228
the customer master records are updated in the system. You can confirm this by viewing the customer masterrecords (XD03).
Note! Browsing thru these 14 steps, you may get a feeling that this is a very lengthy and time-
consuming activity. However, for the purposes of demonstration, I have made it detailed.
Although it looks lengthy, actually it takes hardly few hours from start-to-finish! After playing
around with few simple LSMW scripts, you will find it so easy to change and create morecomplex ones.
Uploading Material master data using recording method of LSMW
Step1: Use the transaction code LSMW to upload the data using Legacy System Migration Work Bench.Here in this scenario, uploading Material Master Data using Batch Input Recording.
Step2: Click the create button on ‘Main screen’ and provide descriptions for Project, Subproject andObject. And click execution button.
The following screen appears.
Page 165
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 165/228
Step3: Select step1 ‘Maintain Object Attributes’ and execute.
Provide the Recording name as shown below.
Click Recording over view button.
Step4: Select create button and provide recording name and descriptions.
Page 166
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 166/228
Step5: Recording as shown below.
Page 167
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 167/228
Save and return to main screen.
Step6: Now select step2 ‘Maintain Source Structure’ and click execute button.
Step7: Place the cursor on Source structure and click create. Provide name and description
Save and click BACK button.
Step8: Select step3 ‘Maintain Source Fields’ and click execute button.
Press create button and provide details for Field Name, Field Description and Field Length.
Page 168
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 168/228
Step9: Enter all required fields as shown below
Save and click BACK button.
Step10: Select step4 ‘’Maintain Source Relations’.
Page 169
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 169/228
Save and click BACK button.
Step11: Select step5 ‘Maintain Field Mapping and Conversion Rules’.
Page 170
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 170/228
Save and click BACK button.
Step12: Select step7 ‘Specify Files’. Create a test file with the same structure as defined earlier.
Save and return to main screen.
Step13: Select step8 ‘Assign Files’ and click execute.
Page 171
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 171/228
Assign File Structure to Source Structure.
Save and return to main screen.
Step14: Select step9 ‘Read Data’ and click execute.
Click Execute button again.
Click BACK button and return to main screen.
Step15: Select step10 ‘Display Read Data’ and execute.
Page 172
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 172/228
Select .
Click BACK button and return to main screen.
Step16: Select step11 ‘Convert Data’ and execute.
And click the execute button again.
Click BACK button and return to main screen.
Page 173
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 173/228
Step17: Select step12 ‘Display Converted Data’ and execute.
And press ENTER.
Click BACK button and return to main screen.
Step18: Select step13 ‘Create Batch Input Session’ and execute.
And click execute button.
Step19: Select step14 ‘Run Batch Input Session’ and execute.
Page 174
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 174/228
Process session to create Material.
LSMW to Update Customer Master Records with Standard Object Step‐by‐Step Guide for using LSMW to Update Customer Master Records
Note! The screenprints in this article are from IDES Release 4.6. They may differ slightly in other versions.
As an alternative to using ‘Transaction Recording’, you could also use a standard SAP object to update
Customer Master Records. Business Object ‘0050’ is already pre-defined in the system with standard Batch
Input Interface Program ‘RFBIDE00’.
Create an Object CUST_OBJ within Project as LSMW_DEMO and Subproject as CUSTOMERS as shown in
Figure 20.
Figure 20 LSMW Object with Standard SAP Object
Note! Only steps that are different from the recording method are listed here.
Step 1: Maintain Object attributes
Page 175
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 175/228
You will be updating the customer master records with the help of Standard Batch Input; therefore,
choose radio‐button Standard Batch/Direct Input as shown in Figure 21. Enter Object ‘0050’ for
Customer Master records and default method ‘0000’ and click on Save.
Figure 21 Standard Batch/Direct Input Object Attributes
Step 4: Maintain Structure Relations
Sales view
of
Customer
Master
is
stored
in
table
KNVV.
Accordingly,
you
need
to
update
structure
BKNVV. However, in addition, the Standard Object ‘0050’ also requires updates to BGR00, BKN00 and
BKNA1 structures. (If you do not maintain Structure relations for mandatory entries, you might get a
message such as ‘Target structure BKNA1 needs a relation to a source structure’.)
Even though you don’t want to update any fields in these structures, you need to create a relationship
with source structures. In all, you need to create relationship for four target structures.
Create relationship between source structures XD02S with these target structures with icon ‘Create
Relationship’ .
Keep Cursor on these four target structures and click on icon ‘Create Relation’ and structure relations
are maintained as shown in Figure 22.
Page 176
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 176/228
Figure 22 Structure Relation
Step 5: Maintain field mapping and conversion rules
-- Keep your cursor on ‘TCODE’ field and click on ‘Insert Rule’ icon
Page 177
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 177/228
Figure 23 LSMW Conversion Rules
Choose radio button ‘Constant’ (Figure 23) to enter value ‘XD02’ transaction code.
‐‐ Keep your cursor on field ‘KUNNR’ and click on ‘Assign source field’ icon
Choose source field ‘Customer’ from source structure ‘XD02S’. (See Figure 24.)
Figure 24 Assign Source fields
Page 178
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 178/228
‐‐ Similarly, choose source fields for Sales Organization, Distribution Channel, and Division. (See Figure
25.)
Figure 25 Field Mapping and Conversion Rules
‐‐ Scroll down to structure BKNVV fields and assign source fields to three fields Sales Office, Sales
Group, and Customer Group (Figure 26).
Page 179
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 179/228
Figure 26 Field Mapping and Conversion Rules
Save and go back to main screen.
Step 12: Display Converted data
When you convert data, LSMW automatically converts into the appropriate structure layouts, as
required by Standard program (RFBIDE00). (See Figure 27).
Page 180
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 180/228
Figure 27 Converted data into multiple structures
Note that if you had only one record in source file, the converted file has four records.
Earlier, creating this input file, so that the standard interface program can read it, was a big nightmare,
the
primary
reason
being
that
it
could
have
multiple
record
layouts.
Even
for
a
simple
conversion
with
one input record, you would have to create this complex file with many record layouts. The advantage
of LSMW is that it prepares these multi‐layout files automatically.
Step 13: Create batch input session
Once source data is converted in internal format, you can create a BDC session to process the updates
(Figures 28 and 29).
Figure 28 Create BDC Session
Figure 29 BDC Session ‘CUST_OBJ’ created
Page 181
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 181/228
Page 182
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 182/228
Step4: Select step1 ‘Maintain Object Attributes’ and Execute.
Provide the Object and Method details as shown below.
Save and click BACK button.
Step5: Now select step2 ‘Maintain Source Structure’ and click execute button.
Page 183
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 183/228
Step6: Place the cursor on Source structure and click create. Provide name and description
Save and click BACK button.
Step7: Select step3 ‘Maintain Source Fields’ and click execute button.
Press create button and provide details for Field Name, Field Description and Field Length.
Step6: Select step1 ‘Maintain Object Attributes’ and Execute.
Provide business object details
Page 184
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 184/228
Provide Method
Save and click BACK button.
Step7: Now select step2 ‘Maintain Source Structure’ and click execute button.
Step8: Place the cursor on Source structure and click create. Provide name and description
Page 185
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 185/228
Page 186
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 186/228
Save and back to main screen.
Step 11: Select step4 ‘’Maintain Source Relations’.
Save and click BACK button.
Page 187
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 187/228
Step12: Select step5 ‘Maintain Field Mapping and Conversion Rules’.
Page 188
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 188/228
Step13: Select step7 ‘Specify Files’. Create a test file with the same structure as defined earlier.
Save and return to main screen.
Step14: Select step8 ‘Assign Files’ and click execute.
Assign File Structure to Source Structure.
Page 189
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 189/228
Save and return to main screen.
Step15: Select step9 ‘Read Data’ and click execute.
Click Execute button.
Click BACK button and return to main screen.
Step16: Select step10 ‘Display Read Data’ and execute.
Page 190
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 190/228
Step17: Select step11 ‘Convert Data’ and execute.
Click execution button.
Step18: Select step12 ‘Display Converted Data’ and execute.
Page 191
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 191/228
Step19: Select step13 ‘3 Start IDoc Generation’.
Click the execution button.
Step20: Select step 14 ‘Start IDoc Processing’.
Page 192
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 192/228
And click execute button.
Step21: Select the step 15 ‘Create IDoc Overview’.
Check the data in the data records.
Page 193
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 193/228
Differences between LSMW and BDC Batch Data Communication (BDC) is the oldest batch interfacing technique that SAP provided since the
early versions of R/3. BDC is not atypical integration tool, in the sense that, it can be only be used for uploading data into R/3 and so it is notbi-directional.BDC works on the principle of simulating user input for transactional screen, via an ABAP program.Typically the input comes in the formof a flat file. The ABAP program reads this file and formats the input data screen by screen into an internaltable (BDCDATA). Thetransaction is then started using this internal table as the input and executed in the background.
In Call Transaction, the transactions are triggered at the time of processing itself and so the ABAPprogram must do the error handling.It can also be used for real-time interfaces and custom error handling & logging features. Whereas inBatch Input Sessions, the ABAPprogram creates a session with all the transactional data, and this session can be viewed, scheduled and
processed (usingTransaction SM35) at a later time. The latter technique has a built-in error processing mechanism too.
Batch Input (BI) programs still use the classical BDC approach but doesnt require an ABAP program to bewritten to format theBDCDATA. The user has to format the data using predefined structures and store it in a flat file. The BIprogram then reads this andinvokes the transaction mentioned in the header record of the file.
Page 194
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 194/228
Direct Input (DI) programs work exactly similar to BI programs. But the only difference is, instead ofprocessing screens they validatefields and directly load the data into tables using standard function modules. For this reason, DI programsare much faster (RMDATIND - Material Master DI program works at least 5 times faster) than the BDCcounterpart and so ideally suited for loading large volume data. DI programs arenot available for all application areas.
LSMW is an encapsulated data transfer tool. It can provide the same functionality as BDC infact muchmore but when coming to techinical perspective most the parameters are encapulated. To listout some ofthe differences :
• LSMW is basicaly designed for a fuctional consultant who do not do much coding but need toexplore the fuctionality while BDC is designed for a technical consultant.
• LSMW offers different techinque for migrating data: Direct input ,BAPI,Idoc,Batch input recording.While bdc basically uses recording.
• LSMW mapping is done by SAP while in BDC we have to do it explicitly .
• LSMW is basically for standard SAP application while bdc basically for customized application.
• Coding can be done flexibly in BDC when compared to LSMW
Steps to copy LSMW from one client to another
LSMW’s can be copied from one client to another client by using the Export and Import option.
The steps are detailed below.
Export Project
In the initial screen of the LSMW, select Extras Export project . This first displays the structure
tree of the selected project. Via Select / Deselect you can select whether the entire project or parts
of the project are exported. Then select Export . The program then creates an ASCII file.
Page 195
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 195/228
The selected elements are exported together with their documentation.
Import Project
The exported mapping and rules can be imported into another SAP system by using Import Project
option.
On the selection screen, select Extras ‐> Import . The program then prompts you to enter the name
of the PC file. The file is imported and the contents are analyzed. After the analysis, a list of the
subprojects and
objects
found
is
displayed.
You can now mark the objects to be imported. Project data existing already are check‐marked.
They are overwritten by the import.
Page 196
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 196/228
You can prevent a project already existing in the target system from being overwritten by using
function "Import under different name".
Modifying BAPI to fit custom requirements in LSMW A Typical Business Scenario:
Consider a scenario where the existing BAPI function module doesn’t cater to your needs and you
need to make some changes to the code. You can take a copy of the BAPI function module to
achieve the functionality. In this case we also need to take a copy of the Business object and the
steps are as follows.
1. Copy the original function module and make necessary changes2. Take a copy of the Business object and assign the new function module to the corresponding
method.3. Create ALE interface.4. Create Partner Profile
Consider the below example for detailed explanation of all the steps required.
Example:
Materials can be uploaded by using a BAPI function module BAPI_MATERIAL_SAVEREPLICA. The
corresponding business object is BUS1001006.
Consider a case The Material Upload LSMW’s that can be created using a BAPI function module
(BAPI_MATERIAL_SAVEREPLICA) for creating different material views. Now there is a requirement,
which demands for some changes in the function module. Then the following steps are to be
implemented.
Business Object: 1. Copy the original function module BAPI_MATERIAL_SAVEREPLICA as
ZBAPI_MATERIAL_SAVEREPLICA. Make necessary code changes to the function module
code.
Page 197
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 197/228
2. Copy the Business Object BUS1001006 as ZMATERIAL using the transaction SWO1 as shown
below.
3. Now we need to include our custom function module (ZBAPI_MATERIAL_SAVEREPLICA) in the
SAVEREPLICA method of the business object as shown below.
Page 198
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 198/228
4. Generate and Release the Business object (ZMATERIAL).
Generate ALE Interface: 5. Goto transaction BDBG to generate ALE interface for the BAPI. Create the interface as shown
below.
Page 199
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 199/228
6. The message type, IDOC type and the inbound function module are created.
LSMW:
7. Go to transaction LSMW and on the initial screen, click on SETTINGS iDoc Inbound Processing.
Maintain the Port and Partner Profile by entering the Port and Partner number and Partner Type.
Page 200
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 200/228
Using Routines and exception handling in LSMW
Step1: Use the transaction code LSMW to upload the data using Legacy System Migration WorkBench. Here in this scenario describes routines and exception handling.
Click execute button.
Step2: The following screen appears.
Page 201
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 201/228
Save and click BACK button.
Step3: Select step1 ‘Maintain Object Attributes’ and Execute.
Provide the Object and Method details as shown below.
Save and click BACK button.
Step4: Now select step2 ‘Maintain Source Structure’ and click execute button.
Page 202
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 202/228
Step5: Place the cursor on Source structure and click create. Provide name and description
Save and click BACK button.
Step6: : Select step3 ‘Maintain Source Fields’ and click execute button.
Press create button and provide details for Field Name, Field Description and Field Length.
Step7: Enter all required fields as shown below.
Page 203
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 203/228
Save and click BACK button.
Step8: : Select step4 ‘’Maintain Source Relations’.
Save and click BACK button.
Step9: Select step5 ‘Maintain Field Mapping and Conversion Rules’.
Page 204
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 204/228
Step10: Place the cursor on the desired field and click fixed value button on application tool bar.Choose the valid value in the VALUE field. And click ENTER button.
Page 205
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 205/228
Now the screen appears like this.
Step11: Place the cursor on the field for which we want to translate and click the RULE on the Application tool bar. Select Translate radio button.
Page 206
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 206/228
Step12: Provide name and press enter.
Step13: Now perform statement appears in the field as shown.
Page 207
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 207/228
Here, SKIP_TRANSACTION function is used to control not to create ERRORNESS record.
Step14: Select step6 ‘Maintain Fixed Values, Translations, User-Defined Routines’ and execute.
Double click on G_MEINS. Then the following screen appears. Made the changes in length as perour requirement.
Step15: Now, go to TRANSLATION VALUE tab strip.
Page 208
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 208/228
Step16: Select step7 ‘Specify Files’. Create a test file with the same structure as defined earlier.
Step17: Select step8 ‘Assign Files’ and click execute.
Assign File Structure to Source Structure.
Step18: Select step9 ‘Read Data’ and click execute.
Page 209
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 209/228
Click Execute button again.
Click BACK button and return to main screen.
Step19: Select step10 ‘Display Read Data’ and execute.
Select .
Step20: Select step11 ‘Convert Data’ and execute.
Page 210
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 210/228
And click the execute button again.
Click BACK button and return to main screen.
Step21: Select step12 ‘Display Converted Data’ and execute.
And press ENTER.
Click BACK button and return to main screen.
Step22: Select step13 ‘Start Direct Input Program’ and execute.
Page 211
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 211/228
Click ENTER.
Validations in LSMW
Requirement : Validation in LSMW. Here we are taking a simple example to change the customertelephone number. Do the validation in LSMW to check whether the provided customer is valid ornot. We will handle the Validations in 5th step (Maintain field mapping and conversion rules) ofLSMW. If the customer is invalid collect the record to the error internal table and skip the furtherprocessing of the record. Download all the error customers into an excel file once the conversion ofthe all the customers is done. This example mainly will help you to write the custom code in LSMW.
Create the Project, Subproject and Object in the LSMW Transaction.
1. Maintain Object Attributes
Page 212
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 212/228
Page 213
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 213/228
5. Maintain Field Mapping and Conversion Rules
We will do the validation in this step. Execute this step. Go to the change mode.
Click on the button (layout) and select all the check boxes.
Double click on Global Data (this block is like Global data in normal ABAP programs), will get an ABAP editor. Declare the required fields and Internal tables here as shown below.
Validate the customer:
Double click on BEGIN_OF_TRANSACTION block (this block will trigger for every newtransaction), and write the validation code as shown below.
Page 214
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 214/228
We can validate the given customer by checking the table KNA1. If the customer is invalid, thenappend the Customer to the error internal table with appropriate message. Skip furtherexecution of the record using the Global function skip_transaction (Insert->Global Function->skip_transaction). This statement will skip the current record and goes to the next record.
Download the Error records:
Double click on the END_OF_PROCESSING block (this block will trigger after conversion of allthe transactions), and write the code to download and display the error records as shown below.
Page 215
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 215/228
The error records will download to the specified file path when we execute the convert data stepand same will be displayed.
6. Specify Files
Specify the input file
Page 216
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 216/228
7. Assign Files
Assign the file and save.
8. Read Data
Execute the read data step to read the input file data.
9. Display Read Data [optional]
10. Convert Data
Page 217
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 217/228
The validations will take place when we execute the convert data step. The error records willdownload to the specified file path if there any and same will be displayed here as shown below.
And the snap shot downloaded excel wile is
11) Further continue with the processing (Create batch input session and Run batch input Session)to update the valid customers.
Uploading long text for Material Master 'Purchase Order Text"
Requirement : Loading the purchasing long text for the given materials.
The flat file in our example contains the long text for multiple materials. The header record containsthe material information (Material Number and Text ID) and is identified by the starting character ‘H’.The item records contain the long text to be uploaded for the material and the starting character ‘I’identifies the record. See the screenshot below:
Page 218
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 218/228
Create a Project, Subproject and Object in the LSMW transaction
1. Maintain Object Attri butes
Select the standard direct input method
Object - 0001
Method - 0001
2. Maintain Source Structures
Create two structures one for Header and one for Item. The item structure will be at lower levelfor the Header
3. Maintain Source Fields
Define the fields as per the flat file structure. In both the structures the first field must beidentifier. Create the identifier field of character 1 and specify the identifying field content 'H' for
Page 219
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 219/228
header structure and 'I' for item stricture as shown below.
Here the Field LINE of item structure is char 132, so each text line from the input file must beless than or equal to the length 132.
4. Maintain Structure Relations
Assign the header source structure to the Header target structure and Item source structure toItem target structure.
Page 220
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 220/228
5. Maintain Field Mapping and Conversion Rules
Map the source fields to the target fields
Header mapping
For NAME and ID map the source fields MATNR and TEXID respectively.
For OBJECT and SPRAS pass the constants. To enter a constant value for any field, place thecursor on the field and enter a value by clicking on constant button available in the applicationtoolbar.
Item mapping
Page 221
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 221/228
For TEXTFORMAT pass the constant '*' and for the TEXTLINE map the input field LINE of theITEM structure.
Save the changes.
6. Specify Files
Place the cursor on Legacy data and click create button
Enter the input file details
Page 222
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 222/228
Select the Radio button 'data for Multiple source structures' as we are populating the header andItem structures from the same input file
Select the delimiter 'Tabulator', if the fields in the input file are separated by tab.
7. Assign Files
Assign the input file to both the structures
Page 223
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 223/228
8. Read Data
Execute the Read data.
9. Display Read Data [optional]
10. Convert Data - Execute the convert data
11. Display Converted Data [optional]
12. Start Direct Input Program - Execute this step.
Result: The Long text will be updated for the given Materials
Transaction MM03, View - Purchase order text
Handling multiple recordings in LSMW
This example is related to PO output type creation using batch input method.
In this example, we need to handle more than one recording, because based on message
transmission medium screens will change.
In this example, have created two separate recordings when message medium is ‘1’ and message
medium is ‘6’ respectively.
1.
LSMW project.
Page 224
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 224/228
2. Maintain object attributes.
Here we need to create two separate recordings one for medium type is printer and one for medium
type is EDI as shown below.
Select BACK button and in batch input recording need to select more recordings as shown below.
Here initially only one recording will be displayed, then we need to add second recording manually as
shown below.
3. Maintain source structure as shown below.
4. Maintain source fields.
Page 225
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 225/228
5. Maintain structure relations as shown below.
6. Maintain field mapping and conversion rules.
Here we need to write code to handle recordings based on Message medium as shown below.
Page 226
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 226/228
Page 227
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 227/228
7. Specify files
And execute remaining steps.
Page 228
8/13/2019 53940461 LSMW for Vendor Master
http://slidepdf.com/reader/full/53940461-lsmw-for-vendor-master 228/228