cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic JCO Client

Former Member
0 Kudos

Hi,

there is a way to create a dynamic JCO.Client?

I have this code:


JCO.Client jcoclient =   JCO.createClient(

				 "data",

				"data",

				 "password",

				 "it",

				"10.140.5.122",

				"12");

		jcoclient.connect();

I want to get dynamically from the system the parameters for method "createClient". It's possible??There is a way??

THANS

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi,

I want to get it directly from the r/3 system in witch the application run. It's possible????

I dont think that its possible to get the details.

Regards

Ayyapparaj

Stefan-EA
Contributor
0 Kudos

I assume your java application is running on a NetWeaver Web AS?

Former Member
0 Kudos

yes !!!

Stefan-EA
Contributor
0 Kudos

Then the Destination Service API is what you want to use. It will handle the connections to your R/3 system

Stefan-EA
Contributor
0 Kudos

>

> Hi,

> there is a way to create a dynamic JCO.Client?

> I have this code:

>

>

> I want to get dynamically from the system the parameters for method "createClient". It's possible??There is a way??

> THANS

To avoid hard coding the JCO connection details, take a look at the [Destination Service API|http://help.sap.com/saphelp_nw04/helpdata/en/8b/8e7dac1e661d44bf2a676fd3948cc6/frameset.htm].

Here is a [blog|https://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/10300] on how to use the SAP Enterprise Connector (which is used to call JCOs) with the Destination Service API. Once the Destination service is set up, you can then create your JCO.client as follows

final InitialContext ctx = new InitialContext();
   
final DestinationService dstService = (DestinationService)ctx.lookup(DestinationService.JNDI_KEY);
 
if (dstService == null)
  throw new NamingException("Destination Service not available");
    
RFCDestination dst;

// get the ERPR3 destination created in visual administrator
  
dst = (RFCDestination) dstService.getDestination("RFC", "ERPR3");
Properties jcoProperties = dst.getJCoProperties();  


//Establish a direct connection

JCO.Client client = JCO.createClient(jcoProperties);
client.connect();

Former Member
0 Kudos

Hi,

I am not sure about your requirement

following method may be of use

JCO.createClient(properties)

Create a properties file and use this for the details

Regards

Ayyapparaj

Former Member
0 Kudos

I want to get it directly from the r/3 system in witch the application run. It's possible????

Former Member
0 Kudos

*