11-09-2007 11:41 AM
Hi,
I working with table control in module pool program .I have option to delete the row.When user select the delete option one popup message should come with sure want to delete.message should have yes , No and cancel option.How to acheive this.
Pls guide me with example.
Regards,
K.Sudhakaran.
11-09-2007 11:49 AM
Hi Sudha,
there is function module to do this job ..check this..
DATA : ans.
CALL FUNCTION 'POPUP_TO_CONFIRM_WITH_MESSAGE'
EXPORTING
defaultoption = 'Y'
diagnosetext1 = 'Caution!!'
diagnosetext2 = 'Do you want delete record!!! '
diagnosetext3 = ' '
textline1 = ' '
titel = 'Confirmation'
IMPORTING
answer = ans "Returns user action
EXCEPTIONS
OTHERS = 1.
Message was edited by:
Sudhakar G
11-09-2007 12:18 PM
Hi Sudha,
Use the Popup_to_confirm function module to confirm a user selection with a response. The pop-up dialog box has three elements, a title bar, the "text question" and the response. There are 3 and always three responses, normally "yes", "no" and "cancel." You will always pass a text question, and can control the 'Yes' and 'No' answers, although 'Yes' and 'No' are the defaults. You can control the titlebar, but if the parameter is blank, the titlebar assumes the text description of the program.
Available imports/exports/tables
*" VALUE(TITLEBAR) DEFAULT SPACE
*" VALUE(DIAGNOSE_OBJECT) LIKE DOKHL-OBJECT DEFAULT SPACE
*" VALUE(TEXT_QUESTION)
*" VALUE(TEXT_BUTTON_1) DEFAULT 'Ja'(001)
*" VALUE(ICON_BUTTON_1) LIKE ICON-NAME DEFAULT SPACE
*" VALUE(TEXT_BUTTON_2) DEFAULT 'Nein'(002)
*" VALUE(ICON_BUTTON_2) LIKE ICON-NAME DEFAULT SPACE
*" VALUE(DEFAULT_BUTTON) DEFAULT '1'
*" VALUE(DISPLAY_CANCEL_BUTTON) DEFAULT 'X'
*" VALUE(USERDEFINED_F1_HELP) LIKE DOKHL-OBJECT DEFAULT SPACE
*" VALUE(START_COLUMN) LIKE SY-CUCOL DEFAULT 25
*" VALUE(START_ROW) LIKE SY-CUROW DEFAULT 6
*" VALUE(POPUP_TYPE) LIKE ICON-NAME OPTIONAL
tables:
sscrfields. " Fields on selection screens
at selection-screen.
display a popup window to confirm that they want to update.
if sscrfields-ucomm = 'ONLI' or "User pressed "Execute"
sscrfields-ucomm = 'PRIN'. "User pressed "Execute and Print"
if p_update = 'X'. "If update requested
call function 'POPUP_TO_CONFIRM'
exporting
text_question = text-005 " Are you certain...?
importing
answer = w_answer
exceptions
text_not_found = 1
others = 2.
if sy-subrc <> 0. " Function call failed.
message i000 with text-006. " Func call failed contact IS
stop.
endif.
if w_answer ne '1'.
message i000 with text-007. " Proc cancelled - no update
stop.
endif.
endif. " Update requested
endif. " User pressed 'execute' or 'execute and print
Popups can be annoying, especially for experienced users, so our recommendation is that they be used sparingly.
</b>reward pts if found usefull<b>
Regards
Sathish