Wednesday, August 19, 2009

ABAP Confirmation Popup Screen


Before a critical operation starts , we often need user to confirm the operation just to be sure that the process wasn't started mistakenly. Simplest example for this purpose ;


data : lv_mes type string.
data lv_answer.
lv_mes = 'Your question here'.
call function 'POPUP_TO_CONFIRM'
exporting
titlebar = 'Popup Title'
text_question = lv_mes
text_button_1 = 'YES'
icon_button_1 = 'ICON_OKAY' " 1st Buttons icon
text_button_2 = 'NO'
icon_button_2 = 'ICON_CANCEL' "2nd Buttons icon
default_button = '2' " Default choice - NO
display_cancel_button = 'X' " 3rd button(CANCEL) is visible or not
importing
answer = lv_answer
exceptions
text_not_found = 1
others = 2.
**** RESULT
IF lv_answer = '1'. " 1st button has clicked
ELSEIF lv_answer = '2'. " 2nd button has clicked
ELSEIFlv_answer = 'A'. " CANCEL button has clicked
ENDIF.

No comments:

Post a Comment