10-15-2009 5:15 AM
i create a BDC recording for transaction VA01 in which i m trying to insert multiple line items.. but when i run my upload program and use my bdc recording and then call transaction..then only one line item insert into it..how can i insert multiple line items with in single document...kindly help me out plzz
10-15-2009 5:19 AM
10-15-2009 5:19 AM
Hi,
Did you loop at your internal table and then performed the BDC?
Also, check if you have cleared and refreshed the internal table that you use for populating the BDC structure everytime it loops.
10-15-2009 5:28 AM
yes i m using loop.i m just confuse which bdc element perform header and which contain detail info.but still i m trying all your suggesions
10-15-2009 5:33 AM
Hi,
Paste your code here so that we can check.
Here's a sample
LOOP AT T_SALESORDER INTO WA_SALESORDER.
perform bdc_dynpro using 'SAPMV45A' '0101'.
perform bdc_field using 'BDC_CURSOR'
'VBAK-SPART'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'VBAK-AUART'
WA_SALESORDER-AUART.
perform bdc_field using 'VBAK-VKORG'
WA_SALESORDER-VKORG.
perform bdc_field using 'VBAK-VTWEG'
WA_SALESORDER-VTWEG.
perform bdc_field using 'VBAK-SPART'
WA_SALESORDER-SPART.
perform bdc_dynpro using 'SAPMV45A' '4001'.
perform bdc_field using 'BDC_OKCODE'
'=SICH'.
perform bdc_field using 'VBKD-BSTKD'
WA_SALESORDER-BSTNK.
perform bdc_field using 'KUAGV-KUNNR'
WA_SALESORDER-KUNNR.
perform bdc_field using 'KUWEV-KUNNR'
WA_SALESORDER-KUNNR1.
perform bdc_field using 'RV45A-MABNR(01)'
WA_SALESORDER-MATNR.
perform bdc_field using 'RV45A-KWMENG(01)'
WA_SALESORDER-KWMENG.
CALL TRANSACTION 'VA01' USING T_BDCDATA[]
MODE 'A'
UPDATE 'S'
MESSAGES INTO GV_MESSAGE.
ENDLOOP.
form bdc_dynpro using program
dynpro.
t_bdcdata-program = program.
t_bdcdata-dynpro = dynpro.
t_bdcdata-dynbegin = 'X'.
append t_bdcdata.
clear t_bdcdata.
endform. " bdc_dynpro
form bdc_field using fnam
fval.
t_bdcdata-fnam = fnam.
t_bdcdata-fval = fval.
append t_bdcdata.
clear t_bdcdata.
endform. " bdc_field
You could probably use BAPIs as others have suggested. That should make it easy.
10-15-2009 5:25 AM
Hi Haris,
Use function moulde BAPI_SALESORDER_CREATEFROMDAT1 to create sales order.
You need to call this FM followed by FM BAPI_TRANSACTION_COMMIT.
No need to worry about BDC to handle multiple line items.
Regards,
Vinod
10-15-2009 5:34 AM
hi vinod.your idea seems good.ok i m trying to use bapi.but will bapi handle multi ple line itemss..bcz my internal table contain for example 6 lines ,in which 4 line belong to same division and 2 belongs to other division. and this senario should create two documents. in which one contain 4 liine item and other contain 2 line items.means if same division then internal table line goes into single document.can i handle it with bapi??
10-15-2009 6:00 AM
10-15-2009 6:05 AM
you can use statement:
at new divison...endat
inside loop.endloop and call your bai at that event.
10-15-2009 6:09 AM
For you reference
link:[VA01 BAPI|http://www.erpgenie.com/sap-technical/abap/bapi-sample-to-upload-data-from-flat-file-to-va01]
link:[VA01 BDC|http://www.erpgenie.com/sap-technical/abap/batch-input-program-for-transaction-va01]
10-15-2009 10:23 AM
thanks all of you for helping me . with the help of above suggesions i have complete my task with help of correction in bdc looping.
10-15-2009 10:28 AM
10-15-2009 10:28 AM
thanks all of you for helping me . with the help of above suggesions i have complete my task with help of correction in bdc looping.