You are on page 1of 10

Step-by-Step Guide for using LSMW to Update Customer Master Records By Manoj Khichar, SAP/ABAP Consultant Note!

The screen prints in this article are from IDES Release 4.6. They may differ slightly in other versions. Demo E amp!e " LSMW to Update Customer Master Records #it$ Standard %b&ect As an alternative to using Transaction Recording ! you could also use a standard SA" o#$ect to update %ustomer &aster Records. 'usiness (#$ect ))*) is already pre+defined in the system ,ith standard 'atch Input Interface "rogram R-'IDE)) . %reate an (#$ect CUS'(%)* ,ithin +ro&ect as LSMW(DEM% and Subpro&ect as CUS'%MERS as sho,n in ,igure "-.

,igure "- .S&/ (#$ect ,ith Standard SA" (#$ect

Note! -or the Demo e0ample 1! I ,ill list only those steps that are different from the first demo e0ample. Step /0 Maintain %b&ect attributes 2ou ,ill #e updating the customer master records ,ith the help of Standard 'atch Input3 therefore! choose radio+#utton Standard )atc$1Direct 2nput as sho,n in ,igure "/. Enter (#$ect ))*) for %ustomer &aster Records and default method )))) and clic4 on Save.

,igure "/ Standard 'atch5Direct Input (#$ect Attri#utes

Step+#y+Step guide for using .S&/

"age 6

Step ". Maintain Source Structures 7ive a name and a description to the source structure 8,igure 39.

,igure 3

Source Structure

Step 4. Maintain Source ,ie!ds In this step! you need to list ,hat fields are present in the source structure. The easiest ,ay is to clic4 on Ta#le &aintenance icon to enter -ieldname! Type and .ength for each field as sho,n in ,igure 5.

,igure 5 Source fields of source Structure

:ote that your input file ,ill have four fields as 4ey fields and you need to update three fields in the system. Step 60 Maintain Structure Re!ations Sales vie, of %ustomer &aster is stored in ta#le ;:<<. Accordingly! you need to update structure ';:<<. =o,ever! in addition! the Standard (#$ect ))*) also re>uires updates to '7R))! ';:)) and ';:A6 structures. 8If you do not maintain Structure relations for mandatory entries! you might get a message such as Target structure ';:A6 needs a relation to a source structure .9 Even though you don t ,ant to update any fields in these structures! you need to create a relationship ,ith source structures. In all! you need to create relationship for four target structures.
Step+#y+Step guide for using .S&/ "age 1

%reate relationship #et,een source structures ?D)1S ,ith these target structures ,ith icon %reate Relationship .

;eep %ursor on these four target structures and clic4 on icon %reate Relation and structure relations are maintained as sho,n in ,igure "".

,igure "" Structure Relation

Step 70 Maintain fie!d mapping and con8ersion ru!es ++ ;eep your cursor on T%(DE field and clic4 on Insert Rule icon

Step+#y+Step guide for using .S&/

"age @

,igure "4 .S&/ %onversion Rules

%hoose radio #utton %onstant 8,igure "49 to enter value ?D)1 transaction code. ++ ;eep your cursor on field ;A::R and clic4 on Assign source field icon

%hoose source field %ustomer from source structure ?D)1S . 8See ,igure "6.9

,igure "6 Assign Source fields

++ Similarly! choose source fields for Sales (rganiBation! Distri#ution %hannel! and Division. 8See ,igure "7.9
Step+#y+Step guide for using .S&/ "age 4

,igure "7 -ield &apping and %onversion Rules

++ Scroll do,n to structure ';:<< fields and assign source fields to three fields Sales (ffice! Sales 7roup! and %ustomer 7roup 8,igure "99.

Step+#y+Step guide for using .S&/

"age *

,igure "9 -ield &apping and %onversion Rules

Save and go #ac4 to main screen. Step 90 Maintain fi ed 8a!ues: trans!ations: user-defined routines 2ou can also maintain re+usa#le translations and user+defined routines! ,hich can #e used across conversion tas4s. In this case! that step is not re>uired. Step ;0 Specify fi!es In this step! ,e define ho, the layout of the input file is. The input file is a CTa#D delimited ,ith the first ro, as field names. It is present on my "% 8local drive9 as %EF?D)1.t0t. 8See ,igure /4.9

Step+#y+Step guide for using .S&/

"age 6

,igure /4 -ile attri#utes

%reate an E0cel file 8,igure /69 ,ith your data and save it as a Ta#+delimited te0t file on your local drive 8%EF9 and name it ?D)1.t0t.

,igure /6 Source data in E0cel file 8saved as Ta# delimited file9

Step+#y+Step guide for using .S&/

"age G

Step 30 <ssign fi!es E0ecute step Assign -iles 8,igure /79 and the system automatically defaults the filename to the source structure.

,igure /7 Assign file to Source Structure

Step 50 Read data In this step! .S&/ reads the data 8,igure /99 from the source file 8from your "% s local drive9. 2ou have the option to read only selected ro,s and convert data values to Internal format.

,igure /9 Read Data

Step /-0 Disp!ay read data This step 8,igure /;9 is optional. If re>uired! you can revie, the field contents for the ro,s of data read.

,igure /; Display Read Data


Step+#y+Step guide for using .S&/ "age H

Step //0 Con8ert data This is the step that actually converts the source data 8in source format9 to a target format. 'ased on the conversion rules defined! source fields are mapped to target fields. Step /"0 Disp!ay Con8erted data /hen you convert data! .S&/ automatically converts into the appropriate structure layouts! as re>uired #y Standard program 8R-'IDE))9. 8See ,igure ";9

,igure "; %onverted data into multiple structures

:ote that if you had only one record in source file! the converted file has four records. Earlier! creating this input file! so that the standard interface program can read it! ,as a #ig nightmare! the primary reason #eing that it could have multiple record layouts. Even for a simple conversion ,ith one input record! you ,ould have to create this comple0 file ,ith many record layouts. The advantage of .S&/ is that it prepares these multi+layout files automatically. Step /40 Create batc$ input session (nce source data is converted in internal format! you can create a 'D% session to process the updates 8,igures "3 and "59.

Step+#y+Step guide for using .S&/

"age I

,igure "3 %reate 'D% Session

,igure "5 'D% Session %ASTJ('K created

Step /60 Run )atc$ 2nput Session 2ou can e0ecute the 'D% session #y Run )atc$ input session. E0ecuting a #atch input session is a standard SM35 transaction for managing 'D% sessions. (nce you have successfully e0ecuted the #atch input session! the customer master records are updated in the system. 2ou can confirm this #y vie,ing the customer master records 8XD039. Note! 'ro,sing thru these 64 steps! you may get a feeling that this is a very lengthy and time+consuming activity. =o,ever! for the purposes of demonstration! I have made it detailed. Although it loo4s lengthy! actually it ta4es hardly fe, hours from start+to+finishL After playing around ,ith fe, simple .S&/ scripts! you ,ill find it so easy to change and create more comple0 ones.
Manoj Khichar is a SAP/ABAP consultant with over1 years of SAP consulting experience !ith an MCA/MBA "egree in #ar$eting, Manoj concentrates on the ABAP Mo"ules with e#phasis on B%C, SAP Script, %ialog Progra#, an" A&' (e also has experience with S%, MM, an" )*C+ (e can ,e reache" ,y e-#ail at #$hichar.g#ail co#

Step+#y+Step guide for using .S&/

"age 6)