Application Development and Automation 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: 
Read only

BDC

Former Member
0 Likes
371

How to read files nad process BDCs automatically

3 REPLIES 3
Read only

Former Member
0 Likes
340

Hi,

You can use OPEN DATASET statement to read the file from application server or using FM GUI_UPLOAD to read file from presentation server.

Use the program RSBDCSUB to process the BDC session automatically.

Regards,

Ferry Lianto

Read only

Former Member
0 Likes
340

hi,

You can use the function module gui_upload to upload your existing flat fies.

you can also use the program RSBDCSUB to process your sessions automatically.

hope this helps.

Read only

Former Member
0 Likes
340

create a file say in excel sheet which consists ur data which has to be transferred to the sap system...

as u know BDC is used to transfer data from non-sap ( legacy) system to sap system...

save the excell sheet of type tab( delemited) ....

and write the program below as followed.........

by using <u><i><b>bdc_open_group and bdc_close_group</b></i></u> ...

u can do the data migration and hence read the file also...

REPORT zginni_data_migration

TYPES : BEGIN OF STRUCT ,

MATNR TYPE RMMG1-MATNR ,

END OF STRUCT.

DATA :W_GRPID TYPE APQI-GROUPID .

DATA :IT_MARA TYPE TABLE OF STRUCT WITH HEADER LINE,

IT_BDC TYPE TABLE OF BDCDATA WITH HEADER LINE,

CNT TYPE MARA-BISMT .

initialization.

SELECT MATNR

FROM MARA

INTO CORRESPONDING FIELDS OF TABLE IT_MARA

up to 10 rows

WHERE MTART = 'HAWA'.

W_GRPID = 'SESSION-ID'.

START-OF-SELECTION.

CALL FUNCTION 'BDC_OPEN_GROUP'

EXPORTING

CLIENT = SY-MANDT

GROUP = W_GRPID

KEEP = 'X'

USER = SY-UNAME.

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.

CNT = CNT + 1.

PERFORM : F001-BDC_A USING 'SAPLMGMM' '0060' 'X',

F002-BDC_B USING 'RMMG1-MATNR' IT_MARA-MATNR ,

F002-BDC_B USING 'BDC_OKCODE' '/00',

F001-BDC_A USING 'SAPLMGMM' '0070' 'X',

F002-BDC_B USING 'MSICHTAUSW-KZSEL(01)' 'X' ,

F002-BDC_B USING 'MSICHTAUSW-KZSEL(02)' 'X' ,

F002-BDC_B USING 'BDC_OKCODE' '=ENTR',

F001-BDC_A USING 'SAPLMGMM' '4004' 'X',

F002-BDC_B USING 'MARA-BISMT' GT_CNT ,

F002-BDC_B USING 'BDC_OKCODE' '=BU',

F003-BDC_C USING 'MM02'.

ENDLOOP.

CALL FUNCTION 'BDC_CLOSE_GROUP' .

IF SY-SUBRC <> 0.

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

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

ENDIF..

&----


*& Form F001-BDC_A

&----


  • text

----


  • -->PROGRAM text

  • -->DYNPRO text

  • -->DYNBEG text

----


FORM F001-BDC_A USING program dynpro dynbeg.

IT_BDC-PROGRAM = PROGRAM.

IT_BDC-dynpro = DYNPRO.

IT_BDC-dynbegin = DYNBEG.

APPEND IT_BDC .

CLEAR IT_BDC.

ENDFORM. "F001-BDC_A

&----


*& Form F002-BDC_B

&----


  • text

----


  • -->FNAM text

  • -->FVAL text

----


FORM F002-BDC_B USING FNAM FVAL .

IT_BDC-FNAM = FNAM .

IT_BDC-FVAL = FVAL.

APPEND IT_BDC .

CLEAR IT_BDC.

ENDFORM. "F002-BDC_B

&----


*& Form F003-BDC_C

&----


  • text

----


  • -->P_0124 text

----


FORM F003-BDC_C USING TRCODE.

CALL FUNCTION 'BDC_INSERT'

EXPORTING

TCODE = TRCODE

TABLES

DYNPROTAB = IT_BDC.

REFRESH IT_BDC.

ENDFORM. " F003-BDC_C