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 Error Message Handling

Former Member
0 Kudos

Hi Group,

I am using BAPI ,How to display the BAPI Error Message (eg:BAPIRET1) which is returning by BAPI

4 REPLIES 4

Former Member
0 Kudos

HI ,

ITS SIMPLE TRY THIS CODE

AWARD PTS

DATA: gt_ret TYPE TABLE OF bapiret2,

ls_ret TYPE bapiret2,

CALL FUNCTION 'BAPI_SALESORDER_CHANGE'

EXPORTING

salesdocument = p_vbeln

order_header_in = gt_hdr

order_header_inx = gt_hdrx

TABLES

return = gt_ret -


>>>>.<b>IMPORTANT</b>

order_item_in = gt_itm

order_item_inx = gt_itmx

schedule_lines = gt_sched

schedule_linesx = gs_schedx

order_text = gs_stdtxt.

PARTNERS = gs_partner

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.

LOOP AT gt_ret INTO ls_ret.

WRITE:/ ls_ret-type.

WRITE:/ ls_ret-message.

ENDLOOP.

Former Member
0 Kudos

Hi,

The return message will be stored in the table BAPIRET1. so you have a Internal table realted to this one.

after calling that function moduel...

LOOP AT IT_BAPIRET1

Write:/ IT_BAPIRET1-msgv1,IT_BAPIRET1-MESSAGE.

ENDLOOP.

Former Member
0 Kudos

declare itab like BAPIRET1.

and after execution of BAPi..

u can do a loop at this internqal table to display its records and find out the erroneos records.

Former Member
0 Kudos

Hi Swabap,

Say the return parameter name is GV_RETURN, paste this code after the BAPI call

if not gv_return is initial.

MESSAGE ID gv_return-id

TYPE gv_return-type

NUMBER gv_return-number

WITH gv_return-message_v1

gv_return-message_v2

gv_return-message_v3

gv_return-message_v4.

endif.

This will build & display the message along with type on the status bar at the bottom of the screen.

-Aditya