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_REQUISITION_RELEASE commit and rollback

Former Member
0 Likes
1,108

Hello !

I´m using

MF BAPI_REQUISITION_RELEASE

. my question is: it is necessary to execute

BAPI_TRANSACTION_COMMIT

if the execution was ok, or execute

BAPI_TRANSACTION_ROLLBACK

if the execution wasn´t ok?


in synthesis, this good to do this?

CALL FUNCTION 'BAPI_REQUISITION_RELEASE' + Parameters.

if sy-subrc = 0.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT' + Parameters.

else.

CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK' + Parameters.

endif.

6 REPLIES 6
Read only

anversha_s
Active Contributor
0 Likes
773

hi,

With BAPI_TRANSACTION_COMMIT ..the external systems have a way of deciding on whether to

Commit or to Roll back Changes.

But with Commit Work u have to code it inside ure BAPI and the outside systems then have no chance or have

any hold over the commit...

so i guess the diff lies more in the way how u want to call commit ,either from outside or from within ure BAPI.

u can use both...

SAP though recommends using BAPI_Transaction_Commit and not using Commit_work in the BAPI...

but its upto u and ure middleware guy to decide how u want to do it..

ys u r dong correct.

rgds

anver

Message was edited by: Anversha s

Read only

Former Member
0 Likes
773

Hi,

It not necessary to execute BAPI_TRANSACTION_COMMIT if the execution was ok, or execute BAPI_TRANSACTION_ROLLBACK if the execution wasn´t ok?

before compelting the execution of FM 'BAPI_REQUISITION_RELEASE' the commit work will be performed.

Regards,

Satya.

If the FM 'BAPI_REQUISITION_RELEASE' execution is unsccessful the as per the requirement you have to give some popup and report display.

Message was edited by: Satyanarayana Sayana

Read only

Former Member
0 Likes
773

Hello Fernando:

yes you are rigth...

but do it better this way:

LOOP AT tbl_msg WHERE type CA 'EAX'. EXIT. ENDLOOP.

IF sy-subrc NE 0.

LOOP AT tbl_msg WHERE type CA 'ISW'. EXIT. ENDLOOP.

ENDIF.

IF tbl_msg-type CA 'ISW '.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

EXPORTING

wait = 'X'.

ENDIF.

ENDIF.

The bapi will not work until you commit, so you wont have to roolback.

Dont forget to reward!!

Gabriel

Read only

0 Likes
773

hi,Gabriel :

according you answer, the BAPI will not change the DB after the program does complete when we do not commit. Yes?

Read only

0 Likes
773

Helllo Edgar,

Sorry for the delay,

Yes, the db will be only changed when you call the commit, if you dont do it, wont change it.

Greettings,

Gabriel P-

Read only

Former Member
0 Likes
773

You are rigth ! Thanks