cancel
Showing results for 
Search instead for 
Did you mean: 

popup pls

Former Member
0 Kudos

i saw many threads regarding popup ,

bit still i am not able to get it.

so anybody pls post me the coding

from declaration onwards.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi jean

lets say you want to generate a popup when user press the save button.

Create the action associated with save button : SAVE_DATA.

Go inside the code of action SAVE_DATA and add following code:

DATA : lr_component_api TYPE REF TO if_wd_component.

DATA : lr_popup TYPE REF TO if_wd_popup_to_confirm.

DATA l_controller_api TYPE REF TO if_wd_controller.

DATA : l_configuration TYPE wdr_popup_to_confirm.

DATA : l_text_table TYPE string_table,

ls_text_table TYPE string .

*

l_controller_api = wd_this->wd_get_api( ).

lr_component_api = wd_comp_controller->wd_get_api( ).

ls_text_table = 'Are you sure you want to save record?'.

APPEND ls_text_table TO l_text_table .

TRY.

CALL METHOD cl_wd_popup_factory=>popup_to_confirm

EXPORTING

component = lr_component_api

text = l_text_table

window_title = 'Confirmation'

configuration = l_configuration

RECEIVING

popup_to_confirm = wd_this->popup.

CATCH cx_wd_runtime_repository .

ENDTRY.

wd_this->popup->subscribe_to_events(

controller = l_controller_api

handler_name = 'ON_CONFIRM_SAVE' ).

Go to the attribute of your view and add an attribute 'POPUP' of type IF_WD_POPUP_TO_CONFIRM.

when you will press the save button the action SAVE_DATA will be triggered and a popup will be generated.

To handle the action related to the buttons appearing on the popup window ( yes, no and cancel) create one more method in your view having name 'ON_CONFIRM_SAVE' (method type must be event handler) . in that event handler you can decide what to do when any of the button on popup window ( yes, no and cancel) is pressed.

Go inside the event handler 'ON_CONFIRM_SAVE'

write the code:

CASE wd_this->popup->answer.

WHEN if_wd_popup_to_confirm=>co_button_1_pressed.

*your code regarding yes button.

WHEN if_wd_popup_to_confirm=>co_button_2_pressed.

*your code regarding no button.

endcase.

Thanks

Vishal kapoor

Edited by: vishal kapoor on Feb 9, 2008 10:51 AM