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

raise exception vs bapiret2

Former Member
0 Likes
1,593

hi,

please comment.

may i know if FM raise exception, the sy-subrc will not be zero whereas bapi bapiret2 wouldn't set sy-subrc value to non zero.

if yes, which means we use bapi bapiret2 if we still want the program to continue processing even has error?

thanks

hi,

please comment.

may i know if FM raise exception, the sy-subrc will not be zero whereas bapi bapiret2 wouldn't set sy-subrc value to non zero.

if yes, which means we use bapi bapiret2 if we still want the program to continue processing even has error?

thanks

6 REPLIES 6
Read only

Simha_
Product and Topic Expert
Product and Topic Expert
0 Likes
1,102

Hi,

In F.M if it throws an exception it is an error and sy-subrc is set greater than zero,

but in BAPI, bapiret2 handles all the messages , status, warning, error messages..

So, we hve o check in ordrer to continue the processing,

It provides greater flexibility whether to proceed or stop...

Cheers,

Simha.

Read only

Former Member
0 Likes
1,102

Hi,

You are right in this sense.

The very difference between normal FM and BAPI is we do not have exceptions in BAPI, as error capteruing mechanism works thro' BAPI RETURN structure.

So for deciding whether error has occured or not, you need to read this structure and see if there is any record pertaining to error.

Regds,

Akshay Bhagwat

Read only

0 Likes
1,102

hi, thanks for reply.

which means in bapi, if error, it still can continue processing?

thanks

Read only

Simha_
Product and Topic Expert
Product and Topic Expert
0 Likes
1,102

Hi,

How ever if there is a error for particular record, it doesn't proceed processing with that record..

it starts with the next record...

But u need to know what the error or problem that's been occured..

So u need to go to the bapiret2 structure and check the messages what the problem is been...

Cheers,

Simha.

Reward all the helpful answers...

Read only

Former Member
0 Likes
1,102

after BAPI fun module use bapiret2 structure

ie

BAPI_PO_CREATE1

EXP

IMP

.

IF BAPIRET2-TYP ='E' ORBAPIRET2-TYP = 'A'.

MOVE RECORDS TO ERROR INTERNAL TABLE

ELSE.

CALL FM BAPI_TRANSACTION_COMMIT

OK THIS WILL DEFINETLY WORKS OK

Read only

Former Member
0 Likes
1,102

Hi,

When sy-subrc is set to a non zero number in bapi as exception, U can have still options to raise an error or process further, depending upon how u react (write the code) with exception value.

Thanks.