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: 

Clearing field values in GB01 using BDC.

former_member217316
Contributor
0 Kudos
193


Hi All

I am trying to create special ledger documents using BDC in t code GB01. The same is done by creating a SM35 session. In the program, through GUI_UPLOAD, I am uploading the records. In internal table, each of the records have their own values as desired.

The problem I am facing is that in case there are 3 records in the file, 3 different documents are created which is fine but with all info of the 1st record.

For eg:

SNO AMT TEXT

1 100 Test1

2 200 Test2

3 300 Test3

Three document 10000, 20000, 30000 are created all having amount as 100 and text as Test1.

The program only creates the session. The upload is done when this session is processed in SM35.

Thanks in advance.

Harsh

1 ACCEPTED SOLUTION

former_member217316
Contributor
0 Kudos
109

Thanks for your reply Sandro & Vishal.

I tried debugging the code earlier only and had found that the BDCDATA internal table is populated with the correct values for each set of records. When i run the BDC in the foreground mode, I can see that for each record it takes values of the first record only.

7 REPLIES 7

sandroramos
Active Participant
0 Kudos
109

Hi,

Check in debug mode the values in Internal Table after GUI_UPLOAD whether values are ok.

After that check the loop in this internal table, i supose you are doing that, where you fill the BDC Table.

Regards,

Sandro Ramos

vishal_sharda2
Participant
0 Kudos
109

Hi,

could be work area/internal table mix up. Debug the code and you will be able to identify the issue yourself

former_member217316
Contributor
0 Kudos
110

Thanks for your reply Sandro & Vishal.

I tried debugging the code earlier only and had found that the BDCDATA internal table is populated with the correct values for each set of records. When i run the BDC in the foreground mode, I can see that for each record it takes values of the first record only.

0 Kudos
109

Hi Harsh

Can you please share your sample code...Are you clearing your BDCDATA for every iteration?

Nabheet

0 Kudos
109

BDCDATA Sample Code.

0 Kudos
109

hi,

   u want refresh wa_bdcdata. After looping u just specify refresh wa_bdcdata. may be it solve your problem.try like this

LOOP AT IT INTO WA.
refresh it_bdcdata.

perform bdc_dynpro      using 'SAPMF02B' '0100'.
perform bdc_field       using 'BDC_CURSOR'

.

.

.

.


CLEAR WA.
ENDLOOP.

Regards,

gopi

0 Kudos
109

Just saw your response. Had done the same. REFRESH ta_bdcdata[] after calling the FM: BDC_INSERT.

Problem solved.

Thanks all.