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

BDC Program

Former Member
0 Likes
922

Hi all,

I am trying to upload data from a flat file into tcode xk01. Say , I have 100 reorsds to be updated. If I get a problem while updating 50 th record how should I handle the error ? Generaly what could be the strategy to such kind of situations.

Regards,

Varun.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
896

In my personal experience, the best way is the following:

upload all data, tha 100 records. Then in a loop call to the transaction for each of the records, the result tables of every bdc call transaction is stored in a big table.

After all the reacords have been treated , you can show the big table to the user.

I don´t know if this answers your question.

Kind regards,

Ibai Ramirez

8 REPLIES 8
Read only

Former Member
0 Likes
896

Hi Varun,

When you do a session method for your BDC program,it will shoe you the error records & success records in the LOG.If you want to stop the BDC when you get error say 50th records in your 100 records,you can check the SY-SUBRC = 0 & stop the BDC.

Read only

Former Member
0 Likes
897

In my personal experience, the best way is the following:

upload all data, tha 100 records. Then in a loop call to the transaction for each of the records, the result tables of every bdc call transaction is stored in a big table.

After all the reacords have been treated , you can show the big table to the user.

I don´t know if this answers your question.

Kind regards,

Ibai Ramirez

Read only

0 Likes
896

I suggest to use Session method for the same.

Say I_XK01 contain all data which needs to be uploaded using tcode XK01.

LOOP AT I_XK01.

Populate BDC TAB for the record

CALL TRANSACTION XK01 IN NO SCREEN MODE

Read Messages Table Last Record.

If Message Type is 'A' OR 'E',

Create a session using function BDC_OPEN_GROUP.

Insert I_BDCTAB to function BDC_INSERT.

Close session using function BDC_CLOSE_GROUP

Endif.

ENDLOOP.

If you do not want to create session for erroneous entries, you can format messages for Call Transaction using function module FORMAT_MESSAGE. And display log in report output.

Read only

Former Member
0 Likes
896

The easiest way would be to use standard SAP program RFBIKR00. This will create a batch input session and the errors can be processed later.

Rob

Read only

0 Likes
896

If you don't want to use RFBIKR00, then the session method is better than call transaction in most cases. As the others have said, after the session is complete, if there are any errors, they are much easier to deal with by processing the error session.

Generally, the only time I use call transaction is if I either want to show the user immediately the status or if further processing depends on the success or failure of the current transaction.

Rob

Read only

Former Member
0 Likes
896

Hi ,

There two ways to find that error records.

1. if you are running the BDC in session method error stores in error log with you can see through SM35.

2. if your running BDC in Call tranction mode error record stroes in BDCMSGCOLL Structure .then you need catupre all error records for each item into a internal table and you show them in out put . this structure holds both error as well success records also,hope this will use full to you,.

Thanking you,

salee.

Read only

0 Likes
896

if you have session created in SM35 then process it in background? if you have any errors session you can find in error logs..i hope this helps you.....

Read only

Former Member
0 Likes
896

Hi Varun,

The data can be uploaded using Call Transaction.

If there are any errors such as the one mentioned in your quesiton, then those errors can be captured and then displayed on the screen. To process the error records, the user has to depend on the Data file again. This is a very labourious process. To avoid such siuations, Session method is called for error records only. This will help the user to know the error records. He/She can process the records at his/her convienence.

This the procedure that we follow in our company.

This again may not be considered as a standard procedure. All depends on the client's requirement.

Regards,

Vara