Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Function Module for a pop up window

Former Member
0 Likes
10,249

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
6,191

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

10 REPLIES 10
Read only

Former Member
0 Likes
6,191

Hi,

try this FM

POPUP_INFORMATION_WITH_SET_GET.

Plzz reward if it helps.

Read only

Former Member
0 Likes
6,191

Hi Praveen,

Try this Function Module:

C14A_POPUP_SAVE_WITH_CANCEL

Regards,

Kaushik

Read only

Former Member
0 Likes
6,191

Hi Praveen

Use the FM "POPUP_TO_CONFIRM".

~ Ranganath

Read only

Former Member
0 Likes
6,191

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

Read only

Former Member
0 Likes
6,191

Hi,

try these function modules :

LC_POPUP_TO_CONFIRM_STEP

LC_POPUP_TO_CONFIRM_STEP_JNA

With Rgds,

S.Barani

Read only

Former Member
0 Likes
6,191

Hi,

Check the following site. We will certanly find what you are looking for.

[http://www.sapdev.co.uk/fmodules/fmssap.htm]

Regards

Read only

Former Member
0 Likes
6,191

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.

Read only

Former Member
0 Likes
6,192

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

Read only

Former Member
0 Likes
6,191

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

Read only

Former Member
0 Likes
6,191

Hi all,

Thanks for your replies.

The code putforth by kaushik worked perfectly.

Regards,

Praveen