开发者

How can SAP tRFC server tell client through JCo that function has been carried out?

开发者 https://www.devze.com 2022-12-29 18:24 出处:网络
SAP开发者_开发技巧s \"Transactional RFC Technical Description\" document (release 4.0, see http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/ee6bca90-0201-0010-5792-d9693e2eac83?Quick

SAP开发者_开发技巧s "Transactional RFC Technical Description" document (release 4.0, see http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/ee6bca90-0201-0010-5792-d9693e2eac83?QuickLink=index&overridelayout=true ) says in section Transactional RFC on page 6: "Finally, the server tells the client, that the function has been carried out and the client acknowledges this.".

How can the server tell this to the client when the server communicates with the client through JCo (Java Connector)?


Release 4.0 is quite old - be sure to always use the recent documentation.

From what I can see, there's no way to hand the result of the tRFC call back to the server. tRFC calls might be placed in a (local or remote) queue and executed later. See http://help.sap.com/saphelp_nw04/helpdata/en/f0/02a63b9bb3e035e10000000a114084/frameset.htm for information on how to monitor tRFC calls.


The answer is very simple: by not throwing an exception! Assuming that the JCo side is the server here, all you need to do is return successfully from the method that implements the function module. JCo will then automatically return the acknowledgement required by the tRFC protocoll to the client (= the R/3 system in this case).

The R/3 system, upon recieving the ACK from JCo, will then trigger the Confirm event, which JCo receives and passes into the appropriate event of your JCoServerTIDHandler. Here you can then clean up the TID from your status keeping DB.

If your function module method returns with an error, JCo will report that accordingly, and the backend will trigger the Rollback event.

The following article explains in more details, how tRFC between an external program and an SAP system should be implemented. It is based on the NetWeaver RFC library (C/C++), but you can easily translate it to JCo and Java: https://wiki.scn.sap.com/wiki/x/FD67Gg

0

精彩评论

暂无评论...
验证码 换一张
取 消