Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

LSMW, BDC, DI Conversion Methods

raja_thangamani
Active Contributor
0 Kudos

Hi All,

Could anyone tell me when we can use LSMW, Direct Input, Batch Input session, Call Transaction method for Data Conversion?

Basically what criteria decides the method to be used?

Thanks,

Raja T

1 ACCEPTED SOLUTION

Former Member
0 Kudos

hi,

check the following link.

http://www.sap-img.com/general/what-are-the-methods-to-migrate-data-from-a-legacy-system-to-sap.htm

Regards,

Sudheer.A

Message was edited by: sudheer Addepalli

4 REPLIES 4

Former Member
0 Kudos

hi,

check the following link.

http://www.sap-img.com/general/what-are-the-methods-to-migrate-data-from-a-legacy-system-to-sap.htm

Regards,

Sudheer.A

Message was edited by: sudheer Addepalli

ferry_lianto
Active Contributor
0 Kudos

Hi Raja,

Please check this thread.

Hope this will help.

Regards,

Ferry Lianto

Former Member
0 Kudos

HI

GUD

AS YOU HAVE MENTIONED THERE IS NO SHCE CRITERIA WHICH WILL DECIDE THAT WHAT METHOD YOU R GOING TO USE .

EVERYTHING IS DEPENDS UPON YOUR REQUIREMENT ,AND AS PER THE REQUIREMENT IT CHANGES.

EVERY PROCESS HAS ITS OWN ADVANTAGES AND DISADVANTAGES , SO THE PROJECT MANAGER USE TO DECIDE WHICH METHOD YOU HAVE TO FOLLOW.

SOMETIME THERE WOULD BE SOME SPECIAL CHOICE OF THE CLIENT AND ACCORDINGLY WE HAVE TO WORK ON THAT.

THANKS

MRUTYUN

Former Member
0 Kudos

Hai Raja

For LSMW

Using Tcode MM01 -- Maintain the source fields are

1) mara-amtnr char(18)

2) mara-mbrsh char(1)

3) mara-mtart char(4)

4) makt-maktx char(40)

5) mara-meins char(3)

the flate file format is like this as follows

MAT991,C,COUP,Srinivas material01,Kg

MAT992,C,COUP,Srinivas material02,Kg

AMT993,C,COUP,Srinivas material03,Kg

MAT994,C,COUP,Srinivas material04,Kg

MAT995,C,COUP,Srinivas material05,Kg

goto Tcode LSMW

give Project Name

Subproject Name

object Name

Press Enter -


Press Execute Button

It gives 13 radio-Button Options

do the following 13 steps as follows

1) select radio-Button 1 and execute

Maintain Object Attributes

select Standard Batch/Direct Input

give Object -- 0020

Method -- 0000

save & Come Back

2) select radio-Button 2 and execute

Maintain Source Structures

select the source structure and got to click on create button

give source structure name & Description

save & Come Back

3) select radio-Button 3 and execute

Maintain Source Fields

select the source structure and click on create button

give

first field

field name matnr

Field Label material Number

Field Length 18

Field Type C

Second field

field name mbrsh

Field Label Industrial Sector

Field Length 1

Field Type C

Third field

field name mtart

Field Label material type

Field Length 4

Field Type C

fourth field

field name maktx

Field Label material description

Field Length 40

Field Type C

fifth field

field name meins

Field Label base unit of measurement

Field Length 3

Field Type C

save & come back

4) select radio-Button 4 and execute

Maintain Structure Relations

go to blue lines

select first blue line and click on create relationship button

select Second blue line and click on create relationship button

select Third blue line and click on create relationship button

save & come back

5) select radio-Button 5 and execute

Maintain Field Mapping and Conversion Rules

Select the Tcode and click on Rule button there you will select constant

and press continue button

give Transaction Code : MM01 and press Enter

after that

1) select MATNR field click on Source filed(this is the field mapping) select MATNR and press Enter

2) select MBRSH field click on Source filed(this is the field mapping) select MBRSH and press Enter

3) select MTART field click on Source filed(this is the field mapping) select MTART and press Enter

4) select MAKTX field click on Source filed(this is the field mapping) select MAKTX and press Enter

5) select MEINS field click on Source filed(this is the field mapping) select MEINS and press Enter

finally

save & come back

6) select radio-Button 6 and execute

Maintain Fixed Values, Translations, User-Defined Routines

Create FIXED VALUE Name & Description as MM01

Create Translations Name & Description as MM01

Create User-Defined Routines Name & Description as MM01

after that delete all the above three just created in the 6th step

FIXED VALUE --MM01

Translations --MM01

User-Defined Routines --MM01

come back

7) select radio-Button 7 and execute

Specify Files

select On the PC (Frontend) -- and click on Create button(f5)

give the path of the file like "c:\material_data.txt"

description : -


separators as select comma radiao- button

and press enter save & come back

😎 select radio-Button 8 and execute

Assign Files

Save & come back

9) select radio-Button 9 and execute

Read Files

Execute

come back

come back

10) select radio-Button 10 and execute

Display Imported Data

Execute and press enter

come back

Come back

11) select radio-Button 11 and execute

Convert Data

Execute

come back

Come back

12) select radio-Button 12 and execute

Display Converted Data

Execute & come back

13) select radio-Button 13 and execute

Start Direct Input Program

select the Program

select continue button

go with via physical file

give the lock mode as 'E'

and execute

For Direct Input Method

&----


*& Report ZDIRECT_INPUT *

*& *

&----


*& *

*& *

&----


REPORT ZDIRECT_INPUT .

TABLES: BGR00,

BKNA1,

BKNB1,

BKN00.

DATA: BEGIN OF IT_TAB OCCURS 0,

KUNNR LIKE KNA1-KUNNR,

BUKRS LIKE KNB1-BUKRS,

KTOKD LIKE KNA1-KTOKD,

ANRED LIKE KNA1-ANRED,

NAME1 LIKE KNA1-NAME1,

SORTL LIKE KNA1-SORTL,

ORT01 LIKE KNA1-ORT01,

LAND1 LIKE KNA1-LAND1,

LZONE LIKE KNA1-LZONE,

SPRAS LIKE KNA1-SPRAS,

AKONT LIKE KNB1-AKONT,

END OF IT_TAB.

DATA: P_FILE LIKE RLGRAP-FILENAME value 'vinguru_di1.txt',

P_SESS TYPE APQI-GROUPID VALUE 'VIN_DI'.

FIELD-SYMBOLS: <F>.

PERFORM UPLOAD_DATA.

OPEN DATASET P_FILE FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.

IF SY-SUBRC <> 0.

MESSAGE E004(ZI) WITH 'ERROR IN OPENING FILE'.

ENDIF.

*INITIALIZING THE RECORDS

PERFORM INITIALISE.

  • POPULATE THE STYRUCTRES AND TRANSFER THEM TO SEQUENTIAL FILE

PERFORM POPULATE.

CLOSE DATASET P_FILE.

SUBMIT RFBIDE00 WITH DS_NAME = P_FILE AND RETURN.

&----


*& Form UPLOAD_DATA

&----


FORM UPLOAD_DATA .

CALL FUNCTION 'UPLOAD'

EXPORTING

FILENAME = 'C:\VINODH_ID1.TXT'

FILETYPE = 'DAT'

TABLES

DATA_TAB = IT_TAB

EXCEPTIONS

CONVERSION_ERROR = 1

INVALID_TABLE_WIDTH = 2

INVALID_TYPE = 3

NO_BATCH = 4

UNKNOWN_ERROR = 5

GUI_REFUSE_FILETRANSFER = 6

OTHERS = 7

.

IF SY-SUBRC <> 0.

MESSAGE E004(ZI) WITH 'ERROR IN UPLOADING FILE TO INTERNAL TABLE'.

ENDIF.

ENDFORM. " UPLOAD_DATA

&----


*& Form INITIALISE

&----


FORM INITIALISE .

MOVE:'0' TO BGR00-STYPE,

P_SESS TO BGR00-GROUP,

SY-MANDT TO BGR00-MANDT,

SY-UNAME TO BGR00-USNAM,

'X' TO BGR00-XKEEP,

'/' TO BGR00-NODATA.

TRANSFER BGR00 TO P_FILE.

PERFORM FILL_INITIAL CHANGING BKN00.

PERFORM FILL_INITIAL CHANGING BKNA1.

PERFORM FILL_INITIAL CHANGING BKNB1.

ENDFORM. " INITIALISE

&----


*& Form FILL_INITIAL

&----


FORM FILL_INITIAL CHANGING P_BKN00.

DATA: V_COUNT TYPE I VALUE 0.

DO.

V_COUNT = V_COUNT + 1.

ASSIGN COMPONENT V_COUNT OF STRUCTURE P_BKN00 TO <F>.

IF SY-SUBRC <> 0.

EXIT.

ENDIF.

MOVE BGR00-NODATA TO <F>.

ENDDO.

ENDFORM. " FILL_INITIAL

&----


*& Form POPULATE

&----


FORM POPULATE .

LOOP AT IT_TAB.

  • HEADER RECORD

BKN00-STYPE = '1'.

BKN00-TCODE = 'XD01'.

BKN00-KUNNR = IT_TAB-KUNNR.

BKN00-BUKRS = IT_TAB-BUKRS.

BKN00-KTOKD = IT_TAB-KTOKD.

TRANSFER BKN00 TO P_FILE.

  • SECONDARY RECORD

BKNA1-STYPE = '2'.

BKNA1-TBNAM = 'BKNA1'.

BKNA1-ANRED = IT_TAB-ANRED.

BKNA1-NAME1 = IT_TAB-NAME1.

BKNA1-ORT01 = IT_TAB-ORT01.

BKNA1-SORTL = IT_TAB-SORTL.

BKNA1-LAND1 = IT_TAB-LAND1.

BKNA1-LZONE = IT_TAB-LZONE.

BKNA1-SPRAS = IT_TAB-SPRAS.

TRANSFER BKNA1 TO P_FILE.

BKNB1-STYPE = '2'.

BKNB1-TBNAM = 'BKNB1'.

BKNB1-AKONT = IT_TAB-AKONT.

TRANSFER BKNB1 TO P_FILE.

CLEAR IT_TAB.

ENDLOOP.

ENDFORM. " POPULATE

For Batch Input Session Method

report Z_SRINU_CALLTRANS_VENDOR_01

no standard page heading line-size 255.

      • Generated data section with specific formatting - DO NOT CHANGE ***

data: begin of it_lfa1 occurs 0,

KTOKK like lfa1-ktokk,

NAME1 like lfa1-name1,

SORTL like lfa1-sortl,

LAND1 like lfa1-land1,

end of it_lfa1.

      • End generated data section ***

data : it_bdc like bdcdata occurs 0 with header line.

*DATA: IT_MESSAGES TYPE TABLE OF BDCMSGCOLL WITH HEADER LINE.

*DATA: LV_MESSAGE(255).

data : it_messages like bdcmsgcoll occurs 0 with header line.

data : V_message(255).

data : V_flag.

data : V_datum1 type sy-datum.

data : begin of it_mesg occurs 0,

message(100),

end of it_mesg.

*V_datum1 = sy-datum-1.

parameters : P_Sess like APQI-GROUPID.

start-of-selection.

perform Get_data.

*perform open_group.

loop at it_lfa1.

perform bdc_dynpro using 'SAPMF02K' '0100'.

perform bdc_field using 'BDC_CURSOR'

'RF02K-KTOKK'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'RF02K-KTOKK'

it_lfa1-KTOKK.

perform bdc_dynpro using 'SAPMF02K' '0110'.

perform bdc_field using 'BDC_CURSOR'

'LFA1-LAND1'.

perform bdc_field using 'BDC_OKCODE'

'=UPDA'.

perform bdc_field using 'LFA1-NAME1'

it_lfa1-name1.

perform bdc_field using 'LFA1-SORTL'

it_lfa1-sortl.

perform bdc_field using 'LFA1-LAND1'

it_lfa1-land1.

call transaction 'XK01' using it_bdc

mode 'N'

update 'S'

messages into it_messages.

if sy-subrc <> 0.

if V_flag <> 'X'.

perform open_group.

V_flag = 'X'.

endif.

perform bdc_transaction. "using 'XK01'.

endif.

perform format_messages.

refresh : it_bdc,it_messages.

.

endloop.

if V_flag = 'X'.

perform close_group.

endif.

&----


*& Form Get_data

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM Get_data .

CALL FUNCTION 'UPLOAD'

EXPORTING

FILENAME = 'C:\srinu_vendor.txt'

FILETYPE = 'DAT'

TABLES

DATA_TAB = it_lfa1

EXCEPTIONS

CONVERSION_ERROR = 1

INVALID_TABLE_WIDTH = 2

INVALID_TYPE = 3

NO_BATCH = 4

UNKNOWN_ERROR = 5

GUI_REFUSE_FILETRANSFER = 6

OTHERS = 7

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

ENDFORM. " Get_data

&----


*& Form bdc_dynpro

&----


  • text

----


  • -->P_0061 text

  • -->P_0062 text

----


FORM BDC_DYNPRO USING PROGRAM DYNPRO.

CLEAR it_BDC.

it_BDC-PROGRAM = PROGRAM.

it_BDC-DYNPRO = DYNPRO.

it_BDC-DYNBEGIN = 'X'.

APPEND it_BDC.

ENDFORM.

----


  • Insert field *

----


FORM BDC_FIELD USING FNAM FVAL.

CLEAR it_BDC.

it_BDC-FNAM = FNAM.

it_BDC-FVAL = FVAL.

APPEND it_BDC.

ENDFORM.

&----


*& Form format_messages

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM format_messages .

loop at it_messages.

CALL FUNCTION 'FORMAT_MESSAGE'

EXPORTING

ID = it_messages-MSGID

LANG = 'EN'

NO = it_messages-MSGNR

V1 = it_messages-MSGV1

V2 = it_messages-MSGV2

V3 = it_messages-MSGV3

V4 = it_messages-MSGV4

IMPORTING

MSG = V_message

EXCEPTIONS

NOT_FOUND = 1

OTHERS = 2

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

write : / V_message.

clear : V_message.

endloop.

ENDFORM. " format_messages

&----


*& Form open_group

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM open_group .

CALL FUNCTION 'BDC_OPEN_GROUP'

EXPORTING

CLIENT = SY-MANDT

GROUP = P_Sess

  • HOLDDATE = V_datum1

KEEP = 'X'

USER = SY-UNAME

.

IF SY-SUBRC = 0.

write : / 'Session Creating wit Name : ',P_Sess.

ENDIF.

ENDFORM. " open_group

&----


*& Form close_group

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM close_group .

CALL FUNCTION 'BDC_CLOSE_GROUP'.

ENDFORM. " close_group

&----


*& Form bdc_transaction

&----


  • text

----


  • -->P_0132 text

----


FORM bdc_transaction. "USING VALUE(P_0132).

CALL FUNCTION 'BDC_INSERT'

EXPORTING

TCODE = 'XK01'

  • POST_LOCAL = NOVBLOCAL

  • PRINTING = NOPRINT

  • SIMUBATCH = ' '

  • CTUPARAMS = ' '

TABLES

DYNPROTAB = it_bdc

  • EXCEPTIONS

  • INTERNAL_ERROR = 1

  • NOT_OPEN = 2

  • QUEUE_ERROR = 3

  • TCODE_INVALID = 4

  • PRINTING_INVALID = 5

  • POSTING_INVALID = 6

  • OTHERS = 7

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

ENDFORM. " bdc_transaction

For Call Transaction Method

report Z_SRINU_BDC_02

no standard page heading line-size 255.

tables : mara,makt.

data : begin of it_mara occurs 0,

matnr like mara-matnr,

mbrsh like mara-mbrsh,

mtart like mara-mtart,

maktx like makt-maktx,

meins like mara-meins,

end of it_mara.

include bdcrecx1.

start-of-selection.

perform Get_Data.

perform open_group.

loop at it_mara.

perform bdc_dynpro using 'SAPLMGMM' '0060'.

perform bdc_field using 'BDC_CURSOR'

'RMMG1-MBRSH'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'RMMG1-MATNR'

it_mara-matnr.

perform bdc_field using 'RMMG1-MBRSH'

it_mara-mbrsh.

perform bdc_field using 'RMMG1-MTART'

it_mara-mtart.

perform bdc_dynpro using 'SAPLMGMM' '0070'.

perform bdc_field using 'BDC_CURSOR'

'MSICHTAUSW-DYTXT(01)'.

perform bdc_field using 'BDC_OKCODE'

'=ENTR'.

perform bdc_field using 'MSICHTAUSW-KZSEL(01)'

'X'.

perform bdc_dynpro using 'SAPLMGMM' '4004'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'MAKT-MAKTX'

it_mara-maktx.

perform bdc_field using 'BDC_CURSOR'

'MARA-MEINS'.

perform bdc_field using 'MARA-MEINS'

it_mara-meins.

perform bdc_field using 'MARA-MTPOS_MARA'

'NORM'.

perform bdc_field using 'BDC_CURSOR'

'MAKT-MAKTX'.

perform bdc_field using 'MAKT-MAKTX'

it_mara-maktx.

perform bdc_field using 'MARA-MEINS'

it_mara-meins.

perform bdc_dynpro using 'SAPLMGMM' '4004'.

perform bdc_field using 'BDC_OKCODE'

'=BU'.

perform bdc_field using 'MARA-MTPOS_MARA'

'NORM'.

perform bdc_transaction using 'MM01'.

endloop.

perform close_group.

&----


*& Form Get_Data

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM Get_Data .

CALL FUNCTION 'UPLOAD'

EXPORTING

  • CODEPAGE = ' '

FILENAME = 'C:\srikant.txt'

FILETYPE = 'DAT'

  • ITEM = ' '

  • FILEMASK_MASK = ' '

  • FILEMASK_TEXT = ' '

  • FILETYPE_NO_CHANGE = ' '

  • FILEMASK_ALL = ' '

  • FILETYPE_NO_SHOW = ' '

  • LINE_EXIT = ' '

  • USER_FORM = ' '

  • USER_PROG = ' '

  • SILENT = 'S'

  • IMPORTING

  • FILESIZE =

  • CANCEL =

  • ACT_FILENAME =

  • ACT_FILETYPE =

TABLES

DATA_TAB = it_mara

EXCEPTIONS

CONVERSION_ERROR = 1

INVALID_TABLE_WIDTH = 2

INVALID_TYPE = 3

NO_BATCH = 4

UNKNOWN_ERROR = 5

GUI_REFUSE_FILETRANSFER = 6

OTHERS = 7

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

loop at it_mara.

write : / it_mara.

endloop.

ENDFORM. " Get_Data

Thanks & regards

Sreenivasulu P