cancel
Showing results for 
Search instead for 
Did you mean: 

How do I dynamically change JCO connection to multiple SAP Back end system?

Former Member
0 Kudos

Hi Folks,

We have identical custom RFCs in two SAP system. I have created two different sets of JCO connections pointing to the two SAP systems.

During run-time I would like to connect to one of the SAP system and based on data retrieved I then need to connect to the other SAP system. In my Web Dynpro app I have defined the following code:

String jcoParam = "WD_ORDERSTATUS_RFC_METADATA_DEST_CLT2";

//Dynamically changing the JCO client

if (SystemName.equalsIgnoreCase("Client02")) {

try {

IWDDynamicRFCModel OrderCustom =

(IWDDynamicRFCModel) WDModelFactory.getModelInstance(

OrderStatus.class);

IWDJCOClientConnection cliConnection =

WDSystemLandscape.getJCOClientConnection(jcoParam);

OrderCustom.setJcoClient(cliConnection.getClient());

} catch (WDSystemLandscapeException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

}

try {

wdContext

.currentZ_Rfc_Order_Detail_InputElement()

.modelObject()

.execute();

wdContext.nodeOrderDetailOutput().invalidate();

} catch (WDDynamicRFCExecuteException ce) {

msgMgr.reportException(

"RFC connection error:" + ce.getMessage(),

false);

But I get the following error during runtime - RFC connection error:Accessing System T02 is not possible because RFC Metadata was retrieved using System T01. Please assure you have configured the RFC Connections properly. A Server restart may be necessary!

Does any one know if this is do-able and how? Thanks in advance for your help!

Regards,

Abu

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

The problem is that although you can change the data connection for the model at runtime you can't alter the metadata connection. Since both model and meta must point to the same server it errors out. What i have done for things like this in the past is to call a wrapper rfc in one of the systems and let it farm the call out to other systems and send me that data back. hope that helps.

Thanks,

Lee

Answers (0)