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 PROGRAM

vallamuthu_madheswaran2
Active Contributor
0 Likes
736

Hai friends,

The following program is, to create a Stock transfer Order using TC me21. here i want to post multiple line item. i think looping is the problem help me

thanks & regards

vallamuthu

PERFORM OPEN_GROUP USING GROUP USER KEEP HOLDDATE CTU.

LOOP AT RO_HEADER.

perform bdc_dynpro using 'SAPMM06E' '0100'.

perform bdc_field using 'BDC_CURSOR' 'RM06E-EPSTP'.

perform bdc_field using 'BDC_OKCODE' '/00'.

perform bdc_field using 'EKKO-LIFNR' RO_HEADER-SUP_PLANT."'1060'."SUPPLING PLANT

perform bdc_field using 'RM06E-BSART' 'KRUB'.

IF N EQ '01'.

WRITE: RO_HEADER-DELI_DATE TO RO_HEADER-DELI_DATE.

DAT = RO_HEADER-DELI_DATE.

ENDIF.

perform bdc_field using 'RM06E-BEDAT' DAT."RO_HEADER-DELI_DATE."'11.09.2006'.

perform bdc_field using 'EKKO-EKORG' '1000'.

perform bdc_field using 'EKKO-EKGRP' RO_HEADER-PUR_GRP."'300'.

perform bdc_field using 'RM06E-EPSTP' 'U'.

perform bdc_field using 'RM06E-LPEIN' 'T'.

perform bdc_field using 'RM06E-WERKS' RO_HEADER-REC_PLANT."'1010'."RECEIVING PLANT

LOOP AT RO_ITEM.

N = N + 1.

perform bdc_dynpro using 'SAPMM06E' '0120'.

perform bdc_field using 'BDC_CURSOR' 'RM06E-EEIND(02)'.

perform bdc_field using 'BDC_OKCODE' '/00'.

perform bdc_field using 'EKPO-EMATN(N)' RO_ITEM-MATERIAL."'7'."MATERIAL

  • perform bdc_field using 'EKPO-EMATN(02)' RO_ITEM-MATERIAL."'7'."MATERIAL

WRITE: RO_ITEM-QTY to qnty.

perform bdc_field using 'EKPO-MENGE(N)' qnty."QTY

  • perform bdc_field using 'EKPO-MENGE(02)' qnty."QTY

perform bdc_field using 'RM06E-EEIND(01)' RO_HEADER-DELI_DATE."'11.09.2006'."DELIVERY DATE

perform bdc_dynpro using 'SAPMM06E' '0120'.

perform bdc_field using 'BDC_CURSOR' 'RM06E-BSTPO(01)'.

perform bdc_field using 'BDC_OKCODE' '=KOPF'.

perform bdc_field using 'RM06E-EBELP' '1'.

perform bdc_field using 'RM06E-TCSELFLAG(01)' 'X'."

perform bdc_dynpro using 'SAPMM06E' '0101'.

perform bdc_field using 'BDC_CURSOR' 'EKKO-EKGRP'.

perform bdc_field using 'BDC_OKCODE' '=TXK'.

perform bdc_field using 'EKKO-EKGRP' RO_HEADER-PUR_GRP."'300'.

  • perform bdc_field using 'EKKO-PINCR' '1'.

  • perform bdc_field using 'EKKO-UPINC' '1'.

perform bdc_dynpro using 'SAPMM06E' '0103'.

perform bdc_field using 'BDC_CURSOR' 'RM06E-LTEX1(01)'.

perform bdc_field using 'BDC_OKCODE' '=BACK'.

perform bdc_field using 'RM06E-LTEX1(01)' RO_HEADER-HDR_TEXT."'HEADER TEXT'.

perform bdc_dynpro using 'SAPMM06E' '0120'.

perform bdc_field using 'BDC_CURSOR' 'RM06E-EBELP'.

perform bdc_field using 'BDC_OKCODE' '=DETA'.

  • perform bdc_field using 'RM06E-EBELP' '1'.

perform bdc_dynpro using 'SAPMM06E' '0111'.

perform bdc_field using 'BDC_CURSOR' 'EKPO-MENGE'.

perform bdc_field using 'BDC_OKCODE' '=TXP'.

perform bdc_field using 'EKPO-MENGE' qnty."'10'.

perform bdc_field using 'RM06E-EEIND' RO_HEADER-DELI_DATE.".

  • perform bdc_field using 'RM06E-LPEIN' 'D'.

  • perform bdc_field using 'EKPO-MAHN1' '10'.

perform bdc_field using 'EKET-SLFDT' RO_HEADER-DELI_DATE."'11.09.2006'.

  • perform bdc_field using 'EKPO-MAHN2' '30'.

  • perform bdc_field using 'EKPO-MAHN3' '60'.

perform bdc_dynpro using 'SAPMM06E' '0106'.

perform bdc_field using 'BDC_CURSOR' 'RM06E-LTEX1(01)'.

perform bdc_field using 'BDC_OKCODE' '=VW'.

perform bdc_dynpro using 'SAPMM06E' '0106'.

perform bdc_field using 'BDC_CURSOR' 'RM06E-LTEX1(03)'.

perform bdc_field using 'BDC_OKCODE' '=BU'.

perform bdc_field using 'RM06E-LTEX1(03)' ro_item-it_text." 'REMARKS TEXT FOR LINE ITEM'.

ENDLOOP."END OF ITEM

perform bdc_dynpro using 'SAPLSPO1' '0300'.

perform bdc_field using 'BDC_OKCODE' '=YES'.

PERFORM BDC_TRANSACTION TABLES MESSTAB

USING 'ME21'

CTU

MODE

UPDATE.

ENDLOOP."END OF HEADER

*perform bdc_transaction using 'ME21'.

PERFORM CLOSE_GROUP USING CTU.

ENDFUNCTION.

1 ACCEPTED SOLUTION
Read only

0 Likes
674

It's not a good choice to do the goods movement via BDC. Because the max lines in the table control depends on the GUI settings. I suggest you try the function

BAPI_GOODSMVT_CREATE and BAPI_TRANSACTION_COMMIT to do this.

3 REPLIES 3
Read only

0 Likes
675

It's not a good choice to do the goods movement via BDC. Because the max lines in the table control depends on the GUI settings. I suggest you try the function

BAPI_GOODSMVT_CREATE and BAPI_TRANSACTION_COMMIT to do this.

Read only

former_member404244
Active Contributor
0 Likes
674

Hi,

check the below link,u can have some idea regarding handling of multiple items in BDC.

http://www.sap-basis-abap.com/abap/handling-table-control-in-bdc.htm

Regards,

Nagaraj

Read only

Former Member
0 Likes
674

How can I fill the field EMATN using the bapi BAPI_GOODSMVT_CREATE ?

Because this bapi don't have this field.

Alexandre nogueira.