cancel
Showing results for 
Search instead for 
Did you mean: 

How to do wth Popups

Former Member
0 Kudos

Im working on Popups the dialog box, im not aware on , how to generate the POPUP instead of navigating from one window to another. i must use the thing within the same component, i need a detailed explaining in this and if you give me the step by step procedure it ill more usefull for me..

Thanks In Advance.............!

regards ,

Madhu.

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

Hi Madhu,

The below mention steps will help you in using the popups in the same component and also in handling the events ('OK' button click etc) of popups.

<b>At the component controller level add one attribute GO_VARIANT_POPUP of type IF_WD_WINDOW and make this public.</b>

<b>Now in the evet handler of button or link from where you want to call popup write below mentioned code.</b>

<u>Note:</u> WDW_CREATE is the name of the window in which View is embedded which we want to show in popup screen.

*----


DATA: lo_cmp_api TYPE REF TO if_wd_component,

lo_window_manager TYPE REF TO if_wd_window_manager,

lv_popup_title TYPE string.

CONSTANTS: lc_wdw_variant TYPE string VALUE 'WDW_CREATE',

lc_action_close TYPE string VALUE 'POPUP_CLOSED'.

  • get window manager

lo_cmp_api = wd_comp_controller->wd_get_api( ).

lo_window_manager = lo_cmp_api->get_window_manager( ).

lv_popup_title = 'Create'.

wd_comp_controller->GO_VARIANT_POPUP = lo_window_manager->create_window(

window_name = lc_wdw_variant

title = lv_popup_title

close_button = abap_true

button_kind = if_wd_window=>co_buttons_okcancel

message_type = if_wd_window=>co_msg_type_none

).

wd_comp_controller->GO_VARIANT_POPUP->open( ).

*----


The above step will fire the popup.

<b>Now to handle the event ('OK' button on popup) create one action with name 'OK' and corresponding event handler in the popup view and subscribe the action 'OK'. Write the below mentioned code in WDDOINIT method of view</b>

*----


data: lv_view_controller_api type ref to if_wd_view_controller.

lv_view_controller_api = wd_this->wd_get_api( ).

WD_COMP_CONTROLLER->go_variant_popup->subscribe_to_button_event(

button = if_wd_window=>co_button_ok

action_name = 'OK'

action_view = lv_view_controller_api

is_default_button = abap_false ).

*----


So now in the eventhandler of action 'OK' you can write code to create record (as per this example).

Regards,

Aditya

Former Member
0 Kudos

1. In view or component controller create a new attribute of type IF_WD_WINDOW.

mr_popup type IF_WD_WINDOW.

2. Please use always OTR texts for Title, Button names, etc. In Source code you can get the OTR-Text by usage of class cl_bsp_runtime, method get_otr_text. Sample code is

DATA: lv_text TYPE string.

lv_text = cl_bsp_runtime=>get_otr_text( alias = < alias of OTR-text > ).

CONDENSE lv_text.

3. To raise the popup you can use the following source code:

DATA: lo_cmp_api TYPE REF TO if_wd_component,

lo_window_manager TYPE REF TO if_wd_window_manager,

lo_view TYPE REF TO if_wd_view_controller,

lv_title TYPE string.

lo_view = wd_this->wd_get_api( ).

lo_cmp_api = wd_comp_controller->wd_get_api( ).

lo_window_manager = lo_cmp_api->get_window_manager( ).

Determine here the OTR text for the title as mentioned in step 2

wd_comp_controller->mr_popup =

lo_window_manager->create_window(

window_name = <Name of the window >

close_button = < close button>

button_kind = <Button kind>

title = <Name of the title>

close_in_any_case = < close in any case > ).

wd_comp_controller->mr_popup->open( ).

4. Often not the standard buttons like ok/cancel or yes/no/cancel shall be used in the lower right corner for the popup but other buttons. The technique to use other buttons is to replace the standard buttons by subscription. To achieve this please implement in the “WDDOINIT” method of the view which is displayed at the popup. The sample code for the subscription is:

DATA:

lr_action_view TYPE REF TO if_wd_view_controller,

l_action_text TYPE string.

lr_action_view = wd_this->wd_get_api( ).

IF wd_comp_controller->mr_popup IS BOUND.

wd_comp_controller->mr_popup->subscribe_to_button_event(

button = < button which shall be replaced >

button_text = < button text >

tooltip = < tooltip text >

action_name = < name of action for button >

action_view = lr_action_view

is_default_button = < is default button >

).

< button which shall be replaced >

is the button which shall be replaced by the new one. Please

use the constants defined in interface if_wd_window to set the

button identifier. A sample is if_wd_window=>co_button_ok .

< button text > is the text which shall be displayed at the button instead of

the standard text. Please use here an OTR-text.

< tooltip text > is the text of the tooltip of the button. Please use here

an OTR-text. The text should always be maintained if the

< button text > is not the text of the standard button.

In question use the same text as for < button text > .

If no text is maintained here the original text will be used

which might be wrong.

< name of action for button >

5. If the action of the button fails the message needs to be displayed within the popup and the popup must not be closed. The next sample code shows how to raise a message:

  • get message manager

data lo_api_controller type ref to if_wd_controller.

data lo_message_manager type ref to if_wd_message_manager.

lo_api_controller ?= wd_This->Wd_Get_Api( ).

CALL METHOD lo_api_controller->GET_MESSAGE_MANAGER

RECEIVING

MESSAGE_MANAGER = lo_message_manager

.

  • report message

CALL METHOD lo_message_manager->RAISE_T100_ERROR

EXPORTING

MSGID =

MSGNO =

MSGTY =

  • P1 =

  • P2 =

  • P3 =

  • P4 =

  • MSG_USER_DATA =

6. If there is no error message it is allowed to close the popup. This can be done with the following code:

wd_comp_controller->mr_popup->close( ).

(see step 1 how wd_comp_controller->mr_popup is defined)

Former Member
0 Kudos

To get the popup window click webdynpro code wizard (CTRL+F7) in that select generate popup radio button.

Specify ur window name there.

Madhu2004
Active Contributor
0 Kudos

Hai rajendran,

Where can we find POPUP radio button in Code wizard?

thanks

thomas_szcs
Active Contributor
0 Kudos

Hi Madhu,

The availability of the popup coding wizard depends on the SP level of your system. Well, programming it manually, you would write something like this:



  data:
    lr_api_comp_controller type ref to if_wd_component,
    lr_window_manager type ref to if_wd_window_manager,
    lr_popup type ref to if_wd_window.

  lr_api_comp_controller = wd_this->wd_get_api( ).
  lr_window_manager = lr_api_comp_controller->get_window_manager( ).

  lr_popup = lr_window_manager->create_window(
                    window_name = <name of your window> ).
  lr_popup->open( ).

Best regards,

Thomas

Former Member
0 Kudos

after clicking some button or process only u will be in need of a popup window

for example u have created an action delete doble click it & go the the coding part after that click ctrl+F7 u will get a popup screen u can see the generate popup there.

The coding is like this.

method ONACTIONDELETE .

DATA: l_window_manager TYPE REF TO if_wd_window_manager,

l_cmp_api TYPE REF TO if_wd_component,

l_window TYPE REF TO if_wd_window.

l_cmp_api = wd_comp_controller->wd_get_api( ).

l_window_manager = l_cmp_api->get_window_manager( ).

l_window = l_window_manager->create_window(

window_name = 'POPUPWINDOW'

title = 'Delete ?'

  • 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_YESNOCANCEL

message_type = if_wd_window=>co_msg_type_none

  • default_button = if_wd_window=>co_button_ok

).

l_window->open( ).

endmethod.

Here u have to specify ur window name.

Former Member
0 Kudos

hi..

i hv created a popup window which has an input field and an OK button..

On on click of that OK button i want to trigger sm event ..

how can i do that...

jagruti

sivasatyaprasad_yerra
Active Contributor
0 Kudos

Hi,

The following code will open the pop-up dialog box

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 = 'REPAIR_POPUP' // Window name

  • title =

close_in_any_case = abap_true // To close the pop-up window on click of Ok / Cancel

message_display_mode = if_wd_window=>co_msg_display_mode_selected

  • close_button = abap_true

button_kind = if_wd_window=>co_buttons_yesno

message_type = if_wd_window=>co_msg_type_none

default_button = if_wd_window=>co_button_yes

).

lo_window->open( ). // To open the pop-up window.

If we need to do any operation on click of "OK" or "CANCEL", then we need to register to the events.

To register events we need to write the folowing piece of code.

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( ).

if l_popup is bound.

l_popup->subscribe_to_button_event(

button = if_wd_window=>co_button_yes

button_text = 'Repair'

tooltip = 'Repair Rules'

action_name = 'EXECUTE_REPAIR'

action_view = l_api

is_default_button = abap_false ).

l_popup->subscribe_to_button_event(

button = if_wd_window=>co_button_no

button_text = 'Cancel'

tooltip = 'Cancel'

action_name = 'EXECUTE_CANCEL'

action_view = l_api

is_default_button = abap_true ).

endif.

endif.

Regards,

Siva

Madhu2004
Active Contributor
0 Kudos

Hai Madhu,

You can check in this URL ,which contains a PDF file for creating different types of dialog boxes.

<a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/9e242bf5-0901-0010-c99c-83c180163c73">https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/9e242bf5-0901-0010-c99c-83c180163c73</a>

Bye

Former Member
0 Kudos

Hi,

see the <a href="http://help.sap.com/saphelp_nw2004s/helpdata/en/43/bcd2b8e326332ee10000000a11466f/frameset.htm">documentation</a> on working with dialog boxes (popups).

There's the example component WDR_TEST_POPUPS_RT_00 in the system.

Regards, Heidi