cancel
Showing results for 
Search instead for 
Did you mean: 

table Onlead Select action leads to PopUp Window

Former Member
0 Kudos

Hi

Can any tell me how create a popupwindow when we select a row in Table? I reffered popup windows tutorials and coded but its giving null pointer exception.

Can anybody help me?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Can you please paste your code here?

Thanks and Regards

Avijit

Former Member
0 Kudos

Hi Avijit Dhar

This is my code

IWDWindowInfo windowInfo = (IWDWindowInfo)wdComponentAPI

.getComponentInfo()

.findInWindows("PopupWindow");

// create the ?PopupWindow?

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().setWindowInstance(window);

I placed this code inside Onlead select action.

I also reffered tutorials sent by Ashwin. I followed same.

Please suggest me if there is any mistake in code.

former_member186016
Active Contributor
0 Kudos

Hi,

Can you please post the stack trace showing NullPointerException.

Also post the code at that line.

Ensure that before calling wdContext.currentPopupElement() [in last line in piece of code posted by you ] you have initialized the PopupElement.

Regards,

Ashwani Kr Sharma

Former Member
0 Kudos

HI Ashvani

My code in first view is

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

{

//@@begin onActionleadselect(ServerEvent)

// Window PopUp Window

IWDWindowInfo windowInfo = (IWDWindowInfo)wdComponentAPI

.getComponentInfo()

.findInWindows("PopUp");

// create the PopUp Window

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().setWindowInstance(window);

//@@end

}

My stack trace is

java.lang.NullPointerException

at com.stepan.comp.DashBoardView.onActionleadselect(DashBoardView.java:172)

at com.stepan.comp.wdp.InternalDashBoardView.wdInvokeEventHandler(InternalDashBoardView.java:204)

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)

at com.sap.tc.webdynpro.clientserver.window.WindowPhaseModel.processRequest(WindowPhaseModel.java:132)

at com.sap.tc.webdynpro.clientserver.window.WebDynproWindow.processRequest(WebDynproWindow.java:335)

at com.sap.tc.webdynpro.clientserver.cal.AbstractClient.executeTasks(AbstractClient.java:143)

at com.sap.tc.webdynpro.clientserver.session.ApplicationSession.doProcessing(ApplicationSession.java:299)

at com.sap.tc.webdynpro.clientserver.session.ClientSession.doApplicationProcessingStandalone(ClientSession.java:759)

at com.sap.tc.webdynpro.clientserver.session.ClientSession.doApplicationProcessing(ClientSession.java:712)

at com.sap.tc.webdynpro.clientserver.session.ClientSession.doProcessing(ClientSession.java:261)

at com.sap.tc.webdynpro.clientserver.session.RequestManager.doProcessing(RequestManager.java:149)

at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doContent(DispatcherServlet.java:62)

at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doPost(DispatcherServlet.java:53)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:401)

at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:266)

at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:387)

at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:365)

at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:944)

at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:266)

at com.sap.engine.services.httpserver.server.Client.handle(Client.java:95)

at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:160)

at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)

at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)

at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)

at java.security.AccessController.doPrivileged(Native Method)

at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:100)

at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:170)

Former Member
0 Kudos

What is "currentPopUpElement()"? To store the window instance, you don't need a node but an attribute, say "PopupWindow":

wdContext.currentContextElement().setPopupWindow( windowInstance );

Or set cardinality=1:1 and selection=1:1 for your node "PopUp".

Armin

Former Member
0 Kudos

Thanks a lot by setting cardinality I was able to fix my problem. Now its working fine.

Can you tell how to close Popup? I added custom button and action with distroy window method. But I am getting exception.

Former Member
0 Kudos

Please post the code of the event handler and the stacktrace.

It should look like

void onActionClosePopup(...)
{
  IWDWindow win = wdContext.currentPopUpElement().getWindowInstance();
  if (win != null)
  {
    wdContext.currentPopUpElement().setWindowInstance(null);
    win.destroy();

  }
}

Armin

Former Member
0 Kudos

Thanks for quick reply but its not working (No error) when I added this in PopUp window.

Where should I write this code?

Former Member
0 Kudos

Add a "Close" button to the view that is embedded in your popup window. Assign an action "ClosePopup" to this button and put the code in the action handler.

Put the node "PopUp" in a controller that is visible from both views, the view where the popup is opened and the popup view itself. This can be achieved by putting the node into the component controller context and mapping it from both view controllers.

Armin

Former Member
0 Kudos

Thanks my problem resolved. So I am closing this thread.

Answers (1)

Answers (1)

former_member186016
Active Contributor
0 Kudos

I hope you are referring to the tutorial at following location:

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/49f2ea90-0201-0010-ce8e-de18b94a...

Most probably the value read by you from Table is not correct and it is null. Hence the null pointer exception is coming.

Did you tried the application is at following location: [It is application from same tutorial] It works perfect

https://www.sdn.sap.com/irj/sdn/softwaredownload?download=/irj/servlet/prt/portal/prtroot/com.sap.km...

Regards,

Ashwani Kr Sharma

Former Member
0 Kudos

Ya no esta el enlace de descarga