Application Development 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: 

Calling a RFC via WEB without doing a commit

Former Member
0 Kudos

Hello,

I have a RFC called from the WEB.

I have 2 steps in the RFC.

.1 CALL a BAPI (no commit inside the BAPI).

.2 Update a ZTABLE.

When I execute the RFC, the BAPI update nothing.

This is correct because the 'BAPI_TRANSACTION_COMMIT' is not executed.

But the ZTABLE is UPDATED and I don't want to update it.

<b>How I can manage the commit of the table?</b>

Thank you very much

Syme

4 REPLIES 4

Former Member
0 Kudos

Hi,

You can call your rfc enabled function module and the function module 'BAPI_TRANSACTION_COMMIT' in the same LUW.You can do this calling your FMs using 'in background task' addition of the Call Function(if it is an ABAP environment)

Former Member
0 Kudos

Hello,

Like I said, the RFC is call from the WEB by a JAVA program.

We want to give to the JAVA program the control of the COMMIT.

The JAVA program call the RFC:

inside the RFC we have:

in step 1, a call of a BAPI_CHANGE_anything*

in step 2, an update of a Ztable.

The JAVA program in the next steps valid the return code.

Call others RFCs, and at the end, do the BAPI_TRANSACTION_COMMIT if everything is ok.

But if an error occurs during this process, we don't do the BAPI_TRANSACTION_COMMIT.

The problem is when we don't do the COMMIT, the Ztable is update anyway.

We don't want to update this Ztable.

The only way I see, is to code a BAPI for every modifications we have to do in the Database.

0 Kudos

A limitation of the RFC protocol is that it performs an implicit commit at the end of each call. This is why the BAPI's must be written to perform updates asynchronously using PERFORM ... ON COMMIT or CALL FUNCTION ... IN UPDATE TASK.

Of course, a downside of that asynchronous update approach is that in some scenarios it is difficult to chain BAPI calls into a single unit of work because the updates of the earlier calls are not effected when the logic of the latter call executes (for example, create customer bapi followed by create order bapi won't work in a standard LUW).

The previous posting about using transaction RFC (such as CALL FUNCTION ... IN BACKGROUND TASK) may apply here. The ability to call functions transactionally has is supported by JCo and the RFC library - but it is more of a pain to do and get results back.

Cheers,

Scott

Former Member
0 Kudos

Thank you guys.

You solved my problem.

I call the sub-RFC in update task.

Thank you again