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: 

Conversion Techniques

Former Member
0 Kudos

Hi Guys,

I wanted to know the various conversion techniques for Sales BOM i.e techniques like LSMW and BAPI's. what i want to know is the various possible techniques to transfer data from non-SAP Systems to SAP-Systems.

Thanks and regards,

Frank

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

Data can be transfered from legacy system to SAP through:

1.LSMW

2.Through Program.

In program upload the excel file stored as tab delimited. then run BDC or upload through Update statement.

8 REPLIES 8

Former Member
0 Kudos

Hi,

Data can be transfered from legacy system to SAP through:

1.LSMW

2.Through Program.

In program upload the excel file stored as tab delimited. then run BDC or upload through Update statement.

Former Member
0 Kudos

Hi Sonali,

Thanks for the Answer. Bt wht i wanted to know is tht is this a general conversion technique?? if it is , i need a technique which is specific to Sales BOM.

Thanks and Regards,

Girish.

0 Kudos

hi frank,

which technique should be used purely depends upon the requirement and data and many constraints but not surely upon the type ex: sales order etc.

so, depending upon ur requirement u need to decide that

0 Kudos

Hi Hymavathi,

Thanks for your reply but could you please tell me how do i identify which of these i.e BAPI , LSMW or BDC is the best method of Conversion.

Thanks and regards,

Frank.

0 Kudos

first check whether a BAPI is available for that or not or consult ur functional consultant.

if BAPI is there then BAPI would be the best. else go for BDC.

again in BDC it would be better if u include both the types call transaction and session method.

this can be done by including a single include in ur report

include bdcrecx1.

Former Member
0 Kudos

hi,

i developed a code for cs01, check this code it might be helpful for u,

include bdcrecx1.

*parameters: filename like rlgrap-filename.

TYPES: BEGIN OF TY_FLAT, " structure for flat file

STRING(300),

END OF TY_FLAT.

TYPES: BEGIN OF TY_HEAD, " structure for header file

IND(2) TYPE N,

MATNR(18),

WERKS(4),

STLAN(1),

ZTEXT(40),

STKTX(40),

BMENG(13),

STLST(1),

STLBE(4),

EXSTL(18),

END OF TY_HEAD.

TYPES :BEGIN OF TY_ITEM, "structure for item file

IND(2) TYPE N,

POSNR(4),

IDNRK(18),

MENGE(13),

MEINS(3),

POSTP(1),

KZKUP(1),

SORTF(1),

FMENG(1),

NETAU(1),

AVOAV(5),

AUSCH(5),

POTX1(40),

POTX2(40),

SANKO(1),

SCHGT(1),

END OF TY_ITEM.

TYPES :BEGIN OF TY_FLAT1, " structure for final file

MATNR(18),

WERKS(4),

STLAN(1),

ZTEXT(40),

STKTX(40),

BMENG(13),

STLST(1),

STLBE(4),

EXSTL(18),

POSNR(4),

IDNRK(18),

MENGE(13),

MEINS(3),

POSTP(1),

KZKUP(1),

SORTF(1),

FMENG(1),

NETAU(1),

AVOAV(5),

AUSCH(5),

POTX1(40),

POTX2(40),

SANKO(1),

SCHGT(1),

END OF TY_FLAT1.

*TYPES :BEGIN OF TY_FLAT1, " structure for final file

  • MATNR(18),

  • WERKS(4),

  • STLAN(1),

  • POSTP(1),

  • IDNRK(18),

  • MENGE(13),

  • END OF TY_FLAT1.

----


  • INTERNAL TABLE DECLARATIONS *

----


DATA : T_FLAT TYPE STANDARD TABLE OF TY_FLAT,

T_FLAT1 TYPE STANDARD TABLE OF TY_FLAT1,

T_HEAD TYPE STANDARD TABLE OF TY_HEAD,

T_ITEM TYPE STANDARD TABLE OF TY_ITEM,

T_BDCDATA TYPE STANDARD TABLE OF BDCDATA,

T_BDCMSG TYPE STANDARD TABLE OF BDCMSGCOLL.

----


  • WORK AREA DECLARATIONS *

----


DATA : ST_FLAT TYPE TY_FLAT,

ST_FLAT1 TYPE TY_FLAT1,

ST_HEAD TYPE TY_HEAD,

ST_ITEM TYPE TY_ITEM,

ST_BDCDATA TYPE BDCDATA,

ST_BDCMSG TYPE BDCMSGCOLL.

----


  • VARIABLES *

----


DATA : FNAM TYPE LOCALFILE, "rlgrap-filename,

FTYP TYPE RLGRAP-FILETYPE,

LF_FNAM TYPE STRING.

----


  • VARIABLES *

----


DATA : V_IND(2) TYPE N, " value 1,

V_FLD(20),

V_NO(2) TYPE N.

----


  • SELECTION SCREEN *

----


SELECTION-SCREEN : BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001. "selection screen

PARAMETERS : P_FNAM LIKE FNAM.

SELECTION-SCREEN : END OF BLOCK B1.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FNAM.

CALL FUNCTION 'F4_FILENAME'

EXPORTING

PROGRAM_NAME = SYST-CPROG

DYNPRO_NUMBER = SYST-DYNNR

FIELD_NAME = ' '

IMPORTING

FILE_NAME = P_FNAM.

****************************************************

*START-OF-SELECTION

*****************************************************

start-of-selection.

*-- Upload flat data to ITAB.

perform upload_to_itab.

Perform process_data.

perform open_group.

perform upload_programs.

perform close_group.

form upload_to_itab.

CALL FUNCTION 'WS_UPLOAD' " uploading flat file

EXPORTING

FILENAME = P_FNAM

FILETYPE = 'ASC'

TABLES

DATA_TAB = T_FLAT.

IF SY-SUBRC NE 0.

WRITE : /1 'no flat file to upload into internal table t_flat'.

LEAVE TO LIST-PROCESSING.

ENDIF.

endform.

----


  • FORM QUERY_FILENAME *

----


  • ........ *

----


  • --> P_FILENAME *

----


form process_data.

  • splitting the flat file data into header table and item table

LOOP AT T_FLAT INTO ST_FLAT.

SPLIT ST_FLAT AT CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB

INTO ST_FLAT1-MATNR ST_FLAT1-WERKS

ST_FLAT1-STLAN

ST_FLAT1-ZTEXT

ST_FLAT1-STKTX

ST_FLAT1-BMENG

ST_FLAT1-STLST

ST_FLAT1-STLBE

ST_FLAT1-EXSTL

ST_FLAT1-POSNR

ST_FLAT1-IDNRK

ST_FLAT1-MENGE

ST_FLAT1-MEINS

ST_FLAT1-POSTP

ST_FLAT1-KZKUP

ST_FLAT1-SORTF

ST_FLAT1-FMENG

ST_FLAT1-NETAU

ST_FLAT1-AVOAV

ST_FLAT1-AUSCH

ST_FLAT1-POTX1

ST_FLAT1-POTX2

ST_FLAT1-SANKO

ST_FLAT1-SCHGT.

APPEND ST_FLAT1 TO T_FLAT1.

CLEAR ST_FLAT1.

ENDLOOP.

SORT T_FLAT1 BY MATNR WERKS STLAN POSNR.

LOOP AT T_FLAT1 INTO ST_FLAT1.

MOVE :

ST_FLAT1-MATNR TO ST_HEAD-MATNR,

ST_FLAT1-WERKS TO ST_HEAD-WERKS,

ST_FLAT1-STLaN TO ST_HEAD-STLAN,

ST_FLAT1-ZTEXT TO ST_HEAD-ZTEXT,

ST_FLAT1-STKTX TO ST_HEAD-STKTX,

ST_FLAT1-BMENG TO ST_HEAD-BMENG,

ST_FLAT1-STLST TO ST_HEAD-STLST,

ST_FLAT1-STLBE TO ST_HEAD-STLBE,

ST_FLAT1-EXSTL TO ST_HEAD-EXSTL,

ST_FLAT1-POSNR TO ST_ITEM-POSNR,

ST_FLAT1-IDNRK TO ST_ITEM-IDNRK,

ST_FLAT1-MENGE TO ST_ITEM-MENGE,

ST_FLAT1-MEINS TO ST_ITEM-MEINS,

ST_FLAT1-POSTP TO ST_ITEM-POSTP,

ST_FLAT1-KZKUP TO ST_ITEM-KZKUP,

ST_FLAT1-SORTF TO ST_ITEM-SORTF,

ST_FLAT1-FMENG TO ST_ITEM-FMENG,

ST_FLAT1-NETAU TO ST_ITEM-NETAU,

ST_FLAT1-AVOAV TO ST_ITEM-AVOAV,

ST_FLAT1-AUSCH TO ST_ITEM-AUSCH,

ST_FLAT1-POTX1 TO ST_ITEM-POTX1,

ST_FLAT1-POTX2 TO ST_ITEM-POTX2,

ST_FLAT1-SANKO TO ST_ITEM-SANKO,

ST_FLAT1-SCHGT TO ST_ITEM-SCHGT.

AT new stlan.

ADD 1 TO V_IND.

ENDAT.

MOVE V_IND TO ST_HEAD-IND.

MOVE V_IND TO ST_ITEM-IND.

APPEND ST_HEAD TO T_HEAD.

APPEND ST_ITEM TO T_ITEM.

CLEAR ST_HEAD.

CLEAR ST_ITEM.

*CLEAR v_ind.

ENDLOOP.

CLEAR V_IND.

*perform open_group.

SORT T_ITEM BY IND.

SORT T_HEAD BY IND.

DELETE ADJACENT DUPLICATES FROM T_HEAD.

endform.

form upload_programs.

LOOP AT T_HEAD INTO ST_HEAD.

PERFORM BDC_DYNPRO USING 'SAPLCSDI' '0100'.

PERFORM BDC_FIELD USING 'BDC_CURSOR'

'RC29N-STLAN'.

PERFORM BDC_FIELD USING 'BDC_OKCODE'

'/00'.

PERFORM BDC_FIELD USING 'RC29N-MATNR'

ST_HEAD-MATNR.

PERFORM BDC_FIELD USING 'RC29N-WERKS'

ST_HEAD-WERKS.

PERFORM BDC_FIELD USING 'RC29N-STLAN'

ST_HEAD-STLAN.

PERFORM BDC_DYNPRO USING 'SAPLCSDI' '0110'.

PERFORM BDC_FIELD USING 'BDC_CURSOR'

'RC29K-STLBE'.

PERFORM BDC_FIELD USING 'BDC_OKCODE'

'/00'.

PERFORM BDC_FIELD USING 'RC29k-ZTEXT'

ST_HEAD-ZTEXT.

PERFORM BDC_FIELD USING 'RC29k-STKTX'

ST_HEAD-STKTX.

PERFORM BDC_FIELD USING 'RC29k-BMENG'

ST_HEAD-BMENG.

PERFORM BDC_FIELD USING 'RC29k-STLST'

ST_HEAD-STLST.

PERFORM BDC_FIELD USING 'RC29k-STLST'

ST_HEAD-STLST.

PERFORM BDC_FIELD USING 'BDC_SUBSCR'

'SAPLCSDI'.

PERFORM BDC_FIELD USING 'RC29k-EXSTL'

ST_HEAD-EXSTL.

LOOP AT T_ITEM INTO ST_ITEM WHERE IND = ST_HEAD-IND.

ADD 1 TO V_NO.

PERFORM BDC_DYNPRO USING 'SAPLCSDI' '0140'.

PERFORM BDC_FIELD USING 'BDC_CURSOR'

'RC29P-POSNR(01)'.

PERFORM BDC_FIELD USING 'BDC_OKCODE'

'=FCNP'.

PERFORM BDC_FIELD USING 'BDC_SUBSCR'

'SAPLCSDI'.

PERFORM BDC_DYNPRO USING 'SAPLCSDI' '0140'.

PERFORM BDC_FIELD USING 'BDC_CURSOR'

'RC29P-SORTF(01)'.

PERFORM BDC_FIELD USING 'BDC_OKCODE'

'/00'.

CONCATENATE 'RC29P-POSNR(' V_NO ')' INTO V_FLD.

CONDENSE V_FLD.

PERFORM BDC_FIELD USING V_FLD

ST_ITEM-POSNR.

*PERFORM BDC_FIELD USING 'RC29P-POSNR(01)'

  • ST_ITEM-POSNR.

CONCATENATE 'RC29P-IDNRK(' V_NO ')' INTO V_FLD.

CONDENSE V_FLD.

PERFORM BDC_FIELD USING V_FLD

ST_ITEM-IDNRK.

  • PERFORM BDC_FIELD USING 'RC29P-IDNRK(01)'

  • ST_ITEM-IDNRK.

CONCATENATE 'RC29P-MENGE(' V_NO ')' INTO V_FLD.

CONDENSE V_FLD.

PERFORM BDC_FIELD USING V_FLD

ST_ITEM-MENGE.

*PERFORM BDC_FIELD USING 'RC29P-MENGE(01)'

  • ST_ITEM-MENGE.

CONCATENATE 'RC29P-MEINS(' V_NO ')' INTO V_FLD.

CONDENSE V_FLD.

PERFORM BDC_FIELD USING V_FLD

ST_ITEM-MEINS.

*PERFORM BDC_FIELD USING 'RC29P-MEINS(01)'

  • ST_ITEM-MEINS.

CONCATENATE 'RC29P-POSTP(' V_NO ')' INTO V_FLD.

CONDENSE V_FLD.

PERFORM BDC_FIELD USING V_FLD

ST_ITEM-POSTP.

*PERFORM BDC_FIELD USING 'RC29P-POSTP(01)'

  • ST_ITEM-POSTP.

PERFORM BDC_FIELD USING 'BDC_SUBSCR'

'SAPLCSDI'.

PERFORM BDC_DYNPRO USING 'SAPLCSDI' '0130'.

PERFORM BDC_FIELD USING 'BDC_OKCODE'

'/00'.

PERFORM BDC_FIELD USING 'BDC_SUBSCR'

'SAPLCSDI'.

PERFORM BDC_FIELD USING 'BDC_CURSOR'

'RC29P-KZKUP'.

PERFORM BDC_FIELD USING 'RC29P-FMENG'

ST_ITEM-FMENG.

PERFORM BDC_FIELD USING 'RC29P-AVOAU'

ST_ITEM-AVOAV.

PERFORM BDC_FIELD USING 'RC29P-NETAU'

ST_ITEM-NETAU.

PERFORM BDC_FIELD USING 'RC29P-AUSCH'

ST_ITEM-AUSCH.

PERFORM BDC_FIELD USING 'RC29P-KZKUP'

ST_ITEM-KZKUP.

PERFORM BDC_DYNPRO USING 'SAPLCSDI' '0131'.

PERFORM BDC_FIELD USING 'BDC_OKCODE'

'/00'.

PERFORM BDC_FIELD USING 'BDC_SUBSCR'

'SAPLCSDI'.

PERFORM BDC_FIELD USING 'BDC_CURSOR'

'RC29P-BEIKZ'.

PERFORM BDC_FIELD USING 'RC29P-POTX1'

ST_ITEM-POTX1.

PERFORM BDC_FIELD USING 'RC29P-POTX2'

ST_ITEM-POTX2.

PERFORM BDC_FIELD USING 'RC29P-SANKA'

'X'.

PERFORM BDC_FIELD USING 'BDC_SUBSCR'

'SAPLCSDI'.

  • PERFORM BDC_FIELD USING 'BDC_SUBSCR'

  • 'SAPLCSDI'.

PERFORM BDC_FIELD USING 'BDC_OKCODE'

'/00'.

V_NO = 1.

ENDLOOP.

CLEAR V_NO.

*PERFORM BDC_FIELD USING 'BDC_OKCODE'

  • '/SAV'.

PERFORM BDC_DYNPRO USING 'SAPLCSDI' '0140'.

PERFORM BDC_FIELD USING 'BDC_OKCODE'

'=FCBU'.

*PERFORM BDC_FIELD USING 'BDC_OKCODE'

  • '=SAV'.

*PERFORM BDC_FIELD USING 'BDC_SUBSCR'

  • 'SAPLCSDI'.

perform bdc_transaction using 'CS01'.

*CALL TRANSACTION 'CS01' USING T_BDCDATA MODE 'A'

*UPDATE 'A' MESSAGES INTO T_BDCMSG.

*refresh t_bdcdata.

*clear t_bdcdata.

*

ENDLOOP.

endform.

regards

siva

Former Member
0 Kudos

Hi,

For migrating data from non-sap to sap there are many methods.

Actually atpresent we are in conversion project.If the data is in large numbers(lakhs of records) , then to upload easily u can follow LSMW with Batch Input / Direct Input Method. If standards are not available, then go for BAPI's. If BAPI's are not available, then BDC.

But when u use BAPI, data is accurate.

Finally u keep BDC.