on 03-13-2009 5:58 PM
Hi,
I need to call many RFC's and at the end commit (or rollback) the updated data, like they belong to the same transaction.
I tried two approaches:
- Using com.sap.conn.jco.JCoDestination::createTID and com.sap.conn.jco.JCoDestination::confirmTID after the function is executed;
- Using com.sap.conn.jco.JCoContext::begin, execute the function and com.sap.conn.jco.JCoContext::end;
But with both approaches the data is commited just after the RFC is executed.
There is no commit work in the functions (all Z functions).
Is there some autocommit option in JCO?
I'm using JCO version 3.
Regards
Michel
hi,
i hope so (not sure)
check this
http://help.sap.com/saphelp_mii121/helpdata/en/45/0ee04bcd214030e10000000a1553f6/content.htm
at end of the html page u can find the "autocommit" -- boolean we have to set
let me know am i correct or wrong
bvr
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Michel,
JCo doesn't have an AutoCommit feature.
This is the relevant part from the JCo documentation:
Class com.sap.conn.jco.JCoContext
The JCoContext class allows the execution of stateful function call sequences
with JCo. It provides methods for notifying the JCo runtime about starting and
ending stateful call sequences for a specific destination. The same connection
will be used for all remote function calls between invoking the start() and
end() methods. This is typically used for multi-step logical units of work
(LUWs), in which several function modules are executed in a row and are
committed afterwards.
In case an error occurs during the communication and
the connection is broken or closed, an exception will be thrown and the
application should take care of this. Depending on the application it might be
necessary to repeat all function calls of the failed sequence as the back-end
will do an automatic rollback of all previous operations that have not been
committed yet.
JCoDestination destination = JCoDestinationManager.getDestination("<DestinationName>");
try
{
JCoContext.begin(destination);
function1.execute(destination);
function2.execute(destination);
funcBapiTransactionCommit.execute(destination);
}
catch (AbapException ex)
{
...
}
catch (JCoException ex)
{
...
}
catch (Exception ex)
{
...
}
finally
{
JCoContext.end(destination);
}
Internally, the JCo runtime considers all calls executed in the
current session and scope between begin() and end() as coherent and sends the
calls over the same connection. Stateful contexts can be nested. The respective
connection will be released only after the root context is ended, i.e. end()
needs to be called as many times as begin() was called before for a specific
destination.
Applications or application environments, that can change the
thread during a stateful call sequence, have to provide and register a custom
implementation of the SessionReferenceProvider for supporting such a feature.
The default implementation does not support stateful call sequences across
several threads.
--------------------
If data is already persisted / committed without calling BAPI_TRANSACTION_COMMIT as the final remote function of your call sequence, then this step is already done in your ABAP Z-function module(s) or within the ABAP code that they are calling internally.
Best regards,
Stefan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
91 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.