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 Writing ....

Former Member
0 Likes
951

Hi guys

I’m working on batch input program. I have record and then pass my internal table. In a net shell its working fine. I’d like to know what else we can put in batch input program from LOG stand point. For example I have put the one sub routine showed error log and other sub routine send an email to recipient.

What else could be the beneficial, or what is the normal practice. I just want that BDC program should give sensible information from user stand point.

Please give your suggestion.

Thanks

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
931

Hi Suleman,

Additional things you can do to you BDC program is

1) to do a call transaction for all the uploaded records.

2) For error records,by checking sy-subrc value for call transaction, you can do a BDC session method.

3) Process the BDC session so that the user can have a very useful Error log and that too in SAP provided format(SM35).

4) If you don't want steps 2 nad 3, you can use

FORMAT_MESSAGE function module to create meaningful messages out of messhage variables and display as a report.

5) As you have mentioned, you can mail the erroneous records to the User using SO_NEW_DOCUMENT_SEND_API1 FM.

REgards,

Ravi

8 REPLIES 8
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
931

Usually when programming a BDC, I will throw an ALV grid after all processing which shows all of the transactions and the status of the transaction( Successfully or Error). If there is an Error, I will give the first error message which was encountered during processing of that transaction.

Regards,

Rich Heilman

Read only

Former Member
0 Likes
932

Hi Suleman,

Additional things you can do to you BDC program is

1) to do a call transaction for all the uploaded records.

2) For error records,by checking sy-subrc value for call transaction, you can do a BDC session method.

3) Process the BDC session so that the user can have a very useful Error log and that too in SAP provided format(SM35).

4) If you don't want steps 2 nad 3, you can use

FORMAT_MESSAGE function module to create meaningful messages out of messhage variables and display as a report.

5) As you have mentioned, you can mail the erroneous records to the User using SO_NEW_DOCUMENT_SEND_API1 FM.

REgards,

Ravi

Read only

Former Member
0 Likes
931

Hi Suleman,

You can use the collection of messages which are populated during the message run.

This can be achieved like

DATA: BDCDATA TYPE TABLE OF BDCDATA.

DATA: ITAB TYPE TABLE OF BDCMSGCOLL.

CALL TRANSACTION 'SE38' USING BDCDATA MODE 'N'

MESSAGES INTO ITAB.

Now you can use the messages in your itab to put it as a log or send it as a content of a mail during the BDC run.

Cheers

JK

PS: Award points if this helps you.

Read only

0 Likes
931

Hi!

You can also include BDCRECX1 into your report and let all the message handling and error map creation do the standard code.

Regards,

Christian

Read only

0 Likes
931

Can you guys also tell me how can I bulid error ,Warning and message in my BDC program ..The wasy SM35 showed it . I mean What emplyee has error .. etc ...

Thank you all for your inputs.

Bye

Message was edited by: Suleman Javed

Read only

0 Likes
931

Hi ,

You can use FM FORMAT_MESSAGE to format your message & display them as report.

After call transaction check for Sy-subrc & move the message into one internal table accordingly checking for the message type('E','W', 'I' etc) & formating with the FM mentioned & then write them as report.

Read only

0 Likes
931

That`s I know .. I mean to say .. when we process session in SM35 and when we get error log ..it shows as the recored number and log , where , how , where it fails .. so we can go to that screen block and re-process our REC...

I want to show these kind of messages in my BDC log ...

Thanks

Read only

0 Likes
931

Hi,

Record no.,you can get from SY-TABIX & save it in the internal table. & the rest of the log you can get from the message internal table.