cancel
Showing results for 
Search instead for 
Did you mean: 

ERROR LIKE:java.lang.NullPointerException

Former Member
0 Kudos

HI All,

I developed one DC,my requirement is i want to show the POPUP box when i am clicking on the LinkAction,my popup box contains Close button for closing popup ,here popup is opening but when i am clicking on the close button popup should be closed,but popup is not closing i am getting error like:

java.lang.NullPointerException

at session.com.Targetpopup.onActionback(Targetpopup.java:146)

at session.com.wdp.InternalTargetpopup.wdInvokeEventHandler(InternalTargetpopup.java:140)

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

Edited by: Rama krishna.T on Nov 17, 2011 10:19 AM

Accepted Solutions (1)

Accepted Solutions (1)

Qualiture
Active Contributor
0 Kudos

What is your line of code at Targetpopup.java, row 146?

Former Member
0 Kudos

Thank you Robin

IWDWindow window = wdContext.currentContextElement().getWindow(); 145 line

window.destroy(); 146 line

Edited by: Rama krishna.T on Nov 17, 2011 11:15 AM

Qualiture
Active Contributor
0 Kudos

The error message would suggest the 'window' attribute in your context is not set, and thus resulting in the Nullpointer exception

Former Member
0 Kudos

Thank you Robin

Should i set from code or mapping ?

junwu
Active Contributor
0 Kudos

code is required to store the window instance in the context attribute

when you close window, you have to retrieve the window instance from the attribte again.

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Ramakrishna,

Please create a context attribute "WindowInstance" of type IWDWindow.

Please set the window instace in the button action where you are calling the popup window.

/sample code for theis 
IWDWindowInfo windowInfo = (IWDWindowInfo) wdComponentAPI.getComponentInfo().findInWindows("WindowName");
IWDWindow window = wdComponentAPI.getWindowManager().createModalWindow(windowInfo);
wdContext.currentContextElement().setWindowInstance(window);
window.setWindowPosition(WDWindowPos.CENTER);
window.show();

You create an eventhandler in the view and catch the event in handler which comes from popup view.

Write the code in event handler for destroying the window instance.

wdContext.currentContextElement().getWindowInstance().destroyInstance();

Hope this helps you.

Regards,

Saleem Mohammad.

former_member372910
Discoverer
0 Kudos

Hi Rama ,

Check if you have created event handler for Close button and given name of Event Handler exact same in method findInEventHandler("eventHandlerName") ;

Regards,

Khalid Desai.

Former Member
0 Kudos

Hi Rama,

Refer this link.

Hope this will help you.

Regards,

Jithin