Skip to Content
author's profile photo Former Member
Former Member

JCO connection to multiple R/3 Back end system

Is it possible to call same BAPI in different R/3 back end systems from a web dynpro application using Adaptive RFC model based on User selection from a dropdown list inside the application.

I can not use setSystemName method , since there is no equivalent method for changing the metadata destination.

I can not use URL Parameter sap.wdarfc.useSys , since this way I can only change to One system during start of the application .When the user selects a different system from the dropdown list , I can not point to new system.

Is there any other way ??

Thanks in advance

Regards

Bhanu Mohanty

Add comment
10|10000 characters needed characters exceeded

4 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Apr 20, 2005 at 03:57 AM

    Hi Bhanu

    Why don't you create three Adaptive RFC model's importing the same BAPI but just name them differently. And on the SLD create change the JCO destinations to the three backend SAP R/3 intances.

    Theo

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Thanks Theo

      But unfortunately I do not know the number of participating systems . It can be 3 or more. So it will not be possible for me to define so many models.

      Regards

      Bhanu

  • author's profile photo Former Member
    Former Member
    Posted on Apr 20, 2005 at 02:07 PM

    Hi Bhanu,

    You can create your own JCo destinations (eg. SAP1, SAP2, etc). In your webdynpro application, you can get the configured JCo connection and set the JCo connection to your model object and execute it.

    //Change this system name dynamically

    String strSystemName = "SAP1"; // "SAP2", etc.

    MO_Object obj_MO_Object = (MO_Object) WDModelFactory.getModelInstance(MO_Object.class, WDModelScopeType.APPLICATION_SCOPE);

    JCO.Client objJCoClient = null;

    try {

    objJCoClient = WDSystemLandscape.getJCOClientConnection(strSystemName).getClient();

    }catch (WDSystemLandscapeException e){

    // Handle your exception here

    }

    if (objJCoClient != null){

    obj_MO_SearchHelpDesc.setJcoClient(objJCoClient);

    //Execute the model object

    shlpinput.execute();

    }

    Hope this helps you.

    Regards,

    Santhosh.C

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Bhanu,

      It is possible to subvert check that causes an error, however this is rather hack then a solution. Also it requires certain coding rules.

      If you still interested in this question you may contact me via e-mail: vsilaev AT gmail DOT com

      VS

  • Posted on Dec 15, 2005 at 04:29 PM

    Hallo Bhanu,

    Unfortunately, what you are trying to do only works, if you DON’T bind your AdaptiveRFC model to the UI. This is due to the fact, that the UI requires information, such as label texts, field lengths and valuesets. Such type specific metadata is required, before you are eben able to assign the specific system, you desire to use. Therefore, the Web Dynpro runtime MUST know which system to access, when the application starts.

    A single model is not currently capable of accessing multiple backends within a single application (instance). Even if you attempt to use the same metadata destination for multiple systems, you will receive an exception.

    This is in fact a limitation of the AdaptiveRFC implementation.

    <u><i>What I would suggest doing:</i></u>

    Do not use AdaptiveRFC, but instead, use the <i>SAP Enterprise Connector</i> (in Eclipse, select <i>"New"->"SAP Connectivity"->" SAP Enterprise Connector"</i>). The SAP Enterprise Connector is based on JCO and uses the JCO client as connection (like the Adaptive RFC Model does).

    Import the appropriate RFCs into a new package of your project. As part of this import, you are asked to specify the name, which always ends with "_portType". Lets call it "Bhanu_PortType" for illustration purposes. You can then use the following code to set the JCO Client of the backend you would like:

    IWDJCOClientConnection jcoClientConn = WDSystemLandscape.getJCOClientConnection(ONE_OF_YOUR_DESTINATIONS);
        Bhanu_PortType yourProxy = new Bhanu_PortType();
        yourProxy.messageSpecifier.setJcoClient(jcoClientConn.getClient());
        ...
        //now get an instance of the input structure
        YourRFC_Input input = new YourRFC_Input();
        //now fill the input structure
        input.setFieldA(...);
        input.setFieldB(...);
        //now call the RFC and retrieve the result
        try{
          YourRFC_Output output = test.YourRFC(input);
          //here you can copy all the relevant data from 
          //the RFC to e.g. a Web Dynpro Context (ValueNode),
          //which is used to display the data
        }
        catch (Exception ex)
        {
          //...
        }

    Notice, how similar this code is to using AdaptiveRFC. That is because AdaptiveRFC is based on the SAP Connectivity Builder (or Enterprise Connector). It just adds some features and reduces some of the limitations.

    <u><b>IMPORTANT NOTE:</b></u>

    The downside of using the Enterprise Connector is that the signature of the RFC you are using MUST remain stable over releases. There is no support as in AdaptiveRFC for dictionary information, language texts, value sets, etc.

    Regards, Bertram

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Bertram Ganz

      Bertram,

      I "find" a better way to shoot myself this way:

      1. RFC_FUNCTION_SEARCH exists everywhere and has no value sets in params.

      2. Same metadata JCO connection (D_M) obtained only once

      3. Different application data destinations (D_D) used for search target.

      4. D_M points to unicode-enabled server, D_D points to non-unicode one

      5. Bang!

      😉

      So in reality it's not even risky, it's plain wrong.

      VS

  • author's profile photo Former Member
    Former Member
    Posted on Nov 02, 2006 at 10:39 AM

    Hi Bhanu!

    Hope you solved your problem. We've run into similar problem, because our productive environment features several distinct server environments with numerous clients on each server environment (worst case around 150 clients!). Although we can switch client runetime using the method suggested by Santhosh Chandran, the metadata model cannot be shared across productive environments, only within server environment as defined in the SLD.

    The solution to our problem is "Mapping Logical Systems", see:

    http://help.sap.com/saphelp_nw04/helpdata/en/af/84a34098022a54e10000000a1550b0/frameset.htm

    In this way, we can define a standard logical system which we use in our applications, and then define derived, client-specific systems for each client in the productive environment. The mapping ensures that metadata model and application model always are consistent. In fact, we really only need to define a single metadata model per productive environment in order to break the check mentioned by Valery Silaev. And then an application moder per client.

    And this actually works!

    Kind regards,

    Rasmus Ørtoft

    Add comment
    10|10000 characters needed characters exceeded