LSMW: BOM Upload Using Direct Input Method: Onday

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 36

LSMW : BOM Upload using

Direct Input Method

28 MONDAYAPR 2014
POSTED BY AROKIANATHANROBERT IN LSMW
≈ LEAVE A COMMENT
Tags
BOM

Uploading BOM for Materials , EQ …. are general requirements for any type of project. Creating a LSMW by
recording will be difficult and will not work for complicated data upload requirements. This is due to the fact that
the structure of BOM is broken down to Header , Item and Item details.

LSMW by direct input method is the easiest way to upload mass data withease.BDC processing might work but I
personally prefer LSMW.
Note :

1. The Header and item structure should be defined in hierarchy.

2. A common reference field should be defined in both the structures for linking header with items.

1. Create a new project , sub project using TCode : LSMW


2.Select object and method for direct input
3. Maintain source structure
Create structure in the following hierarchy
4. Maintain Source fields
Maintain fields as required for the upload.

Note: The first column in both the structures should be the same.
 

5. Maintain Structure Relations


6. Maintain field Mapping

Note : Maintain Tcode as required. T Code defines the BOM as a Material , Functional location or a equipment
BOM.Assign other fields as required for the upload

7. Prepare 2 upload files , 1 for header with header field structure and 2 for item with the field structure defined.
8. Assign files

9 Other steps are the same as any LSMW process.


 

Attachments:
BOM Upload Instructions.pdf
BOM Upload Instructions.pdf
Sample Upload Files

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@2@

Ok here are the steps to do this ...


 
In all steps I have copied fields and values from SAP screen using Ctrl Y key
After each step you can compare your screen with the values I gave..
 
I should be easy if you follow these steps
 
Step 1
Maintian Object attributes
 
Use standard  Batch / Direct Input
Object               0030   Material BOM
Method               0001   Create
Program Name         RCSBI010
Program Type         B   Batch Input
 
Step 2
Maintain Source structure
Create BOM Header and create Bom details as a child to Bom Header
 
should look like this...BOM details is assigned as a child to BOM Header
 
BOM_CREATE1 - BOM_CREATE - BOM_CREATE BOM_CREATE1
 
Source Structures
 
        BOM_HEADER               Header Data for Bill of Material
 
            BOM_DETAILS              Bom details
 
Step 3
Maintain source fields..
 
Create a field called "IDENT" field type C and length 1....give value to IDENT in both places
 
Give IDENT= 1 for header and IDENT=2 for item details
 
below are sample fields that I used,
compare you screen with following
 
BOM_CREATE1 - BOM_CREATE - BOM_CREATE BOM_CREATE1
 
Source Fields
 
        BOM_HEADER                Header Data for Bill of Material
 
            IDENT                          C(001)    Ident
                                           Identifing Field Content: 1
            WERKS                          C(004)    Plant
            MATNR                          C(018)    Material Number
            STLAL                          C(002)    Alternative BOM
            SPACE1                         C(003)    space1
            BMENG                          C(001)    Base quantity
            STLAN                          C(013)    BOM Usage
            BOM_DETAILS               Bom details
 
                IDENT                          C(001)    ident
                                               Identifing Field Content: 2
                POSNR                          C(004)    BOM Item Number
                IDNRK                          C(018)    BOM component
                MENGE                          C(013)    Component quantity
                MEINS                          C(003)    Component unit of measure
                AUSCH                          C(005)    Component scrap in percent
                AVOAU                          C(005)    Operation scrap in percent
                SANKA                          C(001)    Indicator for relevancy to costing
                NLFZT                          C(003)    Lead-time offset
                LGORT                          C(004)    Issue location for production order
                POSTP                          C(001)    Item Category (Bill of Material)
                SORTF                          C(010)    Sort String
                REKRS                          C(001)    Indicator: recursiveness allowed
                NETAU                          C(001)    Indicator: Net scrap
                INTRM                          C(018)    Phantom material
 
Step 4
Maintain source structure as shown below
 
Just assign BOM header to all structures...
 
you screen should look like below
 
BOM_CREATE1 - BOM_CREATE - BOM_CREATE BOM_CREATE1
 
Structure Relations
 
        BGR00 Batch Input Structure for Session Data                       <<<< BOM_HEADER  Header Data for Bill of
Material
              Select Target Structure BGR00 .
 
            BICSK Batch Input Structure for BOM Header Data                    <<<< BOM_HEADER  Header Data for Bill of
Material
                  Select Target Structure BICSK .
 
                BICSP Batch Input Structure for BOM Item Data                      <<<< BOM_DETAILS Bom details
                      Select Target Structure BICSP .
                BICSU Batch Input Structure for BOM Sub-Item Data
 
 
Step 5
Maintain field mapping ..
make sure you maintained transaction CS01
 
Step 6   Specify files
 
For BOM header
File &#61664; Point to a text file where you are storing BOM info
File content &#61664;select data for multiple source structures(Seq File)
Select &#61664;tabular
Leave remaining as is.
 
Check if your screen looks similar to this shown below
 
 
BOM_CREATE1 - BOM_CREATE - BOM_CREATE BOM_CREATE1
 
Files
 
        Legacy Data          On the PC (Frontend)
 
            Bom header                     C:\bom.txt
                                           Data for Multiple Source Structures (Sequential Files)
                                           Separator Tabulator
                                           Field Order Matches Source Structure Definition
                                           With Record End Indicator (Text File)
                                           Code Page ASCII
 
        Legacy Data          On the R/3 server (application server)
        Imported Data        File for Imported Data (Application Server)
 
            Imported Data                  BOM_CREATE.lsmw.read
 
        Converted Data       File for Converted Data (Application Server)
 
            Converted Data                 BOM_CREATE1_.lsmw.conv
                                           Logical Path C:\bom.txt
                                           Logical File bom.txt
 
        Wildcard Value       Value for Wildcard '*' in File Name
 
Step 7
Assign same file to header and item structure as we are using sequence file
Your screen will look as shown below
 
 
BOM_CREATE1 - BOM_CREATE - BOM_CREATE BOM_CREATE1
 
Source Structures and Files
 
        BOM_HEADER Header Data for Bill of Material
                   Bom header C:\ bom.txt
 
            BOM_DETAILS Bom details
                        Bom header C:\ bom.txt
 
Test file format
 
1     PLT1     Material1     1          1     1                         
2     0010     Comp1          0.198     FT3     0     0     X     0     0020     L     
2     0020     Comp2           0.045     FT3     0     0     X     0     0020     L     
2     0030     Comp3          0.195     FT3     0     0     X     0     0020     L     
1     PLT1     Material2     1          1     1                         
2     0010     Comp1          0.114     FT3     0     0     X     0     0020     L     
1     PLT1     Material3     1          1     1                         
2     0010     Comp1          0.061     FT3     0     0     X     0     0020     L     
      
 
Here inorder to get this file format…
You might need a query to download this data from your old system if it is an earlier version of SAP
Use CMC logical data base to build your query
 

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
 
Mostly BDC's are used for uploading BOM's.
 
Instead of using LSMW for BOM header as well as BOM items,
 
use T code SHDB - Transaction Recorder for uploading BOM's for material.
 
you will be required the same 2 files in this case also,one for BOM header & one
 
for BOM items.
 
Get the help from ABAP 'ers.
 
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@

Loading Material Masters with LSMW Direct Input


method
By Willem Hoek
INTRODUCTION 

It is a lot easier and quicker to load material masters using the Standard Direct Input object in LSMW
rather than with a recording of transaction mm01 or mm02. (To learn more about loading data using
recording, see this post) 

One input file can be used to create all the views of the material master. For all the material types.
Even if different views and fields are used for the different materials. 

Steps to take 

 Create text file with data to be loaded 


 Set up and run LSMW

All steps are discussed in this post. A sample data file and LSMW Project can also be found in
attachment. (see end of this post). 

Please take note that my project and input file will need slight modification to work fully on your SAP
system. You will have different material types, number ranges, field selections, etc. To get going,
use my LSMW Project and data file and make changes as required to get a simple dataset loaded. 

The most difficult bit in loading materials is getting the input file correct. I suggest you create the file
from a database (SQL) or programmatically. Excel does work but it sometimes convert numbers /
strings (example 0100 becomes 100). More notes about this at the end of this post. 

Let's first go through LSMW steps -; then look at the input file. 

LSMW 

You can either create the LSMW project manually or load my project (in attachment at end of post). 

Import Project 

Download project as attachment from end of this post to your PC. 

Go to LSMW -; transaction LSMW 


Menu: Extras > Import Projects 
 

select file LSMW_Z2_MM01.txt 

Press 'Import' (or 'Import Under Another Name'). 

Select Project / Subproject / Object and press 'Execute' 

Step 1: Maintain Object Attributes 

With first option selected -; press 'Execute' 


Press 'Display <> Change' to select Object 

Step 2: Maintain Source Structures 

Step 3: Maintain Source Fields 

Define here all the fields that will be in your input file (text file with data). As a rule, keep the field
names the same as in SAP. This way mapping can be done automatically. 

The order of the fields is not important. For simplicity, make field size bigger than required, in this
case mostly 40. 
What fields can be included? See next step for that 

Step 4: Maintain Structure Relations 

Here you map the one input file to structures that was selected in step one (direct input objects). 
To get an idea what material master field can be loaded -; click on the structure. Example for
BMMH1 
 

You will see BMM00 is to select the Views and BMMH1 contains bulk of the material fields. 

The fields can also be viewed via ABAP Dictionary (se11 /se12) and display the database table
BGR00, BMM00, BMMH1, BMMH2 (or other). 

Step 5: Maintain Field Mapping and Conversion Rules 

Map field in input file to fields in SAP Material master. If your fieldnames in file is same as in SAP,
then you can map them automatically by selecting Menu: Extras > Auto-Field Mapping 
Not all fields need to be mapped, only those that you are loading (as defined in input file). Don't
worry to much about the warning that 'Source field is longer than target file' just make sure your input
data is correct. Example material type must be 4 characters. 

Step 6: Maintain Fixed Values, Translations, User-Defined Routines 

Not used for this project 


Step 7: Specify Files 

Specify source file (on your PC) and what the files will be called on the SAP server. 

Also indicate how your input file will look. Example, TAB delimited and Field names in first row. 
 

Step 8: Assign Files 

 
Step 9: Read Data 

At this point your input file must be ready. More about the input file later. You may want to use
sample file attached to this post as a start. 

Note you don't need to specify path / filename. This was done is step above. 

For big files -; many thousand of records this might take a while. 

Step 10: Display Read Data 

The input file is now on the SAP server and can be displayed. 
 

Click on line to see the details 


 

Step 11: Convert Data 

We now need to convert the data to format so that SAP can process. 
 

Step 12: Display Converted Data 

You can display converted data to ensure that all is ok so far before creating the materials. 
 

And select the structure to see details 

Step 13: Start Direct Input Program 

If all is OK -; let's run them in. 


 

First run it in test mode (not creating material) by selecting the 'Check data, do not update' option 
 

You might get a view messages -; just press OK. In my case I got NO errors. 

 
 

I now run it without the test option. same as above but 'untick' the 'Check data, do not update' option 
 
Materials were successfully created. 

At this point you may still have errors. Either your input data is incorrect, you may have fields as
mandatory that was not in your input fields, different material types, etc. etc. 

INPUT FILE 

In step 7 above we have indicated that we are using TAB delimited files. 

TIP: if you will be working with LSMW files a lot, get a decent text editor. Some suggestions are:
UltraEdit or Crimson Editor (if you want a good free one). 

This is how my input file looks (via Crimson Editor). The funny '>>' fields are TAB's. My editor is set
up to show TAB characters. 
 

Or in Excel (importing the tab delimited file) 


Note that the material number field (MATNR) is blank for first line and 0 (zero) for subsequent lines.
This is the way to specify that internal numbering will be used. And 0 (zero) indicates that material
being created will be extended. Fields to be ignored are marked with "/". For more about format of
file, see notes in SAP Help file. 

In my file, every line is unique material / plant / sloc. The input file can be prepared using database,
spreadsheet or other program. In my case I generated the tab delimited file directly from database
program. 

LAST NOTE ON PREPARING THE DATA (OPTIONAL) 

I find the easiest way is to prepare the material master data is using a SQL database. I
used MySQL [mysql.com]. That way a sql script can be created that implement all the conversion
rules. 

This sample file used in this post was created directly from the database program. Below is the SQL
statement (used in MySQL) that created the final data file. The header (field names) was added in
another step. 
SELECT 'MATLD','500','SAP123','Y','/','MM01', '0','B',mat_type, plant, sloc,

'/','/','/','X','/','/','X','/','X','X','/','/','/',base_uom,'MAT DESCRIP','0100',

'/','/','/','/',1,'/',1,'/','F','ND','001',1,1,'HB',1,100,'A','02','BIN','/',

price_control, price, val_class,'/',14,'/','/','/','/','/','/','/',

old_matnr,'01','00010',profit_centre

INTO OUTFILE 'c:/data/sap123.com/lsmw_direct/lsmw_directinput.txt'

FIELDS TERMINATED BY ' '

LINES TERMINATED BY '

'

FROM main_table

GROUP BY mat_number, plant, sloc

ORDER BY mat_type, old_matnr, plant, sloc;

If above code is meaningless to you. Don't stress, you don't need to use any of this in LSMW. (But I
do suggest you buddy up with someone who knows SQL :) ). 

GETTING HELP FROM SAP 

Very detail help is available in SAP Help Files. For SAP Help files,
goto http://help.sap.com/ [help.sap.com] 
Cross Application Components > CA Data Transfer > Data Transfer Objects > LO logistics General
> Material Master 

This post was prepared using SAP R/3 Enterprise (and LSMW version 4.0.0) 

With this sample and reading the SAP Help files, I hope you are in a position to load your own
materials. 
Attachment: lsmw_materials_directinput.zip 

----------------------------------------------------------- 

Get my blog posts in your inbox!


Subscribe

POPULAR POSTS
SAP MM Tables
Split Valuation
Very basics of SAP External Service Management
SAP Finance Tables
SAP SD Tables
Setting up simple Release Procedure for Purchase Requisitions
Change SAP documents -- tables CDHDR and CDPOS

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy