cancel
Showing results for 
Search instead for 
Did you mean: 

How to open a URL on the click of a button?

Former Member
0 Kudos

Hi,

I need to open a URL (for PrintView), on the action of a button. I cn't use LinkToUrl as its not possible to associate an action on its click. How can i do that?

Regards,

Smriti

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

First u have to create outbound plug in interfaceview

1)Open the node WebDynpro -


> Web Dynpro Components -


> <ComponentName> -


> Component Interface -


> Interface Views in that click <interfacename> interface view .

2) Select the Plugs tab in the Plugs area.

3)Choose New next to the outbound plug table.create new outbound plug.for example,Name GotoUrl, and choose Type Exit Plug.

4)Select the new outbound plug GotoUrl and choose New next to the parameter table.taEnter the name Url datatype as STRING.

5)Open the view in the View Designer and select the Properties tab. Choose Add next to the Required Controllers table and add the <interface name>InterfaceView

Place 1 button and check,

onActionButton write this code

{

wdThis.wdGetSampleInterfaceViewController().wdFirePlugGotoUrl(

"http://www.google.com");

}

Former Member
0 Kudos

Hi Suresh,

I tried it but i am getting this error:

com.sap.tc.webdynpro.services.exceptions.WDRuntimeException: Cannot exit embedded component via outbound plug GoToPrintUrl of view <ComponentName>InterfaceView

at com.sap.tc.webdynpro.progmodel.view.ViewManager.fireExitPlug(ViewManager.java:200)

Regards,

Smriti

Message was edited by:

Smriti Behl

former_member751941
Active Contributor
0 Kudos

Hi Smriti,

Inside the action of the button try this.

try {

String linkToBeOpen =

WDURLGenerator.getWebResourceURL(

wdComponentAPI.getComponent().getDeployableObjectPart(),

"<put the URL here>");

IWDWindow window =

wdComponentAPI.getWindowManager().createNonModalExternalWindow(

linkToBeOpen,

"My window title");

window.show();

} catch (WDURLException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

Regards,

Mithu

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Behl..

try this link..

https://www.sdn.sap.com/irj/sdn/forums

this will help..

Urs GS