cancel
Showing results for 
Search instead for 
Did you mean: 

Calling WebDynpro Application and Passing parameters

sid-desh
Advisor
Advisor
0 Kudos

Hi,

I want to call a webdynpro application from another application and also i want to pass parameters to the called webdynpro application.

Is there an example on SDN which shows how this can be done. If not please advise how this can be done.

Thanks and Regards

Sidharth

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hello,

We are soon going to post a tutorial on SDN on exactly this issue. I will update this thread with the link as soon as it is available.

Regards,

Pranav

> Hi,

>

> I want to call a webdynpro application from another

> application and also i want to pass parameters to the

> called webdynpro application.

>

> Is there an example on SDN which shows how this can

> be done. If not please advise how this can be done.

>

> Thanks and Regards

> Sidharth

Answers (4)

Answers (4)

sid-desh
Advisor
Advisor
0 Kudos

Hi Bertram/Stefan,

I checked out the sample application that was given and it has almost solved my problem except that i need to put the two applications in two separate WebDynpro Projects.

Is there any way to achieve this.

Please give you suggestions on this.

Thanks and Regards

Sidharth Deshpande

BeGanz
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hallo Sidharth Deshpande,

instead of referencing the Deployable Object containing the start application (wdComponentAPI.getDeployableObjectPart().getDeployableObjectName()) you can directly reference the Deployable Object Part of the target application in another Deployable Object via

WDDeployableObject.getDeployableObjectPart(java.lang.String objectName, java.lang.String partName, WDDeployableObjectPartType partType)

Parameters:

objectName - the name of the deployable object (full qualified name of other DC)

partName - the name of the deployable object part (name of target Web Dynpro Application)

partType - the type of the deployable object part (WDDeployableObjectPartType.APPLICATION)

Greetings, Bertram

sid-desh
Advisor
Advisor
0 Kudos

Hi Bertram,

Thanks for the reply

Will try that out. But one thing when you say fully qualified name it is <provider name>/<project name>

for eg <sap.com/webdynpro object>

Regards

Sidharth

Former Member
0 Kudos

Hi Sidharth,

the objectname is the fully qualified name of the deployable object, e.g. "provider/web dynpro project name". For non DC projects, it is something like "local/MyProject".

The partName is the fully qualified component name, e.g. "com.sidharth.wd.MyComponent". The name is identical to the fully qualified name of the Component Controller of a component.

The partType is "WDDeployableObjectPartType.COMPONENT".

Hope that helps.

Best regards

Stefan

Former Member
0 Kudos

Hi Sidharth,

Did the replies help? They looked good. If so, don't forget to assign points. I gave them some, but feel free to change them! Click on the Yellow Star icon in each reply. You can give:

1 10 pointer (solves problem)

2 6 pointers (very helpful)

lots of 2 pointers (helpful)

Thanks!

Joan (and Mark Finnern)

sid-desh
Advisor
Advisor
0 Kudos

Hi Stefan,

Thanks for the guidelines. Will try the example out and get back to you.

Thanks a lot

Regards

Sidharth

sid-desh
Advisor
Advisor
0 Kudos

Hi Pranav,

That will really be helpful. Looking fwd to it.

Can you just let me know by when this tutorial will be available.

Regards

Sidharth

Former Member
0 Kudos

Hi Sidharth,

until the tutorial is available, here's a step by step guide.

1. Create an outbound exit plug, for example "CallApp" in an interface view controller belonging to the calling component.

2. Add a string parameter 'Url' to the plug "CallApp". It's important that the parameter starts with uppercase 'U'.

3. Declare a controller usage of the interface view controller for the view controller, which will fire the plug.

4. Add an action to the calling view controller.

5. Add the following code snippet to the method body of the action handler. Change the application name "CalledApp" to the name of your called application and the wdThis.wdGet<YourInterfaceView>Controller().wdFirePlugCallApp(url) so that it matches the names you defined. The example will not work, if the application is not part of the deployable object the calling component resides in.

IWDDeployableObject componentDPO = wdComponentAPI.getDeployableObjectPart().getDeployableObject();
String appName = "CalledApp";

WDDeployableObjectPart[] applicationParts = componentDPO.getParts(WDDeployableObjectPartType.APPLICATION);
WDDeployableObjectPart appPart = null;
for (int idx = 0; idx < applicationParts.length; idx++) {
  appPart = applicationParts[idx];
  if (appPart.getShortName().equals(appName)) {
    break;
  }
  appPart = null;
}
if (appPart == null) {
  throw new WDRuntimeException(
    "The application: " + appName + " is not a part of: " + componentDPO.getName());
}
Map urlParameters = new HashMap(1);
urlParameters.put(ClientConstants.APPLICATION_PREFIX + "Param1", "Parameter sent by caller.");

try {
  String url = WDURLGenerator.getApplicationURL(appPart, urlParameters);
  wdThis.wdGet<YourInterfaceView>Controller().wdFirePlugCallApp(url);
} catch (WDURLException e) {
  throw new WDRuntimeException(e);
}

6. Add a string value attribute named "ReceivedParameter" to the context of the component controller owning the target interface view.

7. Declare a controller usage of this component controller for the target interface view controller.

8. Add a startup plug to the target interface view controller. Add a parameter ("Param1" in this example) to the plug. It's important, that the name of the plug parameter is the same (case sensitive) as used for the URL generation.

9. Add the following to the method body of the startup plug handler:

wdThis.wdGet<YourComponent>Controller().wdGetContext().currentContextElement().setReceivedParameter(Param1);

10. To check, if the parameter passing works, map a value attribute in a view controller to the component controller context and bind e.g. the text property of a TextView to that attribute.

Hope that helps.

Regards

Stefan

BeGanz
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hallo,

the constant ClientConstants.APPLICATION_PREFIX you use in your sample code is not part of the public Web Dynpro API provided for the Web Dnypro application development.

Never ever use framework internal classes. The SAP AG does not support such coding because it is not part of the public API.

The prefix 'app.' has to be added to the URL-parameter in the Sneak Preview version of the SAP Web AS and can be omitted starting with SAP NetWeaver 04 Stack 03.

You can download the new Inter-Application-Navigation tutorial from SDN under

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sapportals.km.docs/documents/a1-8-4/inter... in web dynpro.pdf

Greetings, Bertram

Former Member
0 Kudos

Hi Bertram,

of course you're right. The sample is actually a rather old one i copied from a previous thread (for German insiders: Das ist mir so durchgerutscht).

Best, Stefan