cancel
Showing results for 
Search instead for 
Did you mean: 

How to get JCo client number in webdynpro java model (e.g. "010")?

Former Member
0 Kudos

Hello,

I am searching for a utility class to retrieve the JCo client number configured in the WebAS destinations directly from webdynpro.
I would like to avoid to store this information in application properties, since some custom RFC's require the client (mandt) id as input parameter.
Our systems have different connection properties and it would be helpful to identify the JCo connection properties at runtime.
Are there any utilities or api's available to get this information?

Any help, is welcome.

Thanks,
Artjom

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi

see if this code can help you...

regards

yuval peery

Former Member
0 Kudos

Hi Yuval,

Thanks this was helpful, but the api used in this code is for ARFC1 and is deprecated for ARFC2.

We are running on 7.2 using ARFC2 models, so I am further looking for the equivalent api for ARFC2.

Regards,

Artjom

Former Member
0 Kudos

Hi Artjom

You can perhaps try to migrate this conntection using  this simple procedure

Please also read this.

This is a comment I found in SAP's javadoc

Deprecated. JCO destinations are not needed for new applications using Adaptive RFC 2 model, only for the Web Dynpro Adaptive RFC model which is deprecated since NW 7.11. The Adaptive RFC 2 model being the successor of Adaptive RFC uses RFC destinations configured in the NetWeaver Administrator.


Furthermore I am not sure why you need this info at all. what you are saying that you need

to find out the client number you are connected to. But... it was your application that opened

up the connection by choosing what model to use (and accordingly what JCO to use).

If the RFC are custom RFC's is it possible for your ABAP developers to forego

this parameter?

Let me suggest a simple solution and see if it fits your needs:

1. Suppose we have 2  or 3 models classes, each one is connected to a different

    system by means of  a different JCO.

2. When you call  a RFC, store client number as parameter on your context. Remember,

    each call opens up a connection through your model class. So basically you know
    exactly  in advance what client number your JCO is attached to.

3. When you want to call  an AFRC that needs the client number, all you have

    to do is to get this number from  your context.

    I hope this helps

regards

yuval

Former Member
0 Kudos

Hi Yuval,

what you describe under the point 2 is exeactly what I want to do. But I don't know the api call to get the client number, and all of my models are ARFC2 which is the main issue. I will take a look at the destination app in the nwa to see how they get/set the client number. There have to be an api how to achieve this

If you know the DC to use for such a call this would be great to know.

Thanks,

Artjom

Former Member
0 Kudos

Hi

Go to the NWA, have a look at the list of JCO's.

Each JCO connection is defined once.

Go to Maintain JCO Connection and select your JCO, say, myJco and click preview.

There you can see the client number, system name, etc.

Then go to NWDS. Right click on the model and you will know the JCO name

this model connects to. That's it. Nothing is erratic or done randomly.

Now in your code, YOU decide to which model you wish to connect.

So you obviously have all the details in advance.

regards

yuval

Former Member
0 Kudos

Hi Yuval,

sorry if any confusion came up here.

To clarify.

We have DEV and PROD WebAS instances

The JCo destinations WD_MODELDATA_DEST and ..META.. are defined via NWA in these systems.

On the DEV system they are referencing a DEV ERP system credentials D00/030

On the PROD system the reference PROD ERP system credentials  P00/010

Some custom RFC require however the client number (030, 010) as input.

I don't want to statically fix this in parameters or even change something after deployment to different systems.

The only thing required is to retrieve the client number based on the environment DEV or PROD.

From the model I use I can get the defined destination name, but I don't know hot to get the JCo properties from here including the client number.

I hope this helps to understand my issue.

Thanks,

Artjom

Former Member
0 Kudos

Hi

Try this:

If you call your model 'MyModel'

in your code put this code

MyModel myModel = new MyModel();

myModel.getJCOClient().getSystemNumber();

myModel.getJCOClient().getSystemID();

or anything you like

regards

yuval

Answers (0)