cancel
Showing results for 
Search instead for 
Did you mean: 

Open a URL in the same window

Former Member
0 Kudos

Hi,

My objective is to open a URL when i click on a webdynpro iView in the same window.

I created a outbound plug in the InterfaceViewController.

And wrote this piece of code in wdDoBeforeNavigation() in Component controller.

wdThis.wdGetExternalComponentInterfaceViewController().wdFirePlugGoToUrl(Url);

Where "Url" is a string variable contaning the value.

But when i run this piece of sode it gives exception

"Exit-Plug must no be triggered with an URL when running in portal. Use portal navigation instead to navigate to another application!"

So what should i do solve this problem

Regards,

Paresh

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

HI,

Procudere to create the LogoffURL

In the Application properties add your URL name.

LogoffURL = http:
www.google.com

1. Define an exit plug in the interface view of your Web Dynpro component:

a. Enter a name and check the checkbox Exit Plug.

b. Enter the name Url for the parameter and select string as the type.

This parameter is case-sensitive and must be entered exactly this way.

2. In your view, define the action Exit and add the event handler onActionExit().

3. In the view layout, define a button and bind its onAction event to the Exit action.

4. In your view, define the use of the interface view controller of your Web Dynpro component under Properties.

5. Insert the following code in this method of the implementation:

String logoffURL = wdComponentAPI.getApplication().getApplicationInfo().findInApplicationProperties("sap.logoffURL").getValue();

wdThis.wdGetTimeCompInterfaceViewController().wdFirePlugExit(logoffURL);

OR Do u need to generate the URL by using the application?

Thanks,

Lohi.

Former Member
0 Kudos

Hi Lohi,

Thanks for ur immeditate reply. but the method u told is useful if i know my URL at the design time,but that is not the case.

I am generating the URL using my application.Depending on the <u><b>user</b></u> i am adding many values to the URL. so that atlast i am getting a complete URL.

Now i want to open this URL in the same window. I dont have any buttons which will raise the event. i am not creating any UI elements in the view.

Is it possible to set the LogoffURL value at runtime? i tried it but not successful.

It throws a exception when i write

wdComponentAPI.getApplication().getApplicationInfo().findInApplicationProperties("sap.logoffURL").setAttributvalue("Value",Url);

Where Url is the string which contains the final value.

Hope you have understood what i am trying to do. In case u want any more information, please let me know.

Regards

Paresh

Former Member
0 Kudos

Hi,

Generate the Url dynamically by using the deployable Object and pass to the exit plug param in the init the method of the View.Then it automatically created.

If you need more info post ur isseues.

Thanks,

Lohi.

Former Member
0 Kudos

Lohitha,

Simplified version of step [5]:

wdThis.wdGetTimeCompInterfaceViewController().wdFirePlugExit(null);

Check API docs -- you may skip reading URL defined as logoff URL and simply pass null.

Valery Silaev

SaM Solutions

http://www.sam-solutions.net

Former Member
0 Kudos

Paresh,

There is no way to alter application parameters, they are read-only at run-time. Instead:

1. Get default logoff URL from parameters

2. Use WDURLGenerator service to compose new URL (tou may pass aditional parameters as Map)

3. Pass new generated URL to exit plug.

Valery Silaev

SaM Solutions

http://www.sam-solutions.net

Former Member
0 Kudos

Hi Valery,

As u said i tried out this piece of code in the wdDoBeforeNavigation( ) in component controller.

String urlobject = WDURLGenerator.getAbsoluteWebResourceURL(Url);

wdThis.wdGetExternalcompInterfaceViewController().wdFirePlugGoToUrl(urlobject);

But this is also showing the same problem. It is throwing an exception when i am trying to fire.

Exit-Plug must no be triggered with an URL when running in portal. Use portal navigation instead to navigate to another application!<b></b>

Please tell, if i am doing something wrong.

Regards

Paresh

Former Member
0 Kudos

Hi Lohi,

Please can you elaborate the method you told by an example.

But let me tell u that i want to open the URL in component controller. so therfore i use the wdDoBeforeNavigation() to fir the outbound plug.

Now let me tell u something. when i am writing

wdthis.wdget<application>Interfaceviewcontroller.wdFirePlugGoToUrl("http://www.google.com");

And running the application the google page opens up.

But when i create a web dynpro iView of the application and open it in the portal it gives exception:

"Exit-Plug must no be triggered with an URL when running in portal. Use portal navigation instead to navigate to another application!"

This was working in earlier version perfectly but in EP7 it gives exception.

So please tell me, if u know a method to solve this problem

Regards

Paresh

Former Member
0 Kudos

Paresh,

I'm not a portal expert, but it seems you need something like this:


import com.sap.tc.webdynpro.clientserver.portal.WDPortalUtils;
import com.sap.tc.webdynpro.clientserver.navigation.api.WDPortalNavigation;

...

if ( ! WDPortalUtils.isRunningInPortal()  ) { // standalone mode
  wdThis
    .wdGetExternalcompInterfaceViewController()
      .wdFirePlugGoToUrl(urlobject);
} else { // portal iView mode
  WDPortalNavigation.navigateAbsolute(
    ... /*set of parameters that I do not understand 😉 */
  );
}

Check SAP documentation that explains usage of WDPortalNavigation.

Valery Silaev

SaM Solutions

http://www.sam-solutions.net

Former Member
0 Kudos

Hi lohitha,

I am not able to find, where are the application properties?

how can i add logoffUrl ?

Please explain how to add logOffUrl to application proeperties in details.

Regards

Bala

Former Member
0 Kudos

Hi Lohitha,

I have requirement of opening a URL in the same view.

I have created a menu in WebDynpro and added menu items.

I have added MenuActionItem. I have to display the URL when we click on that ActionItem in the same View.

Just like normal browser favorites. When we click on favorites the url opens in the same window.

I have the similar kind of requirement.

I need to display the url within the same window.

I tried with this code but it disaplays in other window.

String linkToBeOpen = "https://www.sdn.sap.com/irj/sdn";

IWDWindow window =

wdComponentAPI.getWindowManager().createNonModalExternalWindow(

linkToBeOpen,

"My window title");

window.show();

How to implement my requirement, Please send the detail procedure.

Regards

Bala

Former Member
0 Kudos

Hi all,

I am stuck up with the same Situation.I need to open a webdynpro Abap link on action of a button in the same window. So i created a Action Button and i have attached a Fire plug also and set properties as String for that fire plug. The code looks Like this:

public void onActionBackToLandingPage(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )

{

//@@begin onActionBackToLandingPage(ServerEvent)

* String Url ="http://sapdv.joa.com:8000/sap/bc/webdynpro/sap/zhr_enroll_land?sap-system-login-basic_auth=X&sap-client=150&sap-language=EN";*

wdThis.wdFirePlugGoToUrl(Url);

//@@end

}

When i am runing the application i am getting an error as follows.

"com.sap.tc.webdynpro.services.exceptions.WDRuntimeException: Cannot navigate via outbound plug GoToUrl of view BizCardsView because there is no navigational link attached to it :"

I am bot able to Call this also

wdThis.wdGetExternalComponentInterfaceViewController().wdFirePlugGoToUrl(Url);

Please let me know what i am missing in it.

Thanks

Ravi Sunkara

Answers (2)

Answers (2)

former_member192152
Active Participant
0 Kudos

you need to create de outBoundPlug in Interface view, type Exit with parameter (name "Url" and type "String")!

in the tab properties in your view add interface view reference.

fire the plug: wdThis.wdGetMyAppInterfaceViewControlller.wdFirePlugUrl(Url);

att,

Angelo

Former Member
0 Kudos

Hi

Since you want to open the URL as soon as you click the view.

I guess code has to be written in DoInit Method. If the url information is present in the Web Dynpro application 's Init Method, the define Interface View controller in ur View properties. And then write in following manner in DoInit Method.

string Url ="http://www.google.com".

wdThis.wdGetExternalComponentInterfaceViewController().wdFirePlugGoToUrl(Url);

or Else, if you use IFrame Element (with proper sizing, and attach its source to value attribute of type string say (UrlValue)

Then, the Url is opened in the Web Dynpro View on click of it.

Thanks

Srikant

(P.S. Please tell us if this has helped you or not)