Beruflich Dokumente
Kultur Dokumente
SAP ERP - Logistics Materials Management (SAP MM): LSMW Material master by BAPI method - Part 1
LSMW is a workbench which makes use of several tools (Batch/Direct Input, BAPI, 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, exchange field values and to generate a program that supplies those import
tools with the data.
SAP uses project, subproject and object name to build the file names for read and conv
files.. Each field is 15 character long, the maximum length of the conversion file name is 45
characters. If you have to work with a certain path, then this path will occupy a part of the
SAP ERP - Logistics Materials Management (SAP MM): LSMW Material master by BAPI method - Part 1
conv file name. Because of that, I recommend to make the names for project, subproject and
object shorter than the maximum of 15 characters.
If you start with a new project, then you have to click the new document icon, you get a popup to enter project name and description.
You will have to do the same for Subproject and Object.
Next you get to the overview of all steps in LSMW. At this moment SAP will show more
steps than you finally have to go through. What steps you have to perform depends on the
import method you chose in step 1 Maintain object attributes. I highlighted the steps which
are variable on the import method
SAP ERP - Logistics Materials Management (SAP MM): LSMW Material master by BAPI method - Part 1
SAP ERP - Logistics Materials Management (SAP MM): LSMW Material master by BAPI method - 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.
The steps "Generate Read Program" and "Generate Conversion Program" are not really
needed, because this step is automatically carried out with the next visible step below them.
Often neglected is the option to check the converted data against customizing, which means
you could find errors (e.g. missing customizing transports, wrong mapping rules) without the
need to post your data.
SAP ERP - Logistics Materials Management (SAP MM): LSMW Material master by BAPI method - Part 1
Here are some examples how the layout looks like depending on the settings made.
SAP ERP - Logistics Materials Management (SAP MM): LSMW Material master by BAPI method - Part 1
SAP ERP - Logistics Materials Management (SAP MM): LSMW Material master by BAPI method - Part 1
SAP ERP - 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.
The next screen shot shows the same section code inactive (compare it with the screen
shot above)
SAP ERP - Logistics Materials Management (SAP MM): LSMW Material master by BAPI method - Part 1
You do not see what values the constants have and you can't see the ABAP coding for the
Move-statement.
The next screenshot shows the appearance with inactive processing time
(BEGIN_OF_RECORD; END_OF_RECORD; compare with screenshot above)
SAP ERP - Logistics Materials Management (SAP MM): LSMW Material master by BAPI method - Part 1
the following screen shot is made with "Global Data Definitions" set to inactive (please
compare with screenshot "technical fields active" further above:
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, where you entered the project name chose from menu
Settings > IDOC Inbound processing
SAP ERP - Logistics Materials Management (SAP MM): LSMW Material master by BAPI method - Part 1
in the next screen you have to enter the File port name, the partner type US (user) and the
partner number and then you click Activate Inbound processing.
This has to be done in any system where you use this LSMW project.
SAP ERP - Logistics Materials Management (SAP MM): LSMW Material master by BAPI method - Part 1
File port and partner number are free definable names, and in many companies set up by
the Basis team. So you would only need to enter those names and Activate IDoc Inbound
processing,
However, if you have to do it yourself, then you need to make use of the buttons next to
those fields.
SAP ERP - Logistics Materials Management (SAP MM): LSMW Material master by BAPI method - Part 1
After clicking Maintain ports you get the screen shown below. Put the cursor onto the file
folder on the left, then click the create icon
Enter a description, set the radio button for the IDOC record type (most probably the 4.x type
nowadays), make the setting if you use Unicode format. then set the radio button to physical
directory, 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. These are the minimum settings needed
for a Port used in LSMW.
SAP ERP - Logistics Materials Management (SAP MM): LSMW Material master by BAPI method - Part 1
After clicking this button you are taken to the Partner profiles. Click create button. Enter the
partner number (here LSMW), partner type US, type US for user, Agent: you user-ID and
your language.
Then define the Inbound parameters, Click the "insert line" icon below the table.
SAP ERP - Logistics Materials Management (SAP MM): LSMW Material master by BAPI method - Part 1
At this place you add the IDOC message type that will be used as your import method.
LSMW can create this entry itself if you have activated the IDOC inbound processing before
you defined the first step of your LSMW. 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.
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, but it may vary by message
type)
SAP ERP - Logistics Materials Management (SAP MM): LSMW Material master by BAPI method - Part 1
Activate "Cancel Processing after Syntax error" and set the radio button to Trigger by
background program, otherwise your IDOCs get posted immediately while creating.
This blog will continue in LSMW Material master by BAPI method - Part 2
48 Views Tags: port, idoc, bapi, define, lsmw, material_master, long_text, import_method, partner_profile, we20,
we21