cancel
Showing results for 
Search instead for 
Did you mean: 

Problems with POPUP TO CONFIRM

Former Member
0 Kudos

Hi experts,

I have a problem with a popup... I need to insert a popup with only the OK button after an action. I write this code:

....

lo_api_component = wd_comp_controller->wd_get_api( ).

lo_window_manager = lo_api_component->get_window_manager( ).

lo_view_ctrl = wd_this->wd_get_api( ).

  • lv_message = wd_assist->IF_WD_COMPONENT_ASSISTANCE~GET_TEXT( '001' ).

lv_message = err_msg.

insert lv_message into TABLE lt_message.

CALL METHOD LO_WINDOW_MANAGER->CREATE_POPUP_TO_CONFIRM

EXPORTING

TEXT = lt_message

BUTTON_KIND = IF_WD_WINDOW=>CO_BUTTONS_OK

MESSAGE_TYPE = IF_WD_WINDOW=>CO_MSG_TYPE_WARNING

WINDOW_POSITION = IF_WD_WINDOW=>CO_CENTER

RECEIVING

RESULT = lo_window.

CALL METHOD LO_WINDOW->SUBSCRIBE_TO_BUTTON_EVENT

EXPORTING

BUTTON = 1

BUTTON_TEXT = 'OK'

TOOLTIP = 'Ok'

ACTION_NAME = 'NO_SAVE'

ACTION_VIEW = lo_view_ctrl

  • IS_DEFAULT_BUTTON = ABAP_FALSE

.

lo_window->open( ).

....

but I have a dump and the error is: Are not defined command buttons to a popup POPUP_TO_CONFIRM.

What is my error?

Tks a lot.

Accepted Solutions (0)

Answers (3)

Answers (3)

saket_abhyankar
Active Participant
0 Kudos

Hi,

Try following things:

1) Code



DATA: z_button_kind     TYPE         wdr_popup_button_kind,
            z_message_type    TYPE         wdr_popup_msg_type,
            z_close_button    TYPE         abap_bool.

    z_button_kind = 1.
    z_message_type = 5.
    z_close_button = abap_true.

" Use following values for button kind u2013
" 0	                                                            
" 1	OK
" 2	Close
" 3	Ok, Cancel
" 4	Yes, No
" 5	Yes, No, Cancel
" 6	Cancel, Repeat, Ignore

" Use following values for message type -
" 0	                                                            
" 1 Information
" 2 Question
" 3 Error
" 4 Cancel
" 5 Warning

CALL METHOD LO_WINDOW_MANAGER->CREATE_POPUP_TO_CONFIRM
EXPORTING
TEXT = lt_message
BUTTON_KIND     = z_button_kind
MESSAGE_TYPE = z_message_type
close_button        = z_close_button
" WINDOW_POSITION = IF_WD_WINDOW=>CO_CENTER
RECEIVING
RESULT = lo_window.

CALL METHOD LO_WINDOW->SUBSCRIBE_TO_BUTTON_EVENT(
                button                   = if_wd_window=>co_button_ok
                action_name         = 'NO_SAVE'   " Create this action in the action tab of view 'lo_view_ctrl'
                action_view          = lo_view_ctrl
                is_default_button  = abap_true ).

2) Make sure that you have created action with name 'NO_SAVE' in the action tab of view 'lo_view_ctrl'. Write the logic that is to be executed on click of OK button, in this action.

Regards,

Saket.

Former Member
0 Kudos

tks, solved!

Former Member
0 Kudos

Hi,

The Parameter "BUTTON" is referring to the DOMAIN "WDR_POPUP_BUTTON".

The problem is you are using the value of the BUTTON as 1 which means its an abort. Change the value of BUTTON to 4. Below is the list of fixed values of the domain "WDR_POPUP_BUTTON".

0 No Button

1 Abort

2 Repeat

3 Ignore

4 OK

5 Close

6 Cancel

7 Yes

8 No

Hope it helps.

Best Regards,

Vinod

Former Member
0 Kudos

Hello,

The problem is there in the parameters passed for SUBSCRIBE_TO_BUTTON_EVENT.

Change the value for BUTTON from 1 to 4(IF_WD_WINDOW=>CO_BUTTON_OK).

Then it works!

CALL METHOD LO_WINDOW->SUBSCRIBE_TO_BUTTON_EVENT

EXPORTING

BUTTON = IF_WD_WINDOW=>CO_BUTTON_OK

BUTTON_TEXT = 'OK'

TOOLTIP = 'Ok'

ACTION_NAME = 'NO_SAVE'

ACTION_VIEW = lo_view_ctrl.

  • IS_DEFAULT_BUTTON = ABAP_FALSE

Regards,

Srilatha