Skip to Content
0
Jan 05, 2021 at 05:55 AM

Based on account type and fisical year i need upload data from excel to sap using bdc.

83 Views Last edit Jan 11, 2021 at 09:37 AM 2 rev

Hi,

I am tried to upload excel sheet to sap using bdc call transaction method based on the condition of acctype and fisical year for that i write code like as shown in below
if it_datatab is not INITIAL.
    select belnr
           bukrs
           gjahr
           buzei
           koart
           from
           bseg into table it_bseg FOR ALL ENTRIES IN it_datatab
           where belnr = it_datatab-belnr and bukrs = it_datatab-bukrs and gjahr = it_datatab-gjahr
 and koart = 'K'.
      endif.
loop at it_datatab into wa_datatab .
READ TABLE it_bseg into wa_bseg with key belnr = wa_datatab-belnr.
if sy-subrc eq 0.
perform bdc_dynpro      using 'SAPMF05L' '0102'.
perform bdc_field       using 'BDC_CURSOR'
                              'RF05L-BELNR'.
perform bdc_field       using 'BDC_OKCODE'
                              '/00'.
perform bdc_field       using 'RF05L-BELNR'
                              wa_datatab-belnr.
perform bdc_field       using 'RF05L-BUKRS'
                              wa_datatab-bukrs.
perform bdc_field       using 'RF05L-GJAHR'
                              wa_datatab-gjahr.
perform bdc_field       using 'RF05L-BUZEI'
                              it_bseg-buzei.
perform bdc_field       using 'RF05L-XKKRE'
                              'X'.
perform bdc_dynpro      using 'SAPMF05L' '0300'.
perform bdc_field       using 'BDC_CURSOR'
                              'BSEG-SGTXT'.
perform bdc_field       using 'BDC_OKCODE'
                              '=AE'.
perform bdc_field       using 'BSEG-ZUONR'
                              wa_datatab-zuonr.
perform bdc_field       using 'BSEG-SGTXT'
                              wa_datatab-sgtxt.
endif.

CALL TRANSACTION 'FB09' USING bdcdata MODE 'A' UPDATE 'S'
MESSAGES INTO messtab.

but my excel sheet data was not uploading on this condition
my excel sheet contain document num,company code, fisical year ,assignment,text fields
please tell me what wrong i did in the code.

Regards,