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 handle errors in BAPI

Former Member
0 Likes
778

Hi Experts,

Could you give me stuff regarding

1) how to handle errors in BAPI

2) In BAPI How should Return custom fields in BAPIRET2

Thanks,

Asha

4 REPLIES 4
Read only

Former Member
0 Likes
652

REFER..

Read only

Former Member
0 Likes
652

You have to create a parameter named Return for every BAPI. This parameter returns exception messages or success messages to the calling program.

BAPIs themselves must not trigger any messages (such as MESSAGE xnnn) in the coding. In particular they must not generate terminations or display dialog boxes. Instead, all messages must be intercepted internally and reported back to the calling program in the Return parameter. Otherwise the BAPI will not be processed correctly and control may not be given back to the calling program.

All error messages or indeed any message that may be returned by the BAPI, must be defined in message table (Tools -> ABAP Workbench -> Development -> Programming environment -> Messages) and described in the documentation for the return parameter. This also applies to the most important or most likely error messages generated by other programs that can be indirectly passed via the BAPI to the application program.

Have a look at below link.

http://help.sap.com/saphelp_nw04/helpdata/en/a5/3ec9f74ac011d1894e0000e829fbbd/content.htm

I hope it helps.

Best Regards,

Vibha

*Please mark all the helpful answers

Read only

former_member404244
Active Contributor
0 Likes
652

Hi Asha,

In BAPI'S u can handle the errors with the help of BAPI RETURN parameter.

U have to declare an internal table like BAPIRET2. u need to pass this internal table to the RETURN structure .Now this internal table will capture the error messages once u run the BAPI.

Regards,

Nagaraj

Read only

Former Member
0 Likes
652

Hi

U have two structures 'BAPIRETURN' and BAPIRET2 which u have to use in ur BAPI FM as export parameter or tables parameter which will hold the errors.

For passing the errors to these structures u have to call FM

BALW_BAPI_RETURN_GET'.See the FM documentation in SE37.

And see the structure parameters in SE11 for better understanding.

Mark points if helpful.

Regs

Manas Ranjan Panda