cancel
Showing results for 
Search instead for 
Did you mean: 

Regarding Pop Up

Former Member
0 Kudos

I have a context Data. I need to display that data in a popup window(new window), as soon as i click a button in the view.

Can anyone help me in this issue

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Sreekar,

U can open a new popup window and display the data that is selected in one view to the other in the next window by creating a new window <b>Using the concept of event handling.</b>

<b><i>Just follow the steps:</i></b>

1) In the window --> right clik create a new window and embed a new view inside it.

2) In the <b>component controller</b> i) create a new event and a method.

ii) inside comp.ctrller implementation:

<b>newmtd()</b>

{

wdThis.wdFireEvent<event name>(parameter);

}

2) Get the value in the <b>1 view using the onACtion()</b> btn mtd:

<b>onAction()</b>

{

String x = wdcontext.currentContextelement.get<attname>;

}

3) For opening a new popup WD:

<b>onAction()</b>

{

String x = wdcontext.currentContextelement.get<attname>;

IWDWindowInfo window=wdComponentAPI.getComponentInfo().findInWindows("<second WD name>");

IWDWindow win=wdComponentAPI.getWindowManager().createWindow(window,false);

win.open();

wdThis.wdGet<component controller>().<comp ctrl mtd name>(x);

wdContext.currentContextElement().<b>setInstance</b>(win);

//instance is con.att of type IWDWindow in native directory.

}

4) Finally in the <b>second view</b> create method as event handler:

<b>In the event handler()</b>

{

wdContext.currentContextElement().set<attname>(parameter);

}

5) For closing the popup WD have btn in the <b>second view</b>int he <b>onaction()</b>

{

IWDWindow win=wdContext.currentContextElement().<b>getInstance</b>(); // this instance is the context att of type IWDwindow.This should be selected form the native type.THis instance should be created in the 1 view and also in the comp.controller.

win.close();

}

That should solve ur query.

Regards,

Nagarajan.

Former Member
0 Kudos

I have done what u have mentioned in it. Everything working fine

But i placed a button which is assigned to a event handler . I have written a code for closong it inside that action.

I am getting null pointer exception. Can u able to suggest me regarding it

Former Member
0 Kudos

hi

Check whether you have created a attribute for window instance in the component controller

and mapped that attribute to the attribute in both the views.

Atrribute windowinstance should be of type

com.sap.tc.webdynpro.services.session.api.IWDWindow

Regards,

Rathna

arun_srinivasan
Contributor
0 Kudos

hi

for closing the popup window

map win instance from view1 to cc and cc to popup view

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

{

//@@begin onActionOK(ServerEvent)

IWDWindow w=wdContext.currentContextElement().getWin();

w.destroy();

//@@end

}

regards,

Arun

Answers (2)

Answers (2)

arun_srinivasan
Contributor
0 Kudos

hai sreekar,

First create a new window and embed a new view in it.In that view create the textview in it.

Let u want to pass the value of the inputfield of view1 to popup window view. create the value attribute of type string in view1 , popup view and component controller .add the component controller in the properties of both the view. Map the value attribute from view1 to cc and cc to popup view.

IWDWindowInfo inf=wdComponentAPI.getComponentInfo().findInWindows("Confirmwin");

IWDWindow win= wdComponentAPI.getWindowManager().createModalWindow(inf);

wdContext.currentContextElement().setWin_inst(win);

win.open();

win.setWindowSize(380,250);

win.setWindowPosition(500,200);

attribute win_inst is of type type com.sap.tc.webdynpro.services.session.api.IWDWindow

let me know if it helps,

hope this helps,

Regards,

Arun

Former Member
0 Kudos

Hi Arun

in the first line findInWindows("Confirmwin");

what is this value refer to?

arun_srinivasan
Contributor
0 Kudos

the name of the webdynpro window which you want as popup window

Yashpal
Active Contributor
0 Kudos

Hi,

create a new window and create context for that map it... and find the window and create it as a extenal window ......link to document....

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/documents/a1-8-4/tutorial on creating dialog boxes.htm

Regards,

yashpal

Former Member
0 Kudos

Hi Sreekar,

The steps you need to do for bringing up a new window are:

1) Create the view to be shown inside the pop-up. Create the required UI elements and map the corresponding context values to the Component controller's context

2) Create a window and embedd this view in it.

3) Map the required attributes from the parent view to the component controller too.

4) In the action handler of the button, write the following lines of code:

IWDWindow window;

IWDWindowInfo winInfo = wdComponentAPI.getComponentInfo().findInWindows("<name of the created name>");

window = wdComponentAPI.getWindowManager().createModalWindow(winInfo);

wdContext.currentContextElement().setWindowInstance(window);

window.setWindowSize(600, 200);

window.setWindowPosition(WDWindowPos.CENTER);

window.open();

This will open up a modal window.

Hope this helps,

Best Regards,

Nibu.

Oooops I am sorry.....You already have got these answers !

Message was edited by: Nibu Wilson