SAP ERP - Logistics Materials Management

(SAP MM): LSMW Material master by BAPI
method - Part 1
Posted by Jürgen L Dec 27, 2012
I would like to show how BAPI method is used to create and change material master.

As an example I use a real business case:
existing material masters need to be updated with new material descriptions and sales text
not all materials have a sales text view
Text needs to be maintained in German and English language, English text is identical to
German text
Text is provided in a Excel spreadsheet

Annotation: Our material numbers are set as Lexicographical, no leading zeros
We have to use a certain path to store the .read and .conv files

The homepage of LSMW can be found here in SCN at http://scn.sap.com/docs/DOC-26158
In that document you can find the links to the general documentation in help.sap.com too:
http://help.sap.com/saphelp_nw70/helpdata/en/4d/455035082e2271e10000009b38f889/
frameset.htm

Generated by Jive on 2012-12-27+01:00
1

however. then others in the same project are affected by this error too. sub-project and object Project. In this example I am going to use SCN as project. SAP uses project. so I usually chose Master data as subproject and Material.Part 1 LSMW is a workbench which makes use of several tools (Batch/Direct Input. My area is global master data. sub-project and object is a free definable hierarchy The project is usually self-explaining. Each field is 15 character long. it is the name of your project. Prepare your LSMW Define your project. exchange field values and to generate a program that supplies those import tools with the data. E.SAP ERP . The subproject is a lower part of your project.. subproject and object name to build the file names for read and conv files. then this path will occupy a part of the Generated by Jive on 2012-12-27+01:00 2 . It could be for example represent a module or sub-divide the project by responsibles. if somebody is in development and has a syntax error. BAPI. material as subproject and texts as object. The object is the lowermost part where you actually define the migration for a certain business object or a part of it. if many persons work in the same LSMW project you can as well face some disadvantages.Logistics Materials Management (SAP MM): LSMW Material master by BAPI method . IDOC and batch input recorder) which existed long before LSMW was created and that still exist and can be used independently of LSMW. LSMW is basically a tool to map legacy data with SAP structures. vendor or customer as object.g. If you have to work with a certain path. This is a big advantage. Keep in mind that all mapping rules are shared among all subprojects and objects within a project. the maximum length of the conversion file name is 45 characters.

you get a popup to enter project name and description. I recommend to make the names for project.Logistics Materials Management (SAP MM): LSMW Material master by BAPI method . You will have to do the same for Subproject and Object. then you have to click the new document icon. subproject and object shorter than the maximum of 15 characters. If you start with a new project. At this moment SAP will show more steps than you finally have to go through. Because of that.SAP ERP . I highlighted the steps which are variable on the import method Generated by Jive on 2012-12-27+01:00 3 . What steps you have to perform depends on the import method you chose in step 1 Maintain object attributes. Next you get to the overview of all steps in LSMW.Part 1 conv file name.

but only if both are working with the same settings. I prefer double click to go into change mode With "numbering on " you get those numbers in front of the steps.Part 1 Above the step overview you can see various buttons. The button "Double click = " can be used to set your preferred way to work. This can make communication easier. because the numbers are not fix to the text next to it.Logistics Materials Management (SAP MM): LSMW Material master by BAPI method .SAP ERP . they are just number to the positions in the overview The button "User menu" allows you to add hidden steps to the LSMW steps (and causes renumbering to the shown entries) Generated by Jive on 2012-12-27+01:00 4 .

SAP ERP . Generated by Jive on 2012-12-27+01:00 5 . missing customizing transports. Often neglected is the option to check the converted data against customizing. The steps "Generate Read Program" and "Generate Conversion Program" are not really needed.Part 1 As you can see in the pop-up there are some interesting options like "Display Read Program" and "Display Conversion Program" which can be enabled if you need to debug in case the programs do not work like you expect.Logistics Materials Management (SAP MM): LSMW Material master by BAPI method . which means you could find errors (e. wrong mapping rules) without the need to post your data.g. because this step is automatically carried out with the next visible step below them.

You get then a pop-up to define the layout I prefer and recommend to set each field in the layout active Here are some examples how the layout looks like depending on the settings made.Logistics Materials Management (SAP MM): LSMW Material master by BAPI method . You can change this setting from menu Extras > Layout. I rarely saw that professionals can work with the presetting given by SAP.SAP ERP . with technical fields active: Generated by Jive on 2012-12-27+01:00 6 .Part 1 Prepare your Field mapping and conversion rules After executing step 5 Field mapping and conversion rules you will see the mapping based on the SAP given settings.

Part 1 same section technical fields inactive: With initial fields (fields that do not have a mapping) Generated by Jive on 2012-12-27+01:00 7 .Logistics Materials Management (SAP MM): LSMW Material master by BAPI method .SAP ERP .

SAP ERP .Part 1 And the same section without initial fields: Generated by Jive on 2012-12-27+01:00 8 .Logistics Materials Management (SAP MM): LSMW Material master by BAPI method .

Part 1 With this setting you will not even know that there are more fields in the import structure.Logistics Materials Management (SAP MM): LSMW Material master by BAPI method .SAP ERP . The next screen shot shows the same section code inactive (compare it with the screen shot above) Generated by Jive on 2012-12-27+01:00 9 .

Logistics Materials Management (SAP MM): LSMW Material master by BAPI method .SAP ERP . The next screenshot shows the appearance with inactive processing time (BEGIN_OF_RECORD. compare with screenshot above) Generated by Jive on 2012-12-27+01:00 10 . END_OF_RECORD.Part 1 You do not see what values the constants have and you can't see the ABAP coding for the Move-statement.

Part 1 the following screen shot is made with "Global Data Definitions" set to inactive (please compare with screenshot "technical fields active" further above: the very first entry __GLOBAL_DATA___ is gone now.Logistics Materials Management (SAP MM): LSMW Material master by BAPI method .SAP ERP . where you entered the project name chose from menu Settings > IDOC Inbound processing Generated by Jive on 2012-12-27+01:00 11 . Prepare for IDOC Import method if you use IDOC and BAPI import method then you need to define Ports and partner profiles like you have to do it when you get IDOCs from an external system. In the initial screen of LSMW.

Logistics Materials Management (SAP MM): LSMW Material master by BAPI method . This has to be done in any system where you use this LSMW project. the partner type US (user) and the partner number and then you click Activate Inbound processing.SAP ERP . Generated by Jive on 2012-12-27+01:00 12 .Part 1 in the next screen you have to enter the File port name.

Maintain ports is actually nothing else than transaction WE21 In my example I had used the name DATEI (which is nothing else than the German word for FILE) Generated by Jive on 2012-12-27+01:00 13 . if you have to do it yourself. then you need to make use of the buttons next to those fields. However. and in many companies set up by the Basis team. So you would only need to enter those names and Activate IDoc Inbound processing.Part 1 File port and partner number are free definable names.Logistics Materials Management (SAP MM): LSMW Material master by BAPI method .SAP ERP .

Put the cursor onto the file folder on the left. then click the create icon Enter a description.Logistics Materials Management (SAP MM): LSMW Material master by BAPI method . then set the radio button to physical directory. Generated by Jive on 2012-12-27+01:00 14 . These are the minimum settings needed for a Port used in LSMW. set the radio button for the IDOC record type (most probably the 4.SAP ERP .x type nowadays).Part 1 After clicking Maintain ports you get the screen shown below. enter a directory and a function module in tab Outbound file then do an Access test to make sure you have access to this directory. make the setting if you use Unicode format.

Click create button.Part 1 The button Maintain partner numbers is actually transaction WE20 In my example I named it LSMW After clicking this button you are taken to the Partner profiles.Logistics Materials Management (SAP MM): LSMW Material master by BAPI method . partner type US. Generated by Jive on 2012-12-27+01:00 15 . type US for user.SAP ERP . Then define the Inbound parameters. Enter the partner number (here LSMW). Click the "insert line" icon below the table. Agent: you user-ID and your language.

but it may vary by message type) Generated by Jive on 2012-12-27+01:00 16 . But there is no harm if you add it manually. which usually has to be done in Test and production systems as you do not carry out step 1 anymore.SAP ERP .Logistics Materials Management (SAP MM): LSMW Material master by BAPI method . For this example we use message type MATMAS_MASS_BAPI (which is basically the same BAPI that is used in MM17 Material master mass maintenance) Enter the process code with help of F4 (in this case it is BAPI. LSMW can create this entry itself if you have activated the IDOC inbound processing before you defined the first step of your LSMW.Part 1 At this place you add the IDOC message type that will be used as your import method.

define. material_master. lsmw. otherwise your IDOCs get posted immediately while creating.Part 1 Activate "Cancel Processing after Syntax error" and set the radio button to Trigger by background program. idoc. we20. bapi. import_method.Logistics Materials Management (SAP MM): LSMW Material master by BAPI method .SAP ERP .Part 2 48 Views Tags: port. we21 There are no comments on this post Generated by Jive on 2012-12-27+01:00 17 . long_text. partner_profile. This blog will continue in LSMW Material master by BAPI method .