on 10-18-2005 8:59 PM
Hello,
how can I use JCO to perform tRFC to an R/3 system from a java application running on WAS 640?
I understand that according to the docs JCo should be able to do tRFC and qRFC. Are there sample code
fragments that show how to implement tRFC, e.g. the
transaction-id handling? Has anybody experience using
JCo for tRFC or qRFC?
As far as I know it's the only secure way to call BAPIs
that are modifying master or transactional data in SAP.
Thanks for your help,
Kind regards
Christof Johner
Thanks
Bruno
Hi Chrishtof,
As far as i know JCO does not have inbuilt support for tRFC. For you achieve this you may have to use RFC SDK.
For windows platform RFC SDK provides a set of DLL's which expose their API's. Hence from your java code you may have to use JNI to access the API's in the DLL's.
However in case of external systems tRFC is not fully implemented because external systems do not have a database to store the TID's to ensure that RFC's are excecuted only once and also RFC SDK library cannot store the RFC's to be called again incase the SAP system is down.
You can use the link below to find more info.
http://help.sap.com/saphelp_nw04/helpdata/en/22/042aa3488911d189490000e829fbbd/content.htm
Hope this helps.
Regards
Sidharth
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This is quite an old thread. Just in case anybody still as the same problems:
The above described way to commit / rollback a logical unit of work from JCo, calling BAPI_TRANSACTION_COMMIT or BAPI_TRANSACTION_ROLLBACK works very well.
BUT: It works only if the called remote function module does not commit data by itself. In this case you don't have control over the transaction on the Java side.
SAP tells ABAP developers that in function modules that comply to the BAPI standard must never issue a COMMIT WORK command. Anyway, in some OSS-Note there is a list of standard BAPIs that do not go the standard way and which you should avoid using if you need transactional control. A lot of custom function modules do commit by themselves, but those may easily be changed.
It is a good practice for Java developers using JCo to write an integration test for each function module that changes data in SAP to assert that a rollback command does actually roll back the changes in SAP an that a commit command does commit the changes.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Christof,
there is another thread in this forum concerning JCo and transactions: Maybe you can find something there.
There is a method createTID in JCO.Client and I have it working. I get a tid that seems to be valid. What I do is something like this:
String tid = JCO.Client::createTID()
1. JCO.Client::execute(JCO.Function, tid)
.
.
n. JCO.Client::execute(JCO.Function, tid)
call BAPI_TRANSACTION_COMMIT or BAPI_TRANSACTION_ROLLBACK using JCO.Client::execute(JCO.Function, tid).
Unhappily, the whole thing does not become transactional this way: rollback does not work and the sucks gets committed after every single RFC call.
According to footnote 6 in http://www.sapinsideronline.com/searchspi/search.htm?page=article&key=32644&query_text=JCo using JCo.Client::createTID must be the way to go, though.
This Mr.Schüsseler from arasoft.de seems to know how. As I have the same problem I'm going to send him a mail to ask him.
Let me know in case you figure anything out (Oliver@Plohmann.com). In case I figure anything out I will post it here.
Cheers, Oliver
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
101 | |
13 | |
13 | |
11 | |
11 | |
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.