Skip to Content
0
Former Member
Feb 08, 2008 at 10:36 PM

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

29 Views

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