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: 

BAPI_MATERIAL_SAVEDATA error handling

Former Member
0 Kudos

Hello all, I'm using this BAPI to update some materials and I'm having problems handling the error messages.

This is my code:


    CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
      EXPORTING
        headdata       = header
        plantdata      = w_marc
        plantdatax     = w_marcx
        valuationdata  = w_mbew
        valuationdatax = w_mbewx
      IMPORTING
        return         = return
      TABLES
        returnmessages = return_msg.

as you can see I have seted the table returnmessages, but for some reason, there are some erros that are showed up in a window on the screen and the user must press ok for the procces to continue. Is there any way to avoid this kind of errors on a BAPI?

4 REPLIES 4

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

That is very interesting because BAPIs are not supposed to fire messages that way. What kinds of messages are you seeing?

Regards,

Rich Heilman

nishanthbhandar
Contributor
0 Kudos

Mauro,

Ideally a BAPI is not supposed to throw any errors on the screen.I went through the source code of 'BAPI_MATERIAL_SAVEDATA' and found out at certain conditions some messages are being output instead of being stored in the return table.You cannot suppress them.However what you can do is to ensure that the data being passed is as correct as possible.

Additionally i tried looking for some import parameter which will suppress these forced messages.Seems there is no such parameter available.

Reward helpful answers

Cheers

Nishanth

Message was edited by: Nishanth Bhandar

Former Member
0 Kudos

Hi,

I had the same issue with another BAPI. It turned out to be a config problem and someone added a substitution rule that caused the pop up. Check config. If it is pop up messages that you are getting, you can debug the dialog and from there you can see what is wrong.

Good luck,

seema

rahul2000
Contributor
0 Kudos

dera mauro,

could you plz send me you code...i am using this bapi for the first time