We have added search box. Key in SAP issue keyword to search
TopBottom

Announcement: wanna exchange links? contact me at sapchatroom@gmail.com.

RE: [sap-abap] BDC Program for Populating a ZTable Through SE11

Posted by Admin at
Share this post:
Ma.gnolia DiggIt! Del.icio.us Yahoo Furl Technorati Reddit

Posted by Dave Thornburgh (SAP JOAT)
on Oct 19 at 1:38 AM
Angshuman -

In my opinion, you went wrong at the "I made a BDC program" step.

The table is a Z table, and you're simply creating records from a spreadsheet. You're not trying to enforce any relational integrity with other tables, as far as I can tell (if you are, it has nothing to do with creating these records, it seems). In that case, your program should just update the table - not call another program to do the updating for you.

And, the reason your code sometimes fails is that the program you're ultimately calling - /1BCDWB/DBZSEC_STOCK - is a dynamically generated program. Any time anyone changes the selection fields in SE16 for that table (or hits <f8> instead of <enter> on the table name in SE16), the program gets generated again. If the screen numbers change when that happens, then your BDC breaks.

Dave

---------------Original Message---------------
From: angshuman baruah
Sent: Wednesday, October 19, 2011 1:16 AM
Subject: BDC Program for Populating a ZTable Through SE11

Hi Guys,

I made a BDC program for populating a ZTable through SE11.

The Problems which I am facing are :-

1. The moment I make the recording and transfer to the program, it starts
working properly without any hassles.

2. It will work fine for the next couple of days.

3. But after some days (probably after 7 or 10 days), whenever I will run
the program then the excel will not get uploaded properly and will stop in
the screen where it will ask for the the table entries again (i.e. SE11 when you press the create entries
button).

4. But when I do the recording again than again it starts working properly.

5. For example :- (Part of the program in Bold letters - The code is in the
attachment) :-

perform bdc_dynpro using 'SAPMSRD0' '0102'.
perform bdc_field using 'BDC_CURSOR'
'RSRD1-TBMA_VAL'.
perform bdc_field using 'BDC_OKCODE'
'=EDIT'.
perform bdc_field using 'RSRD1-TBMA'
'X'.
perform bdc_field using 'RSRD1-TBMA_VAL'
'ZSEC_STOCK'.
perform bdc_dynpro using 'SAPLSD41' '2200'.
*perform bdc_field using 'BDC_CURSOR'
* 'DD02D-DDTEXT'.
perform bdc_field using 'BDC_OKCODE'
'=TDED'.
*perform bdc_field using 'DD02D-DDTEXT'
* 'GN : Table for material stock details'.
perform bdc_dynpro using '/1BCDWB/DBZSEC_STOCK' '*0111*'.
perform bdc_field using 'BDC_CURSOR'
'ZSEC_STOCK-VRKME'.
perform bdc_field using 'BDC_OKCODE'
'=SAVE'.
perform bdc_field using 'ZSEC_STOCK-MATNR'
wa_ko01-matnr.
perform bdc_field using 'ZSEC_STOCK-FKDAT'
wa_ko01-fkdat.
perform bdc_field using 'ZSEC_STOCK-KUNNR'
wa_ko01-kunnr.
perform bdc_field using 'ZSEC_STOCK-WERKS'
wa_ko01-werks.
perform bdc_field using 'ZSEC_STOCK-FKIMG'
wa_ko01-fkimg.
perform bdc_field using 'ZSEC_STOCK-VRKME'
wa_ko01-vrkme.
perform bdc_dynpro using '/1BCDWB/DBZSEC_STOCK' '*0111*'.
perform bdc_field using 'BDC_OKCODE'
'/EEND'.
perform bdc_field using 'BDC_CURSOR'
'ZSEC_STOCK-MATNR'.
perform bdc_dynpro using 'SAPLSD41' '2200'.
*perform bdc_field using 'BDC_CURSOR'
* 'DD02D-DDTEXT'.
perform bdc_field using 'BDC_OKCODE'
'=WB_END'.
*perform bdc_field using 'DD02D-DDTEXT'
* 'GN : Table for material stock details'.
perform bdc_dynpro using 'SAPMSRD0' '0102'.
perform bdc_field using 'BDC_OKCODE'
'/ENDE'.
perform bdc_field using 'BDC_CURSOR'
'RSRD1-TBMA_VAL'.
*perform bdc_transaction using 'SE11'.

*perform close_group.

call transaction 'SE11' using it_bdcdata mode 'E' update 'A' messages into
messtab.
refresh it_bdcdata.

6. In the above code the bold letters dynpro no. '0111' - will stop working
after sometime but when I make the new recording, I will get the new dynpro
no. i.e.
'0101' or '0001' etc.

7. When I copy the new number to the previous number i.e. '0111' then the
program starts working properly.

8. Please tell me the solution for the problem as this is a tedious job to
check whether the code is working properly or not everytime and make a new
recording everytime
it stops working.

9. Please look at my code and tell me where am I going wrong.

Thanks in Advance,
Angshuman Baruah

__.____._
Copyright © 2011 Toolbox.com and message author.

Toolbox.com 4343 N. Scottsdale Road Suite 280, Scottsdale, AZ 85251
Mark as helpful
View this online
  
Dave Thornburgh
SAP ABAP Helper

Posted helpful replies on 5 threads in a group to earn a Bronze Achievement
Popular White Papers

In the Spotlight
Have an SAP Question? Ask Your Peers at Toolbox for IT

_.____.__

0 comments:

Post a Comment

T r a n s l a t e to your language