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

how to capture the error message from bapi

Former Member
0 Likes
1,453

hi,

i have one scenario, in that i am calling a BAPI, in turn a BADI is getting trigerred inside the BAPI and it is throwing the "Error Message" ..

My requirement is i need to capture that error message from the BAPI into an internal table/work area without displaying the error message

hi,

i have one scenario, in that i am calling a BAPI, in turn a BADI is getting trigerred inside the BAPI and it is throwing the "Error Message" ..

My requirement is i need to capture that error message from the BAPI into an internal table/work area without displaying the error message

2 REPLIES 2
Read only

Former Member
0 Likes
740

When u call a BAPI there will be Return structure. u need to pass the internal table to that function module. when the function module is executed the internal table is filled with the messages. u can loop at that internal table where message type is 'E' and process the message.

Check this :

DATA:IT_PERSONALDATA LIKE STANDARD TABLE OF BAPIKNA101_1 WITH HEADER LINE,

IT_COPYREFERENCE LIKE STANDARD TABLE OF BAPIKNA102 WITH HEADER LINE,

RETURN LIKE STANDARD TABLE OF BAPIRETURN1 WITH HEADER LINE.

CALL FUNCTION 'BAPI_CUSTOMER_CREATEFROMDATA1'

EXPORTING

PI_PERSONALDATA = IT_PERSONALDATA

  • PI_OPT_PERSONALDATA = PI_OPT_PERSONALDATA

  • PI_COMPANYDATA = PI_COMPANYDATA

  • PI_OPT_COMPANYDATA = PI_OPT_COMPANYDATA

  • PI_CONSUMEREN = PI_CONSUMEREN

PI_COPYREFERENCE = IT_COPYREFERENCE

  • PI_CREDIT_CONTROL_FLAG = PI_CREDIT_CONTROL_FLAG

IMPORTING

CUSTOMERNO = V_CUSTOMERNO

RETURN = RETURN.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

EXPORTING

WAIT = 'X'.

APPEND RETURN.

LOOP AT RETURN.

WRITE:/ RETURN-TYPE, RETURN-MESSAGE.

ENDLOOP.

Regards,

Swathi

Read only

Former Member
0 Likes
740

I don't think I understand your requirement.

If an error is ocurring how are you going to handle it then?

If the Badi is throwing the error message just edit it and get the message there, but again it must be there for a reason