Different types of Pop Up in WebDynpro Java.
This guide provides instructions on how to give different types of pop up in WebDynpro Java.
Applies to:
This Document Holds good for all CE 7.1 EHP01 onward.
Summary:
This guide describes step-by-step how to give different types of pop up in WebDynpro Java. We will be explaining two methods to give pop up. One is opening a window to display a view the other being generating a message alert using stranded code.
Methods –
- Method 1 : Open a window to display a view.
- Method 2 : Giving a alert window to display message.
Method 1 : Open a window to display a view:
Step 1 : Create a view which you wish to show as pop up.
Step 2 : Create a window and add the above created view in the window as default view.
Step 3 : Create a node of Collection Cardinality “1..1”. Create an Attribute of type “com.sap.tc.webdynpro.services.session.api.IWDWindow”.
Step 4 : Go to the section from where you wish to open this pop up and use the following code.
IWDWindowInfo windowInfo =(IWDWindowInfo)wdComponentAPI.getComponentInfo().findInWindows(“<Window Name>”);
IWDWindow window = wdComponentAPI.getWindowManager().createModalWindow(windowInfo);
wdContext.current<Node Name>Element().set<Attribute Name>(window);
window.setWindowSize(<width>, <height>);
window.setWindowPosition(WDWindowPos.CENTER);
window.setTitle(“<Title Name>”);
window.show();
Step 5 : Go to the View created in step 1. Now go to the section on whose action you wish to close the pop up use the following code.
IWDWindow window = wdContext.current<Node Name>Element().set<Attribute Name>();
window.hide();
window.destroyInstance();
Note : To use this code the only thing needed to be remembered is that the node created in step 3 should be created in Component Controller and mapped node created in views in which it is to be called ie both the views.
Method 1 : Giving a alert window to display message:
Step 1 : Go to the View to which pop up has to be shown. Create “Action” for the number of options you wish to show in the pop up.
Step 2 : Go to the section from where you wish to open the pop up use the following code.
IWDConfirmationDialog confirmationWindow = wdComponentAPI.getWindowManager().createConfirmationWindow(<Message Text>, <action>, <label>);
confirmationWindow.addChoice(<action>, <label>);
confirmationWindow.setTitle(“<Title Text>”);
confirmationWindow.setWindowPosition(WDWindowPos.CENTER);
confirmationWindow.setWindowSize(<width>, <height>);
confirmationWindow.show();
Note :
- <Message Text> ->The message text is the message to be displayed.
- <action> -> The action is the one created in step 1 it can be accessed in the following format “IPrivate<View Name>.WD_EVENTHANDLER_ON_ACTION_<Action name>”.
Hi Piyas,
Nice Document very helpful.
Regards
Kumar