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: 

Error file generation using BDC

former_member182546
Contributor
0 Kudos

Hi .. friends . This is Sudhir . I have a scenario of loading 50 materials using BDC concept (generate session method) with tcode mm01. During loading if we have any faulty materials then they have to be written in a separate flat file (in the location which we specify in our pc). How can it be done? Hope your answers will be helpful for me to proceed further. Expecting for your reply...

With Regards

Sudhir S

1 ACCEPTED SOLUTION

Former Member
0 Kudos

You would need to do a call transaction with synchronous update within your program (don't just create and park a BDC session), check your return code and if not zero, write the data into an internal errors table...or insert into a custom db table from a work area at that point.

6 REPLIES 6

0 Kudos

hi,

when you BDC session method, session will be created and user has process the session in SM35 , if case of any errors you can see them in the session log. You cannot wirte the error records to a file using session. Use call transaction to process the material synchronously and you can capture the error messages into an internal table which you can write it to a file. check documentation on CALL TRANSACTION.

Former Member
0 Kudos

You would need to do a call transaction with synchronous update within your program (don't just create and park a BDC session), check your return code and if not zero, write the data into an internal errors table...or insert into a custom db table from a work area at that point.

kesavadas_thekkillath
Active Contributor
0 Kudos

Hi,

just do a call transaction to MM01.

If the sy-subrc is not 0 then its error.

Based on this you can move the error records to session and file.

former_member536879
Active Contributor
0 Kudos

Hi Sudhir,

Please replace the BDC with BAPI.

BAPI_MATERIAL_SAVEDATA.

The BDC for material master will create so many issues.

With Regards,

Sumodh.P

Former Member
0 Kudos

Hi Sudhir,

I had also similar requirement through Call Transaction method, Solution is

We can store all messages occuring during exection of transaction (e.g MM01) in an internal table of type BDCMSGCOLL, so it contains message id, message no and not message description for that u have to pass internal table to a function module MESSAGE_TEXT_BUILD now u can get message description now store this in an internal table.

Pass this internal table to a function module GUI_DOWNLOAD this will create flat file on ur PC based on the location u have given to this function module.

For session method, session log contains the information u can check INCLUDE program BDCRECX1 which will be created during recording, run this program in the debugger mode u will get idea.

Hope this will help u..............

0 Kudos

I am working with the function module you specified for loading the error messages in bdc. I have a doubt for what we need to pass for msgid and msgnr in the exporting parameters of the function module 'MESSAGE_TEXT_BUILD' and for importing parameters i have passed the internal table BDCMSGCOLL as you specified .Help me to proceed further....

Waiting for your reply.

Regards ,

Sudhir S