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 exceptions in BAPI

Former Member
0 Likes
5,273

Dear Gurus,

Is there any specific way to handle exceptions in BAPI? I mean the way one handles exception in FM...can tat be applicable to BAPI or is there something specific.

Regards,

Shiku

Dear Gurus,

Is there any specific way to handle exceptions in BAPI? I mean the way one handles exception in FM...can tat be applicable to BAPI or is there something specific.

Regards,

Shiku

9 REPLIES 9
Read only

kesavadas_thekkillath
Active Contributor
0 Likes
2,565

Hi shiku,

As far as i know BAPI's are Remote Enabled Function Modules, so exception's must not be used in BAPI.

In BAPI the errors are stored in a return table.

Go through these links

<linkfarm_removed_by_moderator>

Edited by: Julius Bussche on Nov 8, 2009 5:05 PM

Read only

Clemenss
Active Contributor
0 Likes
2,565

Hi shiku,

most of the links will not bear a clear answer.

Because BAPIs can be called from external systems and there is no common interface defibing exceptions, a BAPI should never end in an exception.

BAPIs have a RETURN parameter which is in most cases an internal table of structure BAPIRET2. This will store all messages issued by the business process. Messages with message types E, A or X replace the exception and must be handled by calling system accordingly.

Some BAPIs return a RETURN structure only, this ha just one message.

Regards,

Clemens

Read only

Former Member
0 Likes
2,565

Hi Shiku,

<< Please respect the 2,500 character limit for posts. You could ahve just posted the link >>

I searched for this info for you shiku from here.

http://help.sap.com/saphelp_46C/helpdata/EN/a5/3ec9f74ac011d1894e0000e829fbbd/content.htm

Hope you found the info helpful.

Regards,

SuryaD.

Edited by: Rob Burbank on Nov 7, 2009 1:54 PM

Read only

Former Member
0 Likes
2,565

<< Cut and paste without attribution from http://help.sap.com/saphelp_46C/helpdata/EN/a5/3ec9f74ac011d1894e0000e829fbbd/frameset.htm removed >>

Regards,

SuryaD

Edited by: Rob Burbank on Nov 7, 2009 1:58 PM

Read only

Former Member
0 Likes
2,565

The export parameter Return can be implemented as follows:

  • As a structure, whereby it must be defined in the function module as an export parameter, as well as in the method in the BOR.

  • As a table, whereby it must be defined in the function module as a table parameter, as well as in the method in the BOR as an export parameter.

Before filling the Return parameter you should either initialize the structure with CLEAR or the table with REFRESH and CLEAR.

If the return parameter is not set or is set to an initial value this means that no error has occurred.

The Return parameter may be based on the following reference structures:

  • BAPIRET2

You must use this reference structure when developing new BAPIS.

  • BAPIRET1, BAPIRETURN

These reference structures are still partly used in old BAPIs.

Both structures must be filled in the logon language.

Regards,

SuryaD.

Found this info for you shiku at http://help.sap.com/saphelp_46C/helpdata/EN/a5/3ec9f74ac011d1894e0000e829fbbd/content.htm.

Hope this was helpful.

Read only

Former Member
0 Likes
2,565

Hi Rob,

Am sorry about pasting it here.

did so because most of the users do not follow the link.

They feel it is misleading and do not contain a direct answer.

So...thought that putting it all here will be helpful.

Regards,

SuryaD.

Read only

0 Likes
2,565

> did so because most of the users do not follow the link.

> They feel it is misleading and do not contain a direct answer.

> So...thought that putting it all here will be helpful.

Neither are helpfull if the person could have searched themselves...

You have copy&pasted again today. This is your final warning.

Only answer if you know the answer and the person asking the question has put in some effort!

Cheers,

Julius

Read only

Former Member
0 Likes
2,565

Hi Shiku,

I hope the info posted by me above has helped you.

If yes, please mark answered and close the thread .

Regards,

SuryaD.

Edited by: SuryaD on Nov 8, 2009 3:22 PM

Read only

Former Member
0 Likes
2,565

Sure Julius...

Will keep this in mind.

Regards,

SuryaD.