cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple Client Logon in JCO

Former Member
0 Kudos

Dear All,

We import an RFC as a Model and the names used for the connections are used to create JCO connections in the WEB AS.

However we have a need where we will know the SAP Client number only on the runtime. This means that the JCO connections can not be pre created in the WEB AS.

To solve this i tried the following solution:

I created 2 JCO connections for 2 different client Numbers in WEB AS. After importing the RFC i went to the class file where the connection name is mentioned. I applied a condition by coding to choose one of the JCO Connections which i created programatically. However when i rebuild the project this complete code is overwritten to the connection name specified in the wizard during the RFC model import.

Can anyone suggest answers for the following ?

- How can i manipulate the connection name of the JCO in code without being overwritten during rebuild ?

- Do you know of any other ways other of achieving my objective of connecting to multiple clients and deciding the connection name on the runtime?

Kind Regards,

Mukesh

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Mukesh,

Refer the following articles to understand how to establish a connection to an SAP Server through SAP JCo Client Programming.

1.)<a href="http://help.sap.com/saphelp_nw2004s/helpdata/en/9d/14e13d8ee4535ee10000000a114084/frameset.htm">Direct Connections</a>

2.)<a href="http://help.sap.com/saphelp_nw2004s/helpdata/en/9d/14e13d8ee4535ee10000000a114084/frameset.htm">Connection Pools</a>

Note: Refer the examples for each of the options: Example Program Connect1, Example Program Connect2.

Bala

Former Member
0 Kudos

Bala,

Is it possible to connect the JCO at runtime in the Dynpro Application running in portal using this coding.

Kind Regards

Mukehs

Former Member
0 Kudos

Mukesh,

All the WD applications that works well as seperate entities, will work in portal environment. So, that should be same for this case as well.

Bala

Former Member
0 Kudos

Hi Bala,

In My situation all BAPIs are imported as Model. And maintain the JCO in content Administrator.

Now the Requirement is occording to the condition the RFC call is made to particular client(SAP) 100 or 750 or 999 decide at runtime.

How it could be possible to make different call for the same JCO.or any other setting is need to be handled?

Kind Regards

Mukesh

Former Member
0 Kudos

Hi Mukesh,

Let's say you have created the JCo clients basedon the clients fetched during runtime using JCo.createClient() method.

Now you can set the client to be used dynamically. USe a code like this:

Let's say the name of your model is FetchListOfMaterials.


FetchListOfMaterials getModel = (FetchListOfMaterials)com.sap.tc.webdynpro.progmodel.model.api.WDModelFactory.getModelInstance(FetchListOfMaterials.class,WDModelScopeType.TASK_SCOPE);
getModel.setJcoClient(<your client>);

Regards,

Satyajit.

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Satyajit,

Suppose UME is configured in LDAP server with SSO enabled in portal for JCO connections.Is there any possiblity to get the User Details like ClientNumber, UserName, Password, Language, SystemIP, SystemID when he logged on the portal, so that these credentials can be made use in the coding to establish JCO at runtime.

Kind Regards

Mukesh

Former Member
0 Kudos

Hi Mukesh,

If you already have a JCo connection created based on the LDAP credentials, you can fetch the details like 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();
}

Is this what you are looking for?

Regards,

Satyajit.

Message was edited by: Satyajit Chakraborty