cancel
Showing results for 
Search instead for 
Did you mean: 

Switching RFC destinations dynamically

Amey-Mogare
Contributor
0 Kudos

Hello All,

I need to implement a scenario in WD Java DC where depending on user’s country & lang, I need to call ARFC2 model with different RFC Destinations.

I cannot create multiple WD Java PCD objects and pass ‘sap-wd-arfc-useSys’ parameter with suitable value.

There should be only one WD Java PCD page, and when its opened by user, maybe in defaultPlug, I need to write this logic to get user’s country and select suitable destination.

Any ideas on how this can be achieved?

Portal : NW7.4 SP9

Thanks & Regards,

Amey

Accepted Solutions (1)

Accepted Solutions (1)

former_member182374
Active Contributor
0 Kudos

Hi,

It's possible, you can set the destination name in the constructor.

Please read note: 1920259 - ARFC2: Connecting to multiple backends.

https://service.sap.com/sap/support/notes/1920259

Regards,

Omri

Amey-Mogare
Contributor
0 Kudos

Hello Omri,

Thanks for helpful reply. I think this will solve my problem.

I will try this out.

Thanks & Regards,

Amey

Answers (1)

Answers (1)

vijay_kumar49
Active Contributor
0 Kudos

Please check the below code. its may be useful : WDSystemLandscape API


boolean isconnExists = false;

         try {

  String[] connectionNames = WDSystemLandscape .getJCOClientConnectionNames(WDSystemLandscape .getCurrentJ2EEClusterName());

  for (int i = 0; i < connectionNames.length; i++)

        {   

        String connectionName = connectionNames[i]; 

              if (connectionName.equals(name))

  {   isconnExists = true;

  break;

  }

       }   

  }

  catch (WDSystemLandscapeException e1)

  {

  wdComponentAPI.getMessageManager().reportWarning("Erorr while retrieving the connection names");

  }

  if (!isconnExists)

      {

     try

     { 

         IWDJCOClientConnection connection = WDSystemLandscape .createJCOClientConnection("<<JCO ClientName>>" ,5, 10, 30, 10, "<<MessageServerName>>","<<SystemName>>", "<<LogonGroup>>", "<<Client>>", WDUserDefinitionType.getType("useDefinedUser"),"<<user>>","<<password>>", null, null, null, null, null, "en",null);

        connection.release();

      WDSystemLandscape.invalidateCache();   

     wdComponentAPI.getMessageManager().reportSuccess(("<<JCO ClientName>> + " created successfully");

                                     }

  catch (WDSystemLandscapeException e)

  {

  wdComponentAPI.getMessageManager().reportWarning(e.getMessage());

  }} else {wdComponentAPI.getMessageManager().reportWarning(<<JCO ClientName>>+ " already exists");}

Kindly let me know if you need any more information.