cancel
Showing results for 
Search instead for 
Did you mean: 

Link To Action

Former Member
0 Kudos

Hi,

When I click on the link to action i want to display the view in a diffent window. how can do it can any one help me in this.

Regards,

H.V.Swathi

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

hi,

to the onAction of the LinkToUrl bind a method -


in the impl of dat method use this code

IWDWindowInfo windowInfo = (IWDWindowInfo)wdComponentAPI.getComponentInfo().findInWindows("MyWindow");

IWDWindow window = wdComponentAPI.getWindowManager().createWindow( windowInfo, true);

window.setWindowPosition(300, 150);

window.open();

wdContext.currentPopupElement().setWindowInstance(window);

Embed ur view in a window---here the name of dat window is MyWindow

Regards

Jayapriya

Former Member
0 Kudos

Thank u .

But what is that currentPopupElement();

Can u tell me.

Regards,

H.V.Swathi

former_member201361
Active Contributor
0 Kudos

Hi Swathi,

PopUp is the node which has a Attribute say WindowInstance of type IWDWindow.

in the LinkToAction , Action method u have set the Window instance in the Attribute"WindowInstance" and finally when u are closing that window , u have delete the Window instance .

refer this link for External Window

[http://help.sap.com/saphelp_nw04/helpdata/en/fd/024640c0e56913e10000000a1550b0/content.htm]

Thanks and regards

sanyev
Active Participant
0 Kudos

Hi Swathi,

If you just want to open a popup window you can go through this post where I have explained step by step how to open a popup window.

[;

You can also go through this tutorial on creating popup window.

[https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/20d2def3-f0ec-2a10-6b80-877a71eccb68]

Hope this helps,

Sanyev

Former Member
0 Kudos

Hi,

I am getting this error when i run the application.

The initial exception that caused the request to fail, was:

com.sap.tc.webdynpro.services.exceptions.WDRuntimeException: Parameter windowInfo must not be null.

at com.sap.tc.webdynpro.clientserver.cal.ClientComponent.createModalWindow(ClientComponent.java:1020)

at com.sap.travel.EtrecViewExpenseView.onActionSupportingDocument(EtrecViewExpenseView.java:210)

at com.sap.travel.wdp.InternalEtrecViewExpenseView.wdInvokeEventHandler(InternalEtrecViewExpenseView.java:215)

at com.sap.tc.webdynpro.progmodel.generation.DelegatingView.invokeEventHandler(DelegatingView.java:87)

at com.sap.tc.webdynpro.progmodel.controller.Action.fire(Action.java:67)

... 27 more

See full exception chain for details.

Regards,

H.V.Swathi

chander_kararia4
Contributor
0 Kudos

Hi Swathi,

You are getting this exception coz the Window Name you mentioned is not correct.

or

may be the you are not getting the hold on the window name.

try printing the window name before you do anything else.

Regards

Chander Kararia

Former Member
0 Kudos

1) You have specified invalid Window name to IWDWindowInfo


IWDWindowInfo windowInfo = (IWDWindowInfo)wdComponentAPI.getComponentInfo().findInWindows(<Window Name>);

2) You have to get a reference of created window in to context for future accesses such as close popup/access its Title etc.. . For this purpose use the code


IWDWindow window = wdComponentAPI.getWindowManager().createWindow( windowInfo, true);
wdContext.currentPopupElement().setWindowInstance( window);

vinod v

former_member201361
Active Contributor
0 Kudos

Hi Swathi,

Then entered window name is not correct , due to this windowInfo is null.

Give the Window name with same case as in the web dynpro explorer -- >Ur component > Windows> Ur window.

Thanks and Regards'

sanyev
Active Participant
0 Kudos

Hi Swathi,

Have you created a new Window? The new view that you want to show as a popup should be created first. now a new window has to be created. Lets say the name is "popupWindow". You have to embed the newly created view to this window. once this is done. Then you have to write code to popup the window. See my previous post to know where to write the code.

IWDWindowInfo windowInfo = (IWDWindowInfo)wdComponentAPI.getComponentInfo().findInWindows("popupWindow");

IWDWindow window = wdComponentAPI.getWindowManager().createWindow( windowInfo, true);

Hope this helps

Sanyev

Former Member
0 Kudos

Hi,

I have done all the things and i am geetting this error

when i click the button where the action to go next window is written.

java.lang.NullPointerException

at popup.EmailView.onActionShowAddressbookPopup(EmailView.java:174)

at popup.wdp.InternalEmailView.wdInvokeEventHandler(InternalEmailView.java:192)

at com.sap.tc.webdynpro.progmodel.generation.DelegatingView.invokeEventHandler(DelegatingView.java:87)

at com.sap.tc.webdynpro.progmodel.controller.Action.fire(Action.java:67)

at com.sap.tc.webdynpro.clientserver.window.WindowPhaseModel.doHandleActionEvent(WindowPhaseModel.java:420)

... 26 more

Reagards,

H.V.Swathi

sanyev
Active Participant
0 Kudos

Hi Swathi,

You are getting getting a null pointer exception at at EmailView.java: line174. Can you post what is the contents of that line?

Please see the post []. Here towards the end of the post I have mentioned exactly where you need to write the code for the popup to work properly.

In your case your onActionShowAddressbookPopup() method should look something like this.

//This is on the main view controller
public void onActionShowAddressbookPopup(){
/*
  Write code to do business logic
*/
//Launch popup window
wdThis.wdGetComponentController().showPopup();
}

Some thing in your onActionShowAddressbookPopup() line 174 is giving you a null pointer exception. if you need help on that just post the contents of the line 174.

Regards,

Sanyev

Former Member
0 Kudos

Hi,

Here is the code. And i realy want your help.

IWDWindowInfo windowInfo =
			(IWDWindowInfo) wdComponentAPI.getComponentInfo().findInWindows(
				"AddressbookWindow");
		//create the u201CAddressbookWindowu201D
		IWDWindow window =
			wdComponentAPI.getWindowManager().createWindow(windowInfo, true);
		//set the WindowPosition on the screen
		window.setWindowPosition(300, 150);
		//and show the window
		window.open();
		// Save WindowInstance in Context
		wdContext.currentPopUpElement().setWindowInstence(window);

former_member201361
Active Contributor
0 Kudos

Hi swathi,

ur code is correct and please check the window name whether u have given correcy name (case sensitive).

can u tell in which line, exception occurs. (check the window name ).

Thanks and regards

sanyev
Active Participant
0 Kudos

Hi Swathi,

I guess you have written the popup launching code in your view action handler. I would recommend that you write this code in your component controller.

Your onActionShowAddressbookPopup() implementation in your view controller would look some thing like this

//This is on the main view controller
public void onActionShowAddressbookPopup(){
//Launch popup window
wdThis.wdGetComponentController().showPopup();
}

In your component controller context directly under context create an attribute "popupWindow" of type IWDWindow.

Context(Top level)

--popupWindow(attribute)

create a method in your component controller for showing the popup

public void showPopup(){
   IWDWindowInfo windowInfo = 
           (IWDWindowInfo)wdComponentAPI.getComponentInfo().findInWindows("AddressbookWindow");
 IWDWindow window = wdComponentAPI.getWindowManager().createModalWindow(windowInfo);
 window.setWindowPosition (300, 150);
 window.show();
 wdContext.currentContextElement().setpopupWindow(window);
}

Similarly create one more method in your component controller to hide the popup window.

public void hidePopup(){
    IWDWindow window =  wdContext.currentRootElement().getpopupWindow();
    window.hide();
}

Finally in your popup window view there should be some way to close the popup. Assuming it is a button "Close".

In the action handler for the button close call the hidePopup() method of the component controller.

//This is on the popup view controller
public void onActionCloseButtonClicked(){
//close popup window
wdThis.wdGetComponentController().hidePopup();
}

Things to remember

1. You window has to be in the same component. (View can be an interface view from a different component but should be embedded in the newly created window for popup)

2. The window name given in the code should be exactly the same windows name otherwise the windowInfo will be null.

If you follow the above instructions your popup should work fine.

Hope this helps.

Regards,

Sanyev

Former Member
0 Kudos

Please locate the line number 174 in EmailView.java and send that piece of code to us.

vinod v

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Swathi,

Have you created the new window as mentioned like " mypopwindow ". without this it will give you null pinter exception.

Or else can you provide us the code you have written so that we can check where you missed something.

Regards

Narendra

Former Member
0 Kudos

Hi,

In the implementation of the action associated with the UI element you can write a code for a popup window where you can code for the action to be performed on the popup.


IWDWindowInfo info=wdComponentAPI.getComponentInfo().findInWindows("WindowName");
	IWDWindow pop1=wdComponentAPI.getWindowManager().createNonModalExternalWindow("http://www.google.com","google");
	pop1.setWindowSize(512,600);
	pop1.setWindowPosition(50,100);
	pop1.show();

Here WindowName is the name of the window other than your main window.

Something similar to this can be worked out.

Regards.

Rajat