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

bapi error

Former Member
0 Likes
370

Hi all,

In a interview i was asked a question, how to handle errors in BAPI. Even though i have worked in BAPI, i don't know how to handle errors in BAPI. Please help me if anyone knows the answer....

Thanks and Regards,

subbu.

2 REPLIES 2
Read only

Former Member
0 Likes
348

every bapi has a return structure with name bapiret2 or bapireturn

make an internal table with that structure.

every bapi has an importing parameter return

pass the internal table to it

we will get messages in the internal table

read the table with message type s

then perform commit.

if it is helpful please reward points.

Edited by: moazam hai on Apr 12, 2008 12:48 PM

Read only

vinod_vemuru2
Active Contributor
0 Likes
348

Hi Subramanian,

Every BAPI fm has one parameter under tables called RETURN. When u execute the BAPI what ever messages u get irrespective of message type all will be returned in this table. After calling the BAPI u have to read this table with TYPE = 'E' for errors. If no errors the again read with TYPE = 'A' Abort messages. If again fails then ur BAPI has successfuuly worked.

There is one more message which indicates Failure i.e TYPE = 'X'. But generally we will never encounter this message.

So u can read the return table with TYPE = E and A. If Both fails then ur BAPI is success.

In most of the BAPIs there will be one importing parameter which will return Document number generated etc. It depends on the application of the BAPI. Suppose if u are posting some thing then a document will be generated and will be returned in this parameter.

Thanks,

Vinod.