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

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

former_member612655
Participant
0 Likes
1,000
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,
1 ACCEPTED SOLUTION
Read only

RaymondGiuseppi
Active Contributor
0 Likes
899
Okay, now we have your code, so
  • In your 'READ TABLE it_bseg' add also keys for bukrs and gjahr (if not single values)
  • In your 'perform bdc_field using'RF05L-BUZEI' it_bseg-buzei.' replace it_bseg-buzei with wa_bseg-buzei
9 REPLIES 9
Read only

abo
Active Contributor
0 Likes
899

No idea, too little information: what kind of error did you get? You're running in mode A, you should definitely see something happening, otherwise the error is happening during the creation phase.

Read only

0 Likes
899

I wrote my select stmt as shown in above

when i am checking in mode 'N' prog goes to dump and saying field symbol is not yet assigned and showing error in "macro_cell_data_get" this part

But when i processing in mode 'A' for first screen the data was taken from excel and then pressing enter it directed to second screen here also taking data from excel but after taking data from excel sheet to the second screen and then pressing it is not directed to next document number where i need to save it and go back for processing the 2nd record.The updation were not repeated continously

Read only

former_member612655
Participant
0 Likes
899

I am running in mode A but my data in excel sheet was not uploading into sap if I removing if condition then its is working fine .But my problem is if the account type is "k" then only the data wanted to entered into sap for that particular document number can you please help me to solve this problem

Read only

RaymondGiuseppi
Active Contributor
0 Likes
899

Where did you actally read BSEG table before the IF statement ?

Read only

RaymondGiuseppi
Active Contributor
0 Likes
899

Where is your SELECT FROM BSEG statement?

Read only

former_member612655
Participant
0 Likes
899

I wrote my select stmt as shown in above

when i am checking in mode 'N' prog goes to dump and saying field symbol is not yet assigned and showing error in "macro_cell_data_get" this part

But when i processing in mode 'A' for first screen the data was taken from excel and then pressing enter it directed to second screen here also taking data from excel but after taking data from excel sheet to the second screen and then pressing it is not directed to next document number where i need to save it and go back for processing the 2nd record.The updation were not repeated continously

Read only

RaymondGiuseppi
Active Contributor
0 Likes
900
Okay, now we have your code, so
  • In your 'READ TABLE it_bseg' add also keys for bukrs and gjahr (if not single values)
  • In your 'perform bdc_field using'RF05L-BUZEI' it_bseg-buzei.' replace it_bseg-buzei with wa_bseg-buzei
Read only

0 Likes
899

Thanks for your response

for mode 'A' screens processing correctly

But for mode 'N' it goes to short dump says "field symbol is not yet assigned" .I checked in st22 there it showing error in below part

macro_cell_data_get
<ls_fcat>
<ls_data>
<l_field_value>
ls_lvc_data-value.

please help me to find out this

Read only

0 Likes
899

In the FB09 options did you activate ALV Grid display, not a good idea for BDC...