POPUP_TO_CONFIRM
FA
What is POPUP_TO_CONFIRM?
POPUP_TO_CONFIRM is a standard function module used to display a message (question, document object text, or both) in a modal dialog box, and also to ask users to decide.
I recommend reading the documentation before using it. To do this, please follow the steps below.
Launch transaction SE37.
Enter POPUP_TO_CONFIRM in the Function Module input field.
From the top menu, choose Goto → Documentation → Function Module Documentation.
Changing the Popup Icon
I know this is a bedtime story for 0-3 age but let's refresh our memories. We can change the popup icon displayed on the left. To do this, we simply specify an icon name starting with ICON_MESSAGE_ in the POPUP_TYPE parameter.
DATA answer.
DO 5 TIMES.
DATA(popup_type) = SWITCH icon-name( sy-index
WHEN 1 THEN 'ICON_MESSAGE_INFORMATION'
WHEN 2 THEN 'ICON_MESSAGE_WARNING'
WHEN 3 THEN 'ICON_MESSAGE_ERROR'
WHEN 4 THEN 'ICON_MESSAGE_QUESTION'
WHEN 5 THEN 'ICON_MESSAGE_CRITICAL' ).
CALL FUNCTION 'POPUP_TO_CONFIRM'
EXPORTING
text_question = popup_type
popup_type = popup_type
IMPORTING
answer = answer
EXCEPTIONS
OTHERS = 2.
ENDDO.
When we run the above code, the popup will be displayed a total of 5 times, each time with a different icon.
Customizing the Icons and Quick Info of Buttons
It is also possible to customize the icons of the first two buttons. I just wanted to include this here because sometimes it may be necessary to highlight a button with a striking icon.
DATA answer.
CALL FUNCTION 'POPUP_TO_CONFIRM'
EXPORTING
text_question = 'What is Lorem ipsum?'
text_button_1 = 'I know'
icon_button_1 = 'ICON_OKAY'
text_button_2 = 'No idea'
icon_button_2 = 'ICON_DUMMY'
popup_type = 'ICON_MESSAGE_QUESTION'
iv_quickinfo_button_1 = 'But I won''t say'
iv_quickinfo_button_2 = 'Please tell me'
IMPORTING
answer = answer
EXCEPTIONS
OTHERS = 2.
Since the texts are set from text elements, we are unable to change the icon and texts of the last two buttons 'Info' and 'Cancel' ('Info' appears when a document object is used).
button_3 = 'Info'(201).
button_4 = 'Abbrechen'(200).
However, these texts will be displayed in the login language.