Skip to Content
0
Aug 17, 2023 at 09:45 PM

JCo Calling Remote FM which calls another FM

179 Views

All,


I have a Remote Function Module (let's call it RFM1) that I can call with JCo. No issues, works perfectly fine.

Now I change the RFM1 code to call a different Remote Function Module which resides on a different SAP system. Let's call it RFM2. To do that, I used SM59, created a new entry in RFC Destinations.

This works fine from SAPGUI.

I am wondering if its possible to do that via JCo?

To recap, RFM1 resides on SAP SYSTEM1 and RFM2 on SYSTEM2 (which RFM1 calls using the syntax CALL FUNCTION 'RFM2' DESTINATION 'SYSTEM2'...)

My ABAP_AS1.jcoDestination file only had entry for SYSTEM1. I tried entering info for SYSTEM2 after that (but it seems like I cannot have 2 entries?) but that didn't help. From my Java client perspective, it is still calling RFM1 on SYSTEM1, but how do we provide info on client side for RFM2 for JCo to use?

Code is very simple as shown below. ABAP_AS1.jcoDestination has all the info needed to execute RFM1 on SYSTEM1.

String functionName = "Z_RFM1";
JCoDestination destination = JCoDestinationManager.getDestination(DestinationConcept.SomeSampleDestinations.ABAP_AS1);
JCoFunction function = destination.getRepository().getFunction(functionName);


Thanks in advance for any pointers!