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

Handling BAPI responses..

Former Member
0 Likes
1,083

Hi..

I am using the Bapi --> BAPI_BOM_UPLOAD_SAVE for BOM creation.. so while creating the BOM i am giving the mandatory fields

for the creation of a BOM.

For eg: if i create a BOM using this BAPI, if the BOM is successfully created then a response will get 000 as a success indicator with its LOg_Msg_No as 0000000 and i am not getting any message as successfully created, and in case of failure it is just generating some error with message ID and type..

In the response i am getting the error message with its 3 digit code, but is it possibe to get the message along with its ID and type..

is there any way to capture the response message,

and also let us know the possibilities of capturing the error message..

the message classes w.r.t this BAPI are W_ and 29

regards,

Kishore

9 REPLIES 9
Read only

Former Member
0 Likes
976

Hi

you can capture the error messages in the following way:

data: it_ret type standard table of bapiret2,
        wa_ret type bapiret2.

CALL FUNCTION 'BAPI_BOM_UPLOAD_SAVE'
  EXPORTING
    IS_MAST         =
    IS_STZU         =
 IMPORTING
   ES_RETURN       = it_ret
  TABLES
    IT_STKO         =
    IT_STPO         =
    IT_STAS         =


loop at it_ret into wa_ret.

write: / wa_ret-message.

endloop.

Regards,

Vishwa.

Read only

0 Likes
976

Hi..

Actually we can see what type of error it is coming with its Type, ID field and Number field..

Type -- E -- Specifies the Error

ID -- W_ -- Specifies the error belongs to W_

Number -- 003 -- error in W_

to view W_ go to messag class SE91 and see there, like this how many possiblities of tables of errors are there for this BAPI..

As a response i am getting only the ID and its Number, but i need along with the response error message which is accross that Number.. how to get that as a response message.

regards

Kishore

Read only

0 Likes
976

Check FORMAT_MESSAGE FM, here you need to pass the message id, type and number. It will return you the actual descriptive message

Read only

0 Likes
976

Hi

Go through the Es_return strucuture in the BAPI in se37 tcode..

Check if there are fields which satisfy ur requirement.

loop at it_ret into wa_ret.

write: wa_ret-message.... " u can add the fields here.

endloop.

Regards,

Vishwa.

Read only

Former Member
0 Likes
976

Hi,

Check FM "FORMAT_MESSAGE"

Once you get messages in the return table then pass it to this FM, to get a meaningful description.

Thanks & Regards,

Navneeth K.

Read only

0 Likes
976

Navaneeth,

i am using XI here how can i use multiple function modules at a time.. Can u elaborate more on how to use this FORMAT_Message function module, i have checked it when i give some input parameters it is working fine.. but while executing the BAPI, the response of the BAPI gives the input parameters for the FM Format_Message, how to map this two function modules..

regards

Kishore

Read only

0 Likes
976

once the BAPI is executed, loop at the reuturn table ( of type bapiret2). and call this FM in the loop.

Read only

Former Member
0 Likes
976

Hi Kishor,

Check out the structure BAPIRET2. The BAPI will return only types like 000 or 001 etc as messages. U wud need to code accordingly to tell the user that its a success msg/ warning or error.

The structure also contains BAPIRET2-MESSAGE.

Try displaying that and check if its working.

Regards,

Amit

Read only

Former Member
0 Likes
976

Hi,

We can have message display this way :

LOOP AT it_return.
WRITE:/ it_return-type, it_return-id, it_return-number,
it_return-message.
ENDLOOP.

or we can use function module " Format_Message".

thanx.