R/3 System
Accelerated Data Migration
Using LSMW 1.6
Solutions (material master)
Page 1 of 13 (Date: 27.02.05)
1. Unit: Definition of the Migration Object
1.1. Define the migration object for migration of material master data
1.1.1. Call the LSMW with transaction code LSMW
Enter transaction code lsmw in the ok-code and press enter, the LSM
Workbench initial screen appears; as LSMW is not part of standard R/3, it
can not be started using the menu
1.1.2. Define the project – please use ProjectXX (XX = group number)
On the LSMW initial screen, position the cursor in field project and click on
icon 0 (create)
A dialog box appears
Enter name and description of your project
Choose Continue !. The project is defined now
1.1.3. Define the subproject (for example: part 1)
On the LSMW initial screen, position the cursor in field subproject and click
on icon 0 (create) – if you defined a new project before, this step is done
automatically
A dialog box appears
Enter name and description of your subproject
Choose Continue !. The subproject is defined now
1.1.4. Define the migration object (for example: material)
On the LSMW initial screen, position the cursor in field object and click on
icon 0 (create) – if you defined a new subproject before, this step is done
automatically
A dialog box appears
Enter name and description of your object
Choose Continue !. The object is defined now
Page 2 of 23 (Date: 27.02.05)
1.1.5. Maintain the attributes of the migration object – material master will be
migrated with direct input program RMDATIND (object 0020, method 0000)
in this exercise
Go to the LSMW initial screen
Type in project, subproject and object
Press enter, the list of steps is displayed
From the list of steps, choose Maintain attributes of migration object with
double-click . A screen appears.
Change the mode from display mode to change mode
Set the radiobutton : to direct input / batch input program
Enter object 0020 and method 0000
Save your entries
Page 3 of 33 (Date: 27.02.05)
2. Unit: Definition of the Source Structures and Source
Fields
2.1. Maintain source structures
2.1.1. Define structure MATL (material master basic data)
From the list of steps, choose Maintain source structures. A screen appears.
Change the mode from display mode to change mode
Click on icon 0 to define a new structure
In the popup, fill name and describtion of structure MATL
Choose continue ! . The structure is defined now
Save your entry
2.1.2. Define structure MATL2 (material master consumption data) subordinated to
structure MATL
From the list of steps, choose Maintain source structures. A screen appears.
Change the mode from display mode to change mode
Position the cursor on structure DEBI1
Click on icon 0 (create) to define a new structure
In the first popup, set the radiobutton : to subordinated and choose
continue !
In the next popup, fill name and description of structure MATL2
Choose Continue !. The structure is defined now.
Save your entry .
2.2. Maintain source fields
2.2.1. Fields of MATL (Material master basic data) => copy from PROJECT00 -
LOGISTICS - MATERIAL1E, structure MATL
From the list of steps, choose Maintain source fields. A screen appears
where the already defined source structures are displayed
Page 4 of 43 (Date: 27.02.05)
Change the mode from display to change mode
Position the cursor on structure MATL
Click on icon2 to copy the structure
In the popup, set the radiobutton : to ‘Copy from other object’ and choose
continue !
Fill in project, subproject, object and structure and choose continue !
The fields for structure MATL are copied now
Save the entries .
2.2.2. Fields of MATL2 (Material master consumption data) => copy from
PROJECT00 – LOGISTICS - MATERIAL1E, structure MATL2
See above
2.2.3. Field ‘MATNR’ in structure MATL will be used as selection parameter for
upload and conversion of data later on, please set the flag in the field definition
From the list of steps, choose Maintain source fields. A screen appears
where the already defined source structures (and fields) are displayed
Change mode from display mode to change mode
double-click on field ‘MATNR’ in structure MATL
set the flag ‘selection parameter for read/convert data’
choose continue ! and save the entry
2.2.4. Question to test your understanding: Does the field ‘Identifying field value’
has to be filled for one or more fields when data is stored in two files (one file
per structure)?
No, the field ‘Identifying field value’ only has to be filled, when there is more
than one source structure in one file; in this case, the value is needed to
identify the structure of a record
2.2.5. Question to test your understanding:Which field(s) will be used for merging
the files during upload?
For merging of the files, all fields with identical name are used; in the
example the field ‘MATNR’
Page 5 of 53 (Date: 27.02.05)
3. Unit: Object Dependencies and Conversion Rules
3.1. Use the migration object overview to carry out mapping on paper.
From the menu bar on the List of Steps screen, choose Extras → Object.
overview.
This displays an overview of the source structures and R/3 structures. You
can have look on this to see which structures and fields of the source data
have to be assigned to those of the R/3 System. Mapping will be shown after
processing step “maintain fieldmapping and conversion rules”
3.2. Define the object dependencies:
3.2.1. Establish the structure relationships between the source structures and the R/3
System:
MATL BGR00, BMM00 and BMMH1;
MATL2 BMMH4
From the selection list of steps, choose Maintain structure relationships. A
screen appears where the structures used in the R/3 System are displayed.
Change the mode from display mode to change mode
Position the cursor on the desired R/3 structure
Choose Create relationship (icon 0 ). A dialog box appears where the source
structures are displayed.
Position the cursor on the appropriate source structure and choose Continue
!.
The system displays the structure relationships between both systems.
Save the entry
3.2.2. Which of the structures are mandatory?
Check for the comment in maintenance of structure relationships
BGR00, BMM00, BMMH1
3.3. Establish the field relationships between the source fields and the R/3 System fields
Page 6 of 63 (Date: 27.02.05)
3.3.1. Use the automatic fieldmapping to create proposals for the mapping – for the
fields with identical names and those with similar names (70 %)
From the list of steps choose Maintain field mapping and conversion rules
A screen appears
Change the mode from display to change mode
Choose Extras -> Auto-Fieldmapping from the menu
Set the radiobuttons according to your needs and choose Continue !
For each proposal decide whether to accept or not accept it via the push
buttons
3.3.2. Rework the rules created and check them against the mapping of 3.1; check
wether all source fields are mapped.
From the list of steps, choose Maintain field mapping and conversion rules.
A screen appears
Change the mode from display mode to change mode
Constant:
1. Position the cursor on the corresponding R/3 field
2. From the icon bar click on the button for constant
3. Fill in the value
4. Choose Continue !
Move:
1. Position the cursor on the corresponding R/3 field
2. Choose Field mapping add source field (icon 0 ), the Assign source
fields dialog box appears.
3. Select the appropriate source field and choose continue !
4. The system displays this field as the source field now and defaults a field-
related move of data
Fixed value:
Page 7 of 73 (Date: 27.02.05)
1. Position the cursor on the corresponding R/3 field
2. From the icon bar click on the button for fixed value
3. A dialog box appears, where you can decide how to name the parameter;
set the radiobutton : on your selection and choose continue !
4. In the next screen, maintain the rule (name, description, length, type,
value)
5. Choose Continue !
Prefix:
1. Position the cursor on the corresponding R/3 field
2. Choose Field mapping add source field (icon 0 ), the Assign source
fields dialog box appears.
3. Select the appropriate source field and choose continue !
4. The system displays this field as the source field now and defaults a field-
related move of data
5. From the icon bar click on the button ‘rule’
6. Set the radiobutton : to prefix and choose continue !
7. Enter the prefix in the dialog box
8. Choose continue !
9. The system adds ‘concatenate ....’ to the rules
Translation:
1. Position the cursor on the corresponding R/3 field
2. Choose Field mapping add source field (icon 0 ), the Assign source
fields dialog box appears.
3. Select the appropriate source field and choose continue !
4. The system displays this field as the source field now and defaults a field-
related move of data
5. From the icon bar click on the button for translation
6. A dialog box appears, where you can decide how to name the translation;
set the radiobutton : on your selection and choose continue !
Page 8 of 83 (Date: 27.02.05)
If you want to enter your own code, double-click on the fieldname, which
starts the editor.
If you want to use this function, you should perform a syntax check
afterwards, Choose icon ?.
To check whether all fields are mapped choose Extras -> Non-assigned
source fields from the menu there could be fields which do not need to be
mapped!!
3.4. Display the documentation of R/3 field BMM00-MTART
From the list of steps, choose Maintain field mapping and conversion rules
Click on icon 6 (information) behind the fieldname to display the
documentation
3.5. Display the possible values for R/3 field BMM00-BUKRS
From the list of steps choose Maintain field mapping and conversion rules
Click on icon questionmark behind the fieldname to display the possible field
values
Page 9 of 93 (Date: 27.02.05)
4. Unit: Migration Customizing
4.1. Question to test your understanding: What are the two possibilities to enter the
maintenance of the the reusable rules?
In step Maintain field mapping and conversion rules go into the editor for
the specific R/3-field, double-click on the name of the rule (fixed value,
translation, user routine)
Choose step Maintain fixed values, translations, user-defined routines from
the list of steps and double-click on the name of the rule (fixed value,
translation, user defined routine) there
4.2. Question to test your understanding:Which values are set for the fixed values you
defined?
From the list of steps choose Maintain fixed values, translations, user-
defined routines
Enter the maintenance of the fixed value by double-clicking on the name and
look at field ‘value’
4.3. Question to test your understanding:What kind of rule is used when the translation
does not find a value in the translation table? Where do you set up this?
From the list of steps choose Maintain fixed values, translations, user-
defined routines
Enter the maintenance of the translation by double-clicking on the name and
choose ‘control data’
4.4. Question to test your understanding:Where do you mark the ‘collection’ of values for
translation?
From the list of steps choose Maintain fixed values, translations, user-
defined routines
Enter the maintenance of the translation by double-clicking on the name and
choose ‘control data’
The flag to be set is ‘add 1:1 translation values automatically’
Page 10 of 103 (Date: 27.02.05)
5. Unit: Read the legacy system data
5.1. Maintain the file names and paths (step specify files)
5.1.1. Data on the application server:
MATL: file MATL.txt
MATL2: file MATL2.txt
From the list of steps, choose Specify files. A screen appears.
Change the mode from display mode to change mode
Position the cursor on line ‘Legacy data on the application server’
Choose icon 0 to create a new specification
In the popup, enter file path and description and set the radiobuttons :
according to the file attributes
Choose Continue !
5.1.2. The file names for the read data and converted data are already set – please
check
If you want to change them:
From the list of steps, choose Specify files.
Change the mode from display mode to change mode
Position the cursor on line ‘read data’ or ‘converted data’
Choose icon 0 to create a new specification
In the popup enter the file path
Choose continue !
5.2. Maintain the file assignment (step file assignment)
5.2.1. MATL MATL.TXT
5.2.2. MATL2 MATL2.TXT
From the list of steps choose Assign files
Page 11 of 113 (Date: 27.02.05)
A screen appears where the source structures are displayed
Change the mode from display mode to change mode
Position the cursor on the source structure
Choose Create assignment (icon 0 ). A dialog box appears where the source
file names are displayed.
Position the cursor on the appropriate source file and choose Continue !.
The system displays the assignment
5.3. Check the files and do the upload
5.3.1. Have a look at the files: Do the field names match with the fields defined? Do
the field values look o.k.? Do the upload for all records
From the list of steps choose Assign files. Position the cursor on the file
specification and use button display (Γ ) to display the file. The data is
available in the form of two tables (format: text tab delimited). The
structures are strictly hierarchical. In both structures, there is a column
containing customer numbers.
Check the headers of the table columns to correspond to the names of the
source fields and have a look at the field values – are there fields which are
numeric, but in the data file the value is alphanumeric?
From the list of steps choose Read data
If necessary, the program for reading the source data will be regenerated
Choose icon execute on the selection screen
5.3.2. Display the read data, do a pickup on certain lines to check the field values,
check the sequence of the records ...
From the list of steps choose Display read data
Leave fields fromline and toline blank in the popup to display all records and
choose continue !
Do a pickup < on one of the lines and check the values
In the file there should be:
- one header record starting with LSMW...
- one MATL segment (material master header) per material number
- one to x MATL2 segments (material master consumption data) per
customer number
5.3.3. Do the upload for the records of material ‘test1’
From the list of steps choose Read data
If necessary, the program for reading the source data will be regenerated
Page 12 of 123 (Date: 27.02.05)
Fill in the selection criteria
Choose icon execute on the selection screen
5.3.4. Display the read data again and check
From the list of steps choose Display read data
Leave fields fromline and toline blank in the popup to display all records and
choose continue !
Only the data for material test1 is displayed
Page 13 of 133 (Date: 27.02.05)
6. Unit: Data Conversion
6.1. Perform data conversion
From the list of steps, choose Convert data
If necessary, the program for converting the data will be regenerated
Choose icon execute on the selection screen
6.2. Display the converted data, do a pickup on certain lines to check the field values,
check the sequence of the records ...
From the list of steps choose Display converted data
Leave fields fromline and toline blank in the popup to display all records and
choose continue !
Do a pickup on one of the lines and check the values
In the file there should be:
- one BGR00 segment (batch input session header),
- one BMM00 segment (transaction header) per material number
- one BMMH1 segment (material master main data) per material number
- one to x BMMH4 segments (material master consumption data) per
material number
6.3. Check which values for 1:1 translation have been added
From the list of steps choose Maintain fixed values, translations, user-
defined routines
Double-click on the translation and choose 1:1 translation values
6.4. Check whether the translations are correctly, if not, redo the migration customizing
and rerun the conversion
From the list of steps choose Display converted data and do a pickup
Check the field values
Page 14 of 143 (Date: 27.02.05)
7. Unit: Data Import
7.1. Start the direct input session RMDATIND via physical file name
From the list of steps, choose Start Direct Input Session.
A screen appears that is associated with the direct input program for
material master data already.
On the first popup set the radiobutton : to ‘Program RMDATIND’ and
choose Continue !
Set the radiobutton : to ‘Via physical file name’ (the file name is already
filled in) and choose Execute
7.2. If there were errors, correct the field mapping, redo the conversion and the test the
import again
see descriptions above
7.3. Check the materials created with transaction MM03. The consumption data can be
seen after entering the plant via button ‘Extras’
Page 15 of 153 (Date: 27.02.05)
8. Unit: Work on the object
In this stage of migration the rules are adopted to changing needs
8.1. Add a new field of the legacy system
8.1.1. Add field ‘CONVALUE2’ (Character, Length 10, unplanned consumption) to
structure MATL2
Choose step Maintain source fields
Position the cursor on the field after which you want to insert the new field
Choose icon 0 to add the new field
8.1.2. Map field ‘CONVALUE2’ to field BMMH4-UNVBR and decide which rule to
use (move, translation ...)
Choose step Maintain field mapping and conversion rules
In this case a translation might be the best way to tranfer the data
see Unit Object dependencies and conversion rules
8.1.3. Add file MATL3.TXT in the data specification (ask your trainer for the patch)
and replace file MATL2.TXT with MATL3.TXT in the file assignment
Choose steps Specify files and Assign files
8.1.4. Read the source data
Choose step Read Data
8.1.5. Do the data conversion
Choose step Convert Data
8.1.6. Run the import
Choose step Start Direct Input Session
8.2. File MATL3.TXT contains data from years 1997 to 1999. Only the data from 1999 is
to be imported. Please change your rules accordingly.
Choose step Maintain field mapping and conversion rules
Example: add following coding for field BMMH4-PRIOD
if matl2-condate(4) ne '1999'. skip_record. endif.
Page 16 of 163 (Date: 27.02.05)
8.3. Define a user-defined routine for field BMMH4-MGVBR and change the rule for the
field accordingly
8.3.1. Define the rule in step “maintain field mapping and conversion rules” (you
have to map the source fields in the correct order first!!)
Choose step Maintain field mapping and conversion rules
Position the cursor on field BMMH4-MGVBR
Map the source fields you want to use
Use the button to add/change the rule from the button bar
Select user-defined routine
In the popup enter the name of the routine and choose continue !
8.3.2. Edit the coding of the routine
Go to the editor for field BKNA1-AKONT
Double-click on the name of the user-defined routine
Enter the coding for the routine and save it
8.3.3. Do the data conversion
Choose step Convert Data
8.3.4. Run the import
Choose step Start Direct Input Session
8.4. Add documentation on following levels
8.4.1. Project, subproject, object
On the LSMW initial screen position the cursor accordingly and use icon 2
(documentation)
8.4.2. Fixed value, translation, user-defined routine
Choose step Maintain fixed values, translations
Position the cursor on the name of the rule and use icon 2 (documentation)
8.4.3. Field mapping
Choose step Maintain field mapping and conversion rules
Position the cursor on the field name and use icon 2 (documentation)
Page 17 of 173 (Date: 27.02.05)
8.4.4. Display the documentation for the project
On the LSMW initial screen choose button ‘Project documentation’
8.4.5. Display the object overview
From the menu bar on the List of Steps screen, choose Extras → Object.
overview.
8.5. Define a new structure to import the forecast values for the material
8.5.1. Add the new structure
Choose step Maintain source structures and add the structure
8.5.2. Add the fields of the new structure
Choose step Maintain source fields and add the fields
8.5.3. Maintain the structure relationships
Choose step Maintain structure relations and add the new relation
8.5.4. Do the mapping and add the rules for the new fields
Choose step Maintain field mapping and conversion rules and add the rules
8.5.5. Create a file with test data
Create a text file on your PC
8.5.6. Specify the file and assign it to the source structure in LSMW
Choose steps Specify files and Assign files
8.5.7. Do the upload of the data
Choose step Read Data
8.5.8. Do the data conversion
Choose step Convert Data
8.5.9. Run the import
Choose step ‘Start Direct Input Session’
Page 18 of 183 (Date: 27.02.05)
9. Unit: Additional Functions
9.1. Create a recording for transaction MM01 (material master data) and run the whole
migration process (you can use file MATL.txt as test file)
On the LSMW initial screen, choose Extras → Recording.
Use icon 0 (create) to create a recording
Enter name and description of your recording
Choose Continue ! and have the transaction recorded run the transaction
with a data record as an example. You have to specify values for all those
fields that you want to fill with your source data later on. The batch input
recorder records the procedure while running the transaction.
At the end of the recording you have to edit the results of transaction
recording. In the last column, you have to assign names to all the fields
to be included in the data migration. The LSMW uses the specified default
value for all those fields that you did not assign a parameter name to.
9.2. Create a migration object that uses IDoc for import and run the whole migration
process
Define a new migration object
Choose step Maintain object attributes
Set the radiobutton : to IDoc and select an IDoc
Run the migration process
9.3. Carry out the transport of mapping and conversion rules
First, you have to export the mapping and conversion rules.
1 On the LSMW initial screen, choose Extras → Export conversion rules.
A dialog box appears.
2 Select the project you want to export and choose continue !
3 A screen appears where all reusable rules, recordings, subprojects and
migration objects of the project are displayed
Page 19 of 193 (Date: 27.02.05)
4 Select the objects you want to export
5 Choose export
6 Enter the name of the file in which you want to store the mapping and
conversion rules. Leave the data format at ASC (= default value).
7 Choose Transfer.
Now, import the mapping and conversion rules:
1 Go back to the initial screen
2 Choose Extras → Import conversion rules. A dialog box appears.
3 Enter the name of the file in which the exported mapping and conversion
rules are stored. Leave the data format at ASC (= default value).
4 Choose Transfer.
The file is being imported and its contents are analyzed. A list of the objects
determined (reusable rules, recordings, subprojects and migration objects) is
displayed for all object which already exist in the R/3 system you will see
a flag (icon Ε)
5 Select the objects to be imported.
6 Choose Import.
Page 20 of 203 (Date: 27.02.05)