cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic JCo Connection with Adaptive RFC Model 2

Former Member
0 Kudos

Hi gurus,

I'm trying to dinamically change a model data connector inside my web dynpro. I'm using an Adaptive RFC Model 2 to communicate with the R/3 backend. I've found that is possible to change the connector modifiyng the code inside the web dynpro. In detail I've found this example:

IWDDynamicRFCModel model1 = (IWDDynamicRFCModel) WDModelFactory.getModelInstance(Model1.class);

I put this code into wdDoInit method but I get the following error:

"<comp_name>.wdDoInit failed to create or init instance of model 'model_name' in scope NO_SCOPE with instanceId 'null'"

Furthermore I've used the deprecated Adaptive RFC Model and when I instantiate a model, ModelName m=new ModelName(), I see that the methods m.setJcoClient(client) and m.setSystemName(systemName) are visible, while when I try to do the same with Adaptive RFC Model 2, with my model m, the methods before there aren't.

So this is my question: is it possible to change data connector dinamically with Adaptive RFC Model 2?

Thanks a lot

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Upendra Agrawal,

I'm able to acces the information about a specific JCO using WDSystemLandscape.getJCOClientConnection("JCO") but the main problem is that I'm not be able to set dinamically another JCO, that it can be found in my Destinations repository, with another specific client using Adaptive RFC 2 Model. Infact in the document that I report above it specifies that the new Adaptive RFC 2 Model does'nt permit to change dinamically JCO at runtime. Perhaps have SAP disabled this feature?

Former Member
0 Kudos

I've found this document that explain the new Adaptive RFC 2 Model:

[http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/50f7192d-2808-2d10-189b-df3fa5f71abf]

In the chapter "Summary of Differences between ARFC1 and ARFC2" it says that the new Adaptive RFC 2 Model doesn't permit the dinamically modification of JCO client...

In detail my scenario is the following:

I have a connection to backend with a specific client. I want to change dinamicaly this client (the backend is the same) inside the web dynpro without to create another model. Is it possible with Adaptive RFC 2 Model?

Thanks at all.

Former Member
0 Kudos

Dear Lukinho,

You may try this ;


try {
IWDJCOClientConnection clientCon =  WDSystemLandscape.getJCOClientConnection("<name of the JCO connection>");
String clientName 	= clientCon.getClientName();
String lang		= clientCon.getLanguage();
String passowrd		= clientCon.getPassword();
String sysID		= clientCon.getSystemIdentifier();
String user		= clientCon.getUser();
//etc...
} catch (WDSystemLandscapeException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}

I got this code from the thread [Multiple Client Logon in JCO |;

Also have a look at this thread

[JCo Destination |;

Hope it helps!!

Warm Regards

Upendra Agrawal

Former Member
0 Kudos

Hi,

Perhaps you can try using the "new" Adaptive RFC. You will "Import" your BAPI normally into NWDS.

In your code, you could change this property directly using your Input class. Like:


Z_Get_Article_Label_Data_Input zGetArticleLabelDataInput = new Z_Get_Article_Label_Data_Input();
zGetArticleLabelDataInput.modelInstance().setJcoClient(JCO.Client);
zGetArticleLabelDataInput.modelInstance().setSystemName(String);

Hope it helps,

Daniel