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: 

bdc upload master detail problem.

Former Member
0 Kudos

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

12 REPLIES 12

former_member188827
Active Contributor
0 Kudos

paste your code here.Also why dont you try BAPI?

Former Member
0 Kudos

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.

0 Kudos

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

0 Kudos

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.

rvinod1982
Contributor
0 Kudos

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

0 Kudos

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??

0 Kudos

ok i m trying my self.with above suggesions.

0 Kudos

you can use statement:

at new divison...endat

inside loop.endloop and call your bai at that event.

kesavadas_thekkillath
Active Contributor
0 Kudos

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]

0 Kudos

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.

0 Kudos

Please Mark your thread as answered of the issue is resolved

Former Member
0 Kudos

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.