cancel
Showing results for 
Search instead for 
Did you mean: 

Is it necessary to pass RETURN parameter in bapi function module

Former Member
0 Kudos

Hai All,

Is it necessary to pass structure to RETURN parameter in bapi_transaction_rollback function module. If it is not necessary then how can it gives return value. Please give me the answer for this one. some sample code below...

CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'

IMPORTING

RETURN = i_return.

LOOP AT i_return into wa_return WHERE type EQ c_error.

wa1_out-postdoc = wa_return-message.

ENDLOOP.

Thanks & Regards.

Laxman.P

Accepted Solutions (0)

Answers (3)

Answers (3)

sukhbold_altanbat
Active Participant
0 Kudos

Hi Laxman,

As you know BAPI is a remote enabled function module, which means the pass by value checkbox is always checked.

So, it is not possible to know the result of function module without getting the return value.

return value will tell the success or failure of the function module.

Regards,

Sukhee

Vijay
Active Contributor
0 Kudos

hi

bapi should never throw an error as it might be called for mass data proceessing

and it is prefferred not to hault the proceess bcoz of one or two errors.

that's why the error or success messages are caught and returned in return table.

in bapi_transaction_rollback the return parameter is not necessary as it will work without that as well.

the purpose of rollback bapi is just to undo whatever done before that.

regards

vijay

<b>reward points if helpful</b>

Message was edited by:

vijay sharma

0 Kudos

Hi,

Its only an exporting parameter, as you know all export parameters are optional.

But if you want to get the status of the rollback you need to pass the return strcuture to get the status of this function module.

The return strucutre is introduced mainly coz BAPI are meant to be called from an outside system and its not possible to raise exceptions to the remote system. so we return the status of the call in a data of type BAPIRET2.

Regards,

Sesh

Former Member
0 Kudos

Hi Sesh,

What ever the answer you have given that was good.But i need some more clarification, can we pass i_return[] to RETURN parameter because in my code if you see you can find a loop statement after calling of this function module.

I have tried like this but its giving like RETURN and I_RETURN are incompaitable.

so can u plz give me clarification..

Thanks & Regards.

Laxman.P

0 Kudos

Hi Laxman,

When you check the Function module in Se37 you will see that its a Strcuture and not a table.

So if you i_retrun is a table of type BAPIRET2 then it is an error.

So use like this


DATA: i_return like bapiret2.

CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'
IMPORTING
RETURN = i_return. " Its a workarea not a table
 " so no need to loop
wa1_out-postdoc = i_return-message.

Since this is the strcutre you should not loop but you can directly use i_return which is workarea not a table.

Regards,

Sesh