‎2008 Jan 14 10:12 AM
Hi experts,
I need to display a pop up with yes,no and cancel options when I click on save button in my screen.
Is there any function module for it.
Please let me know.
It is urgent.
Thanks in advance.
Regards,
Praveen
‎2008 Jan 14 10:34 AM
Hi Praveen,
In this code a function module is called to display the popup.The popup contains three options-Yes,No and Cancel.When selecting Yes,The details present in the input fields will be saved in the Ztables.If NO is selected in the popup,then the program will be exited.
In the function module,answer holds the user command.
e_answer needs to be created by user.The statement for it is :
DATA :e_answer type c.
In the function module as you can see, J indicates Yes and N indicates No.
In the PAI module of that Screen,
write this code:
CASE SY-UCOMM.
when SAVE.
CALL FUNCTION 'C14A_POPUP_SAVE_WITH_CANCEL'
IMPORTING
e_answer = answer.
IF answer = 'N'.
***Leaving the program****
LEAVE PROGRAM.
ELSEIF answer = 'J'.
***The right side of the equation is the name of the input field in the screen.The left hand side of the ****equation is the field name in the ZTable ztm09_ekpo.**
ztm09_ekpo-ebeln = ztm09_ekko-ebeln. "ztm09_ekko is the name of the Z Table.
MODIFY ztm09_ekpo.
endcase.
Regards
Kaushik
‎2008 Jan 14 10:15 AM
Hi,
try this FM
POPUP_INFORMATION_WITH_SET_GET.
Plzz reward if it helps.
‎2008 Jan 14 10:15 AM
Hi Praveen,
Try this Function Module:
C14A_POPUP_SAVE_WITH_CANCEL
Regards,
Kaushik
‎2008 Jan 14 10:15 AM
‎2008 Jan 14 10:16 AM
Hi
Check the following FM:
Popup Related Function Modules:
POPUP_TO_DISPLAY_TEXT display 2 line text.
POPUP_TO_CONFIRM_STEP
POPUP_TO_CONFIRM_WITH_VALUE (with Back and Exit)
POPUP_TO_CONFIRM_LOSS_OF_DATA (with Cancel).
POPUP_TO_CONFIRM_WITH_MESSAGE
POPUP_TO_DECIDE
POPUP_TO_DECIDE_WITH_MESSAGE
Hope this helps.
Reward if helpful.
Regards,
Hitesh
‎2008 Jan 14 10:18 AM
Hi,
try these function modules :
LC_POPUP_TO_CONFIRM_STEP
LC_POPUP_TO_CONFIRM_STEP_JNA
With Rgds,
S.Barani
‎2008 Jan 14 10:18 AM
Hi,
Check the following site. We will certanly find what you are looking for.
[http://www.sapdev.co.uk/fmodules/fmssap.htm]
Regards
‎2008 Jan 14 10:28 AM
Hi all,
Thanks for the quick replies.
I used this Function Module,
C14A_POPUP_SAVE_WITH_CANCEL.
Can you please tell me how to write the code for my requirements using this Function Module.
My requirement is :
If is click on Yes ,the data needs to be updated in the ZTable.
If I click on No, the the program should exit.
Regards,
Praveen.
‎2008 Jan 14 10:34 AM
Hi Praveen,
In this code a function module is called to display the popup.The popup contains three options-Yes,No and Cancel.When selecting Yes,The details present in the input fields will be saved in the Ztables.If NO is selected in the popup,then the program will be exited.
In the function module,answer holds the user command.
e_answer needs to be created by user.The statement for it is :
DATA :e_answer type c.
In the function module as you can see, J indicates Yes and N indicates No.
In the PAI module of that Screen,
write this code:
CASE SY-UCOMM.
when SAVE.
CALL FUNCTION 'C14A_POPUP_SAVE_WITH_CANCEL'
IMPORTING
e_answer = answer.
IF answer = 'N'.
***Leaving the program****
LEAVE PROGRAM.
ELSEIF answer = 'J'.
***The right side of the equation is the name of the input field in the screen.The left hand side of the ****equation is the field name in the ZTable ztm09_ekpo.**
ztm09_ekpo-ebeln = ztm09_ekko-ebeln. "ztm09_ekko is the name of the Z Table.
MODIFY ztm09_ekpo.
endcase.
Regards
Kaushik
‎2008 Jan 14 11:06 AM
Hello Praveen,
You can also use this FM POPUP_TO_CONFIRM_STEP
This will give you popup with "Yse", "No" and "Cancel" button.
You can call this FM like below
IF sy-ucomm = 'SAVE'.
CALL FUNCTION 'POPUP_TO_CONFIRM_STEP'
EXPORTING
DEFAULTOPTION = 'Y'
textline1 = 'DATA WILL BE SAVED!'
textline2 = 'CONTINUE?'
titel = 'SAVE CONFIRMATION POPUP'
IMPORTING
answer = lv_answer
.
IF lv_answer = 'J' OR lv_answer = 'Y'.
Your Save logic
ELSEIF lv_answer = 'N'.
*Your logic when the user doesn't want to save
ELSEIF lv_answer = 'A'.
*Your logic when the user clicks cancel
ENDIF.
ENDIF.
You can also use the additional parameters
START_COLUMN
START_ROW
CANCEL_DISPLAY
to good use in positioning the popup and to hide the "Cancel" button in the popup.
Hope this helps.
Thanks & Regards
Anupam
‎2008 Jan 15 11:07 AM
Hi all,
Thanks for your replies.
The code putforth by kaushik worked perfectly.
Regards,
Praveen