cancel
Showing results for 
Search instead for 
Did you mean: 

Code Snippet for Pop-Window

Former Member
0 Kudos

Hi Colleague,

I need to show a pop-up window on an event. How can i achieve this in ABAP WD.

Code Snippet would be helpful.

Regards,

Piyush

Accepted Solutions (1)

Accepted Solutions (1)

arjun_thakur
Active Contributor
0 Kudos

Hi Piyush,

You can get the code for pop up window with the help of code wizard. Just press ctrl + F7 and then select the generate pop up readio button, pass the pop up window name and press enter. You'll get a auto generated code for popup window.

Regards

Arjun

Former Member
0 Kudos

Hi ,

Thank you very much. It was really helpful. Can you also tell me where can i trap the EVENT, for eg. if i put a OK button. Can i trap this action as i need to close the pop-up on press of button.

Regards,

Piyush

arjun_thakur
Active Contributor
0 Kudos

Piyush,

When you create a pop up window using code wizard, you'll get a OK button by default. By clicking on it the pop up window will close. Or if you want to place a OK button in the view that is present in the pop up window and want to close the pop up by clicking on it, that is also possible. Just Put a button in the pop up view and use this code in the ONACTION method of that button:


data:
            l_api         type ref to if_wd_view_controller,
            l_window_ctlr type ref to if_wd_window_controller,
            l_popup       type ref to if_wd_window.
            l_api         = wd_this->wd_get_api( ).
            l_window_ctlr = l_api->get_embedding_window_ctlr( ).
            if l_window_ctlr is bound.
            l_popup       = l_window_ctlr->get_window( ).
            l_popup->close( 'l_popup' )." pass the pop up view name here
            endif.

Regards

Arjun

Edited by: Arjun Thakur on Mar 13, 2009 10:01 AM

Answers (1)

Answers (1)

abhimanyu_lagishetti7
Active Contributor
0 Kudos

DATA: LR_COMP TYPE REF TO IF_WD_COMPONENT.

DATA: LR_WIN_MGR TYPE REF TO IF_WD_WINDOW_MANAGER.

DATA: LR_CTRL TYPE REF TO IF_WD_VIEW_CONTROLLER.

    • LR_UPLOAD IS OF TYPE IF_WD_WINDOW

IF wd_comp_controller->LR_UPLOAD IS INITIAL.

LR_COMP = wd_comp_controller->WD_GET_API( ).

LR_WIN_MGR = LR_COMP->GET_WINDOW_MANAGER( ).

wd_comp_controller->LR_UPLOAD =

LR_WIN_MGR->CREATE_WINDOW(

WINDOW_NAME = 'UPLOAD_W'

TITLE = 'Upload File'

BUTTON_KIND = IF_WD_WINDOW=>CO_BUTTONS_OKCANCEL ).

ENDIF.

wd_comp_controller->LR_UPLOAD->OPEN( ).

Create a window(Upload_W) and place your views inside the window and in your event handler use this code to open a window. I have created LR_UPLOAD reference variable in Component controllers attribute tab with type as mentioned.

Abhi