‎2008 Aug 11 9:05 PM
Hi,
Is there a way to commit a single database operation, outside the main transaction?
I want to perform a commit inside of a function module without confirm the caller program's luw
I tried to use STARTING NEW TASK, it works, but there is a session limit per user
My function module saves a access log in a Z transparent table.
This log must be always generated (even if a rollback was performed outside this FM) and can´t change the caller program flow
Thanks
Darley.
‎2008 Aug 12 1:57 PM
There was an article in the SAP Professional Journal on this very question. It recommends using Secondary Database Connections. If you start reading the ABAP help on "COMMIT CONNECTION", you'll find the information you need quite quickly. Or buy the magazine of course.
Note, however, that these are marked by SAP as "for internal use only", so they're used at own risk!
As an alternative, write a file to the appserver.
matt
‎2008 Aug 11 9:52 PM
Its the sure-shot solution:
1)Make the FM RFC enabled.
2)Make all the parameters global.
3)Call the tRFC in BACKGROUND TASK.
‎2008 Aug 12 1:55 PM
Hi Sourav.
The addition IN BACKGROUND TASK for the call function does not execute the FM. It register to be executed when the COMMIT WORK statement is executed.
If there is no commit in the caller program, my log will not be generated
Thanks.
Darley
‎2008 Aug 12 1:57 PM
There was an article in the SAP Professional Journal on this very question. It recommends using Secondary Database Connections. If you start reading the ABAP help on "COMMIT CONNECTION", you'll find the information you need quite quickly. Or buy the magazine of course.
Note, however, that these are marked by SAP as "for internal use only", so they're used at own risk!
As an alternative, write a file to the appserver.
matt
‎2008 Aug 12 5:52 PM
I made a test using COMMIT CONNECTION con.
If con has the same value of de default connection, this commit complete the current LUW, exactly as the commit work statement
‎2008 Aug 13 4:16 PM
>
> I made a test using COMMIT CONNECTION con.
>
> If con has the same value of de default connection, this commit complete the current LUW, exactly as the commit work statement
That's why you need a second connection. But you can make the second connection to the same database as the first. Then the commits are independent.
DATA: connection_2 TYPE dbcon-con_name.
connection_2 = 'R/3*CONN2'. " The R/3* prefix says that it's a second connection to the db server
...
INSERT INTO zlogtab CONNECTION (connection_2) VALUES some_values.
COMMIT CONNECTION (connection_2).Edited by: Matthew Billingham on Aug 14, 2008 9:27 AM
Added solution
‎2008 Aug 15 6:25 PM
‎2008 Aug 12 2:03 PM
Hi,
You can do the the update part alone another program ..
how does Submit and return work out?.. may be you can try
that and let me know the results..
Thanks
Krishnan
‎2008 Aug 12 5:57 PM
SUBMIT AND RETURN executes the program in the same session.
So, the commit affects both programs (same LUW)