During the execution of an ABAP program, it often becomes necessary to clarify additional data from the user. Question to user SAP ABAP user we can with function module POPUP_TO_CONFIRM. For example, interrupt execution or continue depending on the algorithm and other options.
How to ask a SAP ABAP user example POPUP_TO_CONFIRM.
You can use this function module POPUP_TO_CONFIRM for question to user SAP ABAP in different systems, for example SAP ERP or SAP CRM. I create example which show you using POPUP_TO_CONFIRM in ABAP program.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
DATA lv_answer TYPE char1. CALL FUNCTION 'POPUP_TO_CONFIRM' EXPORTING titlebar = 'Deleting all documents' text_question = 'Are you sure you want to delete all selected documents?' text_button_1 = 'Yes' icon_button_1 = CONV icon-name( 'ICON_OKAY' ) text_button_2 = 'No' icon_button_2 = CONV icon-name( 'ICON_CANCEL' ) default_button = '1' display_cancel_button = space popup_type = 'ICON_MESSAGE_WARNING' IMPORTING answer = lv_answer. |
If the POPUP_TO_CONFIRM function module is called as follows, the user will receive the following window as a result:

Depending on the user’s choice, the lv_answer variable will take on the following values:
1 2 3 4 |
" If user chose 'Yes' lv_answer = 1. " If user chose 'No' lv_answer = 2. " You can use this code for check value lv_answer: cl_demo_output=>display( lv_answer ). |
Example POPUP_TO_CONFIRM in program ABAP
I used this Function Module POPUP_TO_CONFIRM in program ABAP for deleting orders with mistakes in SAP CRM and it was very useful. Example ABAP code for you:
1 2 3 4 5 6 7 8 9 10 11 12 |
DATA(lv_lines) = lines( lt_ord_list ). DATA(lv_str) = |Delete { lv_lines } orders?|. CALL FUNCTION 'POPUP_TO_CONFIRM' EXPORTING text_question = lv_str IMPORTING answer = l_answer EXCEPTIONS text_not_found = 1 OTHERS = 2. CHECK sy-subrc = 0. CHECK l_answer = '1'. |