L S MW Bas ics

Bas ics Bas ics S tructure Definitions S tructure Definitions Field Mapping and Rules Field Mapping and Rules Reading and Trans ferring Data to R/3 Reading and Trans ferring Data to R/3

 S AP AG 1999

L S MW: C ore Functions

 Read data
 

S preads heet tables S equential files

 C onvert data

 Import data

Data trans fer
 S AP AG 1999


you must define the structure of the file (source structure). the contents of the LSMW file are converted to the target structure and can then be transferred using the specified transfer method.Note: • • • • Using the LSMW. To read these files. The next step is to define structure relationships and field assignments. Using these definitions. you specify how the value of the source structure field is to be transferred to the field in the target structure. The file contents are then read into an internal LSMW format and stored as an LSMW file. These specify the mapping of the source structure fields to the target structure fields. The LSMW generates two executable ABAP programs from the structure definitions and conversion rules. you can read data from presentation servers (PC) or application servers. In addition. • • . To do this. you must define a conversion rule for every source field that maps to a field in the target structure.


S tarting the L SMW Initial S creen: Trans action LSMW L S MW organized by:    Project S ubproject Object P roject S ubproject Object You mus t s pecify a name and s hort des cription for eac h of thes e.  S AP AG 1999 .

Project Overview  All Objects  Overview of objects contained in s ys tem  My Objects  Overview of objects the us er created  All Objects in a Project  Overview of objects in the current project  S AP AG 1999 .

The Main S teps  Define object attributes  Define s ource s tructures and s ource fields  Define s tructure relations hips  Define field mapping and convers ion rules  Read data  Convert data  Import data  S AP AG 1999 .

Subs teps LS M Workbench E dit . E xtras .... .  S AP AG 1999 . Utilities S ystem S AP E as y Acc es s Pers onal Menü P ersonal Menu The available LS MW s ubs teps can be activated via the Pers onal Menu Maintain source attributes Maintain source structures Maintain source fields Maintain structure relationships F ixed values..... maintain conversions and own routines S pecfiy files Generate import program Display import program Import data Display imported data Generate conversion program Display conversion program C onvert data Display converted data .L S MW ..

Maintain Object Attributes Object Attributes Object ID Owner Property Attributes Object Owner Data transfer BC420_ D R OBE R TS once E xample J essica R oberts periodic  S AP AG 1999 .


. Object Overview Object information about: Object Overview  S ource s tructures  S ource fields  S tructure relations hips  Target s tructures  Target fields  Field mapping  S AP AG 1999 .Overview of Object C reation LS MW ..

.......C onvers ion on Paper E XCE L Lis t S AP Fields Field S TY P E TC ODE KUNNR B UKR S Des cription R ecord type Transaction code C ustomer number C ompany code Type C HAR C HAR C HAR C HAR Length Field 1 20 10 4 Non-SAP Fields Length Convers ion .. a3ktn2 10 M  S AP AG 1999 .

L S MW Structure Definitions Bas ics Bas ics S tructure Definitions S tructure Definitions Field Mapping and Rules Field Mapping and Rules Reading and Trans ferring Data to R/3 Reading and Trans ferring Data to R/3  S AP AG 1999 .

Flat Source Structure File with flat s tructure: Field 1 Field 2 Field 3 S tructure A Definition contains :    S AP AG 1999 S tructure name Field name .

S ource S tructures C ontaining Two Structures File with two s tructures : Field 1 Field 2 Field 3 Field 4 S tructure B S tructure C Field 1 Field 2 Field 3 Definition contains :    S AP AG 1999 S tructure names Field names .

S ource S tructures With Header and Pos itions Field 1 Header ID field File with header and pos itions : Field 2 Field 3 Field 4 Header s tructure Pos ition s tructure Field 2 Field 3 Field 1 Pos ition ID field Definition contains :     S AP AG 1999 S tructure names Field names ID field .

Maintain Source Structures Work S teps  Maintain s ource s tructures   Name of the s ource s tructure Des cription of the s ource s tructure Source Structures  HEAD POSI Document header Document position  S AP AG 1999 .

Maintain Source Fields Work S teps  Maintain S ource Fields  Field name  Field ID  Field length  Field type Source Fields  HEAD SET1 REF_NO C(001) Record ID C(009) Reference number :  POSI SET2 DATE C(001) Record ID DDMY(010) Posting date :  S AP AG 1999 .

. AMT3. DYMD) => internal ABAP format YYYYMMDD  Amount fields (AMT1.PAC5)  S AP AG 1999 ... AMT2... DMDY. AMT4) => internal ABAP format with period as decimal point  Fields with packed contents (PAC0 .Field Types  Fields with alphanumeric contents (C field)  Fields with numeric contents (N field)  Date in date format (DDMY.


Hierarchical Dis play S ource s tructures  A  B C S tructure relation  X  A Y  B Z C Available fields X Y Z A A ^ B A ^ B ^ C  S AP AG 1999 .

L S MW Field Mapping and Rules

Bas ics Bas ics S tructure Definitions S tructure Definitions Field Mapping and Rules Field Mapping and Rules Reading and Trans ferring Data to R/3 Reading and Trans ferring Data to R/3

 S AP AG 1999

Overview: Field Mapping
Work S teps

 Field Information and convers ion rules Documentation Valid values Navigation in the ABAP Dictionary

Field mapping and rules  BGR00 Fields  BBKPF  Fields BLDAT BUKRS Date Company code

 S AP AG 1999

Dis play Variant in the L S MW

F ield Mapping

E dit


E xtras


Utilities S ystem

S AP E as y Acc es s

Dis play variant

Determine Display Variant Other parameters , s uch as the LS MW “Technic al fields “ can be dis played from the dis play variant. Technical fields Initial fields Code Global data definitions Proces s ing times Form routines (ABAP s ubprograms )
 S AP AG 1999

Dis play Variant: Technical Fields Determine Display Variant Technical fields Initial fields Code After s elec ting the c hec kbox .. the tec hnical fields of s truc ture BGR00 (s es s ion header record) are vis ible Field Mapping and Assignment  BGR00  Fields STYPE Coding: GROUP Coding: MANDT Coding: USNAM . Coding: Record type for BI interface BGR00-STYPE = ‘0‘. Name of BI session BGR00-GROUP = g_groupname.. Client BGR00-MANDT = SY_MANDT. Queue Userid / historically determined BGR00-USNAM = g_userid.  S AP AG 2001 .

Reus ability of Rules  Rule levels  Domain level  Data element level  Field (name) level Project S ys tem propos al Domain / Data element/ Field name  S AP AG 1999 .

1.  S AP AG 1999 . Definition of convers ion rule 2.S ource Field As s ignment  S equence 1. As s ignment of s ource field to target field 2.


Rule: C ons tants  Attribute  Target field filled with a cons tant value Company code 0001 0001  S AP AG 1999 .

7  S AP AG 1999 .Rule: Trans fer  Attribute  Target field filled with ABAP command MOVE S MITH S MITH  E xceptions :    Packed fields Date fields Amount fields Internal format (YYYYMMDD) DDMMYYYY MMDDYYYY As o Ver f L S MW s io n 1.

Rule: Fixed Value  Attribute  Target field as s igned a “variable” BUKRS = 0001 BUKRS Company code (domain) 0001 F ixed value  Fixed Value   Name Des cription Attributes  Attributes     Length ABAP type Lowercas e Value  S AP AG 1999 .

Double-click  S AP AG 1999 .Rule: C hanging Trans lation  Trans lation attributes     S ource field / target field Control 1:1 trans lation values Interval trans lation values BS CHL = ??? perform lsmw_translate using 'BSCHL' POSI-POSTING_KEY changing BBSEG-NEWBS.

Trans lation C ontrol Overview Trans lation attribute  Control BS CHL = ??? Variants Variant F irst S econd Alternative Alternative 1:1 translation Interval translation Initial value C onstant Transfer (MOVE ) User-defined routine No action Other Add 1:1 translation values automatically  S AP AG 1999 .

1:1 Values of Convers ion Key  1:1 Values of convers ion key  Old value  New value BS CHL = ??? Old Value 0004 0005 New Value 40 50 OK  S AP AG 1999 .

to New value BS CHL = ??? Old values from Old values to 0001 0004 0005 0008 New value 40 50 OK  S AP AG 1999 ...C onvers ion Value Interval  Convers ion value interval   Old values from ..

.. + 00 = S uffix 00 1104 + 00 110400 CONCATENATE posi-account '00' INTO bbseg-newko.  S AP AG 1999 ..Rule: Prefix  Attribute  S tring operation 10 + . = Prefix 10 10 + 1104 101104 CONCATENATE '10' posi-acount INTO bbseg-newko...

.  S AP AG 1999 ..... + .. Plant A_ 2311 Important: All s ource fields involved in the concatenation mus t be previous ly as s igned to the s ame target field.Rule: C oncatenation  Attribute  S tring operation: Combine s ource fields .. = Plant + A_ 2311 + ..

 S AP AG 1999 .Rule: Trans fer L eft-J us tified  Attribute  S tring operation: Text trans ferred left-jus tified Information E xample: Information Bbseg-sgtxt = posi-text. SHIFT bbseg-sgtxt LEFT DELETING LEADING SPACE.

Rule: ABAP Code  Attribute  Ins ert your own ABAP code in the generated program ABAP 1234400 221555  S AP AG 1999 .

.. ENDFORM.Rule: Own Routine  Attribute  Include s ubprograms GS BE R Bus ines s area (domain) E xample: PERFORM ur_gsber CHANGING bbseg-gsber.  S AP AG 2001 . FORM ur_gsber .

Field Mapping and Convers ion Rules Work S teps  Fixed values .. convers ion rules ...  Overview of reus able rules    Fixed values Convers ions Us er-defined routines Reusable rules  BC420-TEST Training data transfer BC420  Fixed values BLART  Conversions BLART BSCHL User-defined routines  S AP AG 1999 .

L S MW Reading and Trans ferring Data to R/3 Bas ics Bas ics S tructure Definitions S tructure Definitions Field Mapping and Rules Field Mapping and Rules Reading and Trans ferring Data to R/3 Reading and Trans ferring Data to R/3  S AP AG 1999 .

S pecifying Files Work S teps  S pecify files  S pecify paths and files File name File name on PC Application s erver File name Convers ion File name  S AP AG 1999 .

ls mw.Imported Data File  S pecify paths and file names File BC420_ 46_ D_ CT_ 01.read File name: <path><file name>.ls mw.read File name = project name + s ubproject name + object name  S AP AG 1999 .

conv  S AP AG 2001 . Logical path Logical file Z_ TE MP Z_ BC420 File name: <path><file name>.C onverted Data File  Depending on the s elected object (e.conv  Determine logical path and logical file. File BC420_ 46_ D_ CT_ 01.ls mw. batch input for cus tomers ).g.ls mw. you have the following options :  Determine path and file name for objects that only have a phys ical path/file name.

ls mw.read doc_ *.conv Value of wildcard Des cription data_ 1 Data record 1  S AP AG 1999 .leg doc_ *.Wildcards in File Names  Us ing wildcards in file names doc_ *.ls mw.

LEG  S AP AG 1999 .As s igning Files Work S teps  Object attributes  S pecify which s ource s tructure is filled by which file HEAD POSI Source structures and files  HEAD documents source data BC420_DOC_HEAD_POS.LEG POSI position source data BC420_DOC_HEAD_POS.

if checkbox is selected  Date values Date fields are converted into the internal ABAP format (Y Y Y Y MMDD). if checkbox is selected  S AP AG 1999 .56 Date values -> YYYYMMDD  Amount fields Amount fields are converted into the internal ABAP format (with decimal point).Importing Data Work S teps   Import data S pecify which data is to be imported Amount fields -> 1234.

89 Info P0005H113100name 3010.12 Info 3 SET1 H REF_NO Reference number BC1000001 REF_NO Reference BC1000001 DOC_DATE Doc.07.07.48 Info 3 2 P0005S110000 405 204.50 1740.41 Info 2 1 P0005H113100 3005.89 Info P0004S100000 3410.50 3107199930071999DM 1740.12 410 Record indicator SET1 H P0005S110000 410 Record indicator 376.89 Info P0005H113100 3005.07.1999$ HBC100000219990730 3107199930071999$ HBC100000219990730 07 07 31.199930.77 Field value 2 1 Info Field Field P0005H113100 2830.77 Field Info 3 2 Info Field Field value P0005S110000 name 3010. date number 30071999 DOC_DATE Doc.07.199930.50 3206.50 1536.1999DM HBC100000119990730 3107199930071999DM HBC100000119990730 07 07 31.50 text 2830.07.199930.50 1536.48 Info 3 HBC100000219990730 07 07 31.199930. 30071999 TYPE TYPE date 07 TYPE TYPE 07 CURR_KEY document currency DM CURR_KEY document currency DM  S AP AG 1999 .Dis playing Imported Data Dis playing Imported Data Work S teps Work S teps  Dis play imported data  Dis play imported data By record By record  By field  By field   1 DOCUMENTS HEAD 1POSI HEAD 2 DOCUMENTS POSI 3 2POSI POSI 4 3POSI POSI 5 4DOCUMENTS HEAD HEAD DOCUMENTS 6 5POSI POSI 7 6POSI POSI 8 7POSI 8 POSI HBC100000119990730 07 07 31.50 text 376.89 Info P0004S100000 3420.07.07.50 3107199930071999$ 3206.07.41 Info P0005S110000 405 204.1999DM 1 HBC100000119990730 P0004S100000 3410.1999$ 1 HBC100000219990730 P0004S100000 3420.

Date fields are NOT formatted in the LS MW vers ion < 1.C onverting Data Work S teps Note: Amount fields (AMT1..7 they are always dis played in format YYYYMMDD  Convert data Field as s ignment Generated convers ion program Transactions read: Records read: Transactions written: Records written: 5 20 5 21  S AP AG 1999 ..) for s tandard trans fer programs are formatted according to us er-defined s ettings .

Dis playing Converted Data Work S teps  Dis playing the converted data   By record By field 0KNA1_A 1FB01 2BBSEG 2BBSEG 2BBSEG 1FB01 2BBSEG 2BBSEG 2BBSEG 100ROBERTS / 30071999SA0001/ / DEM 40/ // 50/ // 50/ // 30071999SA0001/ / USD 40/ // Field 50/ Field text // STYPE 50/ Record type // TCODE Transaction code BLDAT Date BLART Document type BUKRS Company code BUDAT Date WAERS Currency key 1 2 3 4 5 6 7 8 9 BGR00 BBKPF BBSEG BBSEG BBSEG BBKPF BBSEG BBSEG BBSEG Field value 1 FB01 30071999 SA 0001 / DEM  S AP AG 1999 .



Adminis trative Functions  Project       Copy Delete Create documentation Print E xport Import E xport / Import  S AP AG 1999 .

Authorizations Authorization Level Display E xecute C hange Administrate Profile B_ LS MW_ S HOW B_ LS MW_ E XE C B_ LS MW_ C HG B_ LS MW_ ALL  S AP AG 1999 .

C ours e Overview Diagram Call Trans action Direct Input Batch Input 4 12 99 E DI BAPI 11 12 10 Principles of Standard Data Tans fer DX Workbench 5 11 3 6 8 10 11 13 LS M Workbench 7 2 1  S AP AG 1999 Bas ics Datenübernahme Cours e Overview 14 TA Recorder .


direct input programs must be processed as background jobs run under the direct input monitor (program RBMVSHOW or transaction BMV0). • • • . no sessions are created the data is updated directly. SAP strongly recommends that you use transaction BMV0 for the actual data transfer. If you are working with test data. To enable restart. Unlike batch input. Make sure that neither error logs are created nor that the possibility of a restart exists in error situations. DI is more efficient than the other methods making it especially useful for transferring large datasets. No screens are involved in this procedure. If case errors occur during the data transfer. direct input has a restart mechanism.Notes: • An alternative to the batch input method is the direct input (DI) method. The data is entered directly into database tables by calling function modules that carry out the necessary checks. you can start direct input in foreground.



time. Note: The restart mechanism will not work if the file contains formal errors (i. If the job is terminated.e.Notes: • • • • Direct input run: First create a variant for the transfer program. by job. Use the “check file” function to ensure that no formal errors exist before processing the file using direct input. by event. it can be reset. Analyze the job log after the job run. Define a job with this variant. date. • • • . if the records are not in the SAP Record Layout). etc). Schedule the time of the job (start: immediately.


...  S AP AG 1999 .....J ob Analys is J ob administration Applications Direct input :adminis tration J ob details J ob log  Technical information       Program name Variant name S erver .. S ys tem mes s ages are lis ted chronologically Long text can be dis played  Adminis tration information    Number of errors Number of res tarts .

Sign up to vote on this title
UsefulNot useful