100% found this document useful (1 vote)
742 views19 pages

LSMW Material Master by Bapi Method Part 1

This document provides instructions for using LSMW (Logistics System Migration Workbench) to update material master records in SAP using BAPI methods. It discusses defining an LSMW project, subproject and object. It also covers preparing for an IDOC import method by defining file ports and partner profiles. The document is part one of a series on using LSMW and BAPI to update material master long texts from an Excel file.

Uploaded by

wpmartins2803
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
742 views19 pages

LSMW Material Master by Bapi Method Part 1

This document provides instructions for using LSMW (Logistics System Migration Workbench) to update material master records in SAP using BAPI methods. It discusses defining an LSMW project, subproject and object. It also covers preparing for an IDOC import method by defining file ports and partner profiles. The document is part one of a series on using LSMW and BAPI to update material master long texts from an Excel file.

Uploaded by

wpmartins2803
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 19

SAP ERP - Logistics Materials Management

(SAP MM): LSMW Material master by BAPI


method - Part 1
Posted by Juergen 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

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.

Prepare your LSMW


Define your project, sub-project and object
Project, sub-project and object is a free definable hierarchy
The project is usually self-explaining, it is the name of your project. Keep in mind that all mapping rules are
shared among all subprojects and objects within a project. This is a big advantage, however, if many persons
work in the same LSMW project you can as well face some disadvantages. E.g. if somebody is in development
and has a syntax error, then others in the same project are affected by this error too.

Generated by Jive on 2016-08-10Z


1

SAP ERP - Logistics Materials Management (SAP MM): LSMW Material master by BAPI method - Part 1

The subproject is a lower part of your project. It could be for example represent a module or sub-divide the
project by responsibles.
The object is the lowermost part where you actually define the migration for a certain business object or a part
of it.
My area is global master data, so I usually chose Master data as subproject and Material, vendor or customer
as object.
In this example I am going to use SCN as project, material as subproject and texts as object.
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 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 pop-up 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

Generated by Jive on 2016-08-10Z


2

SAP ERP - Logistics Materials Management (SAP MM): LSMW Material master by BAPI method - 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, I prefer double click to go into
change mode
With "numbering on " you get those numbers in front of the steps. This can make communication easier, but
only if both are working with the same settings, because the numbers are not fix to the text next to it, 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 2016-08-10Z


3

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.

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. I rarely saw that professionals can work with the presetting given by SAP.

Generated by Jive on 2016-08-10Z


4

SAP ERP - Logistics Materials Management (SAP MM): LSMW Material master by BAPI method - Part 1

You can change this setting from menu Extras > Layout. 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.
with technical fields active:

same section technical fields inactive:

Generated by Jive on 2016-08-10Z


5

SAP ERP - Logistics Materials Management (SAP MM): LSMW Material master by BAPI method - Part 1

With initial fields (fields that do not have a mapping)

And the same section without initial fields:

Generated by Jive on 2016-08-10Z


6

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)

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)

Generated by Jive on 2016-08-10Z


7

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:

the very first entry __GLOBAL_DATA___ is gone now.

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, where you entered the project name chose from menu Settings > IDOC Inbound
processing

Generated by Jive on 2016-08-10Z


8

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.

Generated by Jive on 2016-08-10Z


9

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.
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)
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.

The button Maintain partner numbers is actually transaction WE20


In my example I named it LSMW

Generated by Jive on 2016-08-10Z


10

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.

Generated by Jive on 2016-08-10Z


11

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)
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
26422 Views Tags: abap, port, idoc, bapi, define, lsmw, material_master, long_text,
enterprise_resource_planning, import_method, partner_profile, we20, we21,
sap_erp_logistics_materials_management

Generated by Jive on 2016-08-10Z


12

SAP ERP - Logistics Materials Management (SAP MM): LSMW Material master by BAPI method - Part 1

Fatih Kutlu
May 22, 2015 9:53 AM
thank you Jrgen L
Laszlo Honig in response to Juergen L on page 13
Jan 26, 2015 9:06 AM
Hi Jrgen,
thanks for the hint. It must have been the reason as now IDoc is getting generated. That's another thing that
eventually I still get an IDoc failure error but that's something I can handle I guess with some extra work on the
scenario I use.
Danke! :-)
Laszlo
Juergen L in response to Laszlo Honig on page 13
Jan 23, 2015 4:44 PM
can it be that you ran the conversion, then you wanted execute 'Start IDoc Generation' but got an error
that IDOC processing is not active? You then activated IDOC processing and executed directly 'Start IDoc
Generation' when this error "Unable to read file" cam up?
if that is the case, then you need to redo the conversion step, since the first conversion was made without an
active IDOC processing and the data is missing important information to generate idocs.
Laszlo Honig
Jan 23, 2015 2:47 PM
Hi Jrgen,
thank you for great post!
I am about to use mass data change/extension on already existing materials (in a previous step created
with necessary Basic Data only), using BAPI that I cloned from another BAPI based solution used by our
contractors in migration phase.
Import method: BAPI
Business Object: BUS1001006, Standard material
Method: SAVEDATA - Create and change material master data
Message Type: MATMAS_BAPI - Create and change material master data
Basic Type: MATMAS_BAPI03 - Create and Change Material Master Data
I use above as this is the way the materials have been extended before.
When getting to step 'Start IDoc Generation', I receive the following message:
Unable to read file
'MM_OBJECTS_TEST_MAT_MASTER_MATMAS3.lsmw.conv'
Message no. /SAPDMC/LSMW801

Generated by Jive on 2016-08-10Z


13

SAP ERP - Logistics Materials Management (SAP MM): LSMW Material master by BAPI method - Part 1

I have dug all threads for this type of error ever occurred and have been shared within community but in vain.
Do you have any idea how to get a grip on this?
Thank you in advance, Laszlo
Juergen L in response to Marius Becker on page 14
Dec 3, 2014 11:06 AM
But customer master does not have any BAPI, how is it then done with SLT?
Marius Becker in response to Juergen L on page 14
Dec 3, 2014 10:59 AM
Technically this tool can use any BAPI or function module, including customer function modules. See this slide
for more:

Juergen L in response to Marius Becker on page 15


Dec 3, 2014 10:40 AM

Generated by Jive on 2016-08-10Z


14

SAP ERP - Logistics Materials Management (SAP MM): LSMW Material master by BAPI method - Part 1

Actually not. I guess it is what what we call "SLO tool" in our company. It is currently used in a parallel project
to my migration project and supported and executed by externals.
Does this tool provide more BAPIs than the LSMW, e.g. BAPIs to load customer master?
Marius Becker
Dec 3, 2014 8:53 AM
Hi Jrgen,
did you already take a look at the SAP Landscape Transformation tool?
This tool can load, transform and push the data directly into the target BAPIs, in which case you don't need
LSWM anymore
Regards,
Marius
AMOL MARATHE
May 17, 2014 8:11 AM
Hello Jrgen L,
I have followed this blog and tested what you have suggested in below link,
Mass creation scheduling agreement ME31L

I had similar requirement and it worked fine.

Thanks for sharing.

Regards,
Amol
Ramesh Jeevanand in response to Juergen L on page 15
Oct 4, 2013 3:22 PM
Wel Jurgen,
Can you help me out in making a self project by using IDES. I taught it would add more weightage in my profile
or in my resume.
Could, you please help me out with this. If you don't mind!
I know that i am troubling you a lot,, please do not mind i am totally new to these kind of stuff.
I am just a beginner, please help me out with this.
Thank you.
Juergen L in response to Ramesh Jeevanand on page 15
Oct 3, 2013 6:02 PM
it should even work on IDES
Ramesh Jeevanand
Oct 3, 2013 3:07 PM

Generated by Jive on 2016-08-10Z


15

SAP ERP - Logistics Materials Management (SAP MM): LSMW Material master by BAPI method - Part 1

Hi Jurgen,
Firstly, i would like to thank you for giving this detailed information about the LSMW.
Which i am working on it, is it ok if i can use IDES tool for practising LSMW?

Thank you.
Ramesh J.V
CAROLINE NJUE in response to Juergen L on page 16
Sep 27, 2013 2:57 PM
yes,..thanks, am testing in quality first. many thanks Jurgen, you have been of much help.
i have more than 16000 materials to edit. this will be wonderful.
Most Appreciated.
Carol.
Juergen L in response to CAROLINE NJUE on page 16
Sep 27, 2013 1:53 PM
never do it directly in production, I am experienced and using LSMW for more than 10 years, still I would not
consider to do it in production directly (would not be possible anyway in our system) without having done a
serious test in Quality system.
this document explains how to transport LSMW How to Move LSMW all objects from one server to another
server
CAROLINE NJUE in response to CAROLINE NJUE on page 16
Sep 27, 2013 1:33 PM
Jurgen,
sorry, Kindly reply, do i create the legacy in quality or development and transport?
or i once sure it is working i do it in production straight?
CAROLINE NJUE in response to Juergen L on page 16
Sep 27, 2013 1:08 PM
alright.
many thanks.
if success will share.
Juergen L in response to CAROLINE NJUE on page 17
Sep 27, 2013 1:04 PM

Generated by Jive on 2016-08-10Z


16

SAP ERP - Logistics Materials Management (SAP MM): LSMW Material master by BAPI method - Part 1

yes
CAROLINE NJUE in response to Juergen L on page 17
Sep 27, 2013 1:00 PM
Ok.

I know i have many question please bear with me.


i am now trying to follow the link you gave me for LSMW for functional consultants. the example given there
was for vendor creation.
my assumption is tha even for material change ( what i want to do) will be the same steps shown? only the
transaction code will change?
please.
thanks.
carol.
Juergen L in response to CAROLINE NJUE on page 17
Sep 27, 2013 12:49 PM
You picture does not show, copy and paste of images does not work in SCN. you have to upload the images
from your local drive .
Anyhow, you can have as many subprojects and objects per project as you want.
I see no problem in using exact the same Excel template for changes like it is used for creating.
CAROLINE NJUE in response to Juergen L on page 18
Sep 27, 2013 12:44 PM
yes Jrgen. Thank you for the guidance.
question.
Kindly clarify the same excel format i use with creating new codes is the same format i use for change?
2.Do i have to create a new project because in my system there is material data but when i pick it
automatically picks the rest.see screen shot.

Kindly advise.
thanks.

Generated by Jive on 2016-08-10Z


17

SAP ERP - Logistics Materials Management (SAP MM): LSMW Material master by BAPI method - Part 1

carol
Juergen L in response to CAROLINE NJUE on page 18
Sep 27, 2013 10:38 AM
Dear Carol,
I would recommend to read the blog again from the beginning as I explained what a project is. Of course you
dont have the project that I used not in your system, because it is a name that you give yourself . But this is as
well explained with a screen shot in this blog.
MM17 cannot upload any data from Excel, you can only copy and paste from Excel into the data screen of
MM17.
Maybe it is better for you to start with the most easy way to use LSMW before you try it with this advanced
method, see this document LSMW for Functional Consultants in simple step-by-step way
CAROLINE NJUE
Sep 27, 2013 10:22 AM
Hi Gurus,
question,
I want to edit almost all materials in our material master. they have the wrong descriptions and most of them
part numbers were not maintained.
I have read i can use LSMW or MM17.
i have tried to run in MM17 but it is not uploading from the excel workbook in a systematic way.
Kindly someone guide me on step by step how to go about this.
I tried to use the method here.. but my LSMW has no SCN as project.

I have only used LSMW for mass creation of codes and extending and i start from specify files.
Kindly assist urgently. is it the same excel sheet to prepare and what steps to take.
Thanks.
Carol.
Ramesh Jeevanand
Sep 23, 2013 2:41 PM
Thank you for the link which you have shared with me.
But, i do have a doubt..It says more about the material management is that same method is applicable for
ABAP module also.?

Generated by Jive on 2016-08-10Z


18

SAP ERP - Logistics Materials Management (SAP MM): LSMW Material master by BAPI method - Part 1

shashank patel
Aug 19, 2013 8:16 PM
helpful blog thank you
PARAS SHAH
Mar 5, 2013 11:35 PM
It's really good. Thanks...
Juergen L
Jan 3, 2013 2:49 PM
In case the pictures do not show up. You can download it as PDF document from my google drive: https://
docs.google.com/open?id=0B4VGSkvGNHAyYnpxaW9jbWlYSzg

Generated by Jive on 2016-08-10Z


19

You might also like