Hi, I provide training in SAP UI5. Also feel free to checkout my new web page https://saptechblog.com
Webdynpro ABAP

Pop Up

In this post we will study how to generate a pop-up in the screen.

 

Scenario: We will place a button on the screen and on clicking we will display the pop-up.

 

Step 1: Go to the object navigator (SE80) and create a webdynpro component.

 

clip_image002

 

 

Assign the component to the package or save it in the local object.

 

Step 2: In the layout of the view controller, create a UI element for button as shown below.

 

Right click on the Root UI element container and click on insert element to insert the UI element.

 

clip_image004

 

 

 

Enter the ID and Type for the UI element as shown below.

 

 

clip_image006

 

 

Set the text property of the Button UI element as shown below.

 

clip_image008

 

 

Create an event handler method for the button UI element which is to be triggered when clicking on the button.

 

clip_image010

 

 

Step 3: Right click on the view and click on create view to create a view for the popup.

 

clip_image012

 

 

clip_image014

In the layout of the view created place a text view ui element and provide the text for it so that it can be viewed in the pop up.

 

clip_image016

 

 

clip_image018

 

 

 

Step 4: In the window controller, create a window and embed the view for the Pop Up in it.

 

clip_image020

 

 

clip_image022

 

 

 

Embed the pop up view to the pop up window as shown below.

 

clip_image024

 

 

 

Choose the view to be embedded and press enter.

 

clip_image026

 

Activate the whole webdynpro component.

 

 

Step 5: In the event handler method created for the button do the following to call the pop up window.

 

Using code wizard declare the code for the Pop up window.

 

clip_image028

 

 

 

Code will be generated as below.

 

data lo_window_manager type ref to if_wd_window_manager.
data lo_api_component  type ref to
if_wd_component.
data lo_window         type ref to
if_wd_window.

lo_api_component  = wd_comp_controller->wd_get_api( ).
lo_window_manager = lo_api_component->get_window_manager( ).
lo_window         = lo_window_manager->create_window(
                   window_name            =
'W_POP'

*                  title                  =
*                  close_in_any_case      = abap_true
        message_display_mode   = if_wd_window=>co_msg_display_mode_selected
*                  close_button           = abap_true

                   button_kind            = if_wd_window=>co_buttons_ok
                   message_type           = if_wd_window=>co_msg_type_none
                   default_button         = if_wd_window=>co_button_ok
                   ).

lo_window->open( ).

 

 

Save and activate the whole application.

 

Step 6: Right click on the component and create a webdynpro application.

 

clip_image030

 

 

Test the application.

 

Output:

 

clip_image032

 

 

clip_image034

 

 

Thus we have now generated and displayed a pop up.

About Arun

0 Comments:

Post a Comment

Powered by Blogger.