11-19-2007 7:22 PM
Hi all,
I am using POPUP_TO_CONFIRM_LOSS_OF_DATA function module to give a pop-up message when the data is changed in the screen.
I am triggering this POP-UP when the 'BACK' button is hit.
But I when we select 'NO' also in the Pop-up it is coming out of the screen. How to handle the answer = 'N' option? how to remain in the same screen when we select 'NO'.
Can anyone help me plz?
Regards,
Nag
11-19-2007 7:26 PM
You can use like this:
CALL FUNCTION 'POPUP_TO_CONFIRM_LOSS_OF_DATA'
EXPORTING
TEXTLINE1 = TEXT-PC1
TEXTLINE2 = TEXT-PC2
TITEL = TEXT-PC3
IMPORTING
ANSWER = LV_ANSWER.
IF LV_ANSWER = 'N' OR LV_ANSWER = 'A'.
STOP.
else.
* process of loosing
ENDIF.
Regards,
Naimesh Patel
11-19-2007 7:26 PM
You can use like this:
CALL FUNCTION 'POPUP_TO_CONFIRM_LOSS_OF_DATA'
EXPORTING
TEXTLINE1 = TEXT-PC1
TEXTLINE2 = TEXT-PC2
TITEL = TEXT-PC3
IMPORTING
ANSWER = LV_ANSWER.
IF LV_ANSWER = 'N' OR LV_ANSWER = 'A'.
STOP.
else.
* process of loosing
ENDIF.
Regards,
Naimesh Patel
11-20-2007 9:54 AM
What is the code following your call to the function module?... the logic will not normally exit the screen flow unless you tell it to, so set a break-point after the call and watch where it goes next.
Jonathan
11-20-2007 4:43 PM
I did not write any code for the 'NO' option, but as it is standard SAP 'BACK' button, it is going out of the screen even if we select 'NO'. We need prevent exiting from the screen when 'NO' option is selected.
11-20-2007 4:48 PM
You need to code when you have option "NO"
Like this:
IF LV_ANSWER = 'N' OR LV_ANSWER = 'A'.
* save data to database table here.
else.
ENDIF.
Regards,
Naimesh Patel
11-21-2007 6:20 AM
It should not leave the screen unless you tell it to... check the PF-STATUS you are using and what is defined for the "BACK" button - does it have a special function type, or is it blank or "E"... if it has "E" then that should cause the flow logic to head into your "Module dxxx_exit-check AT EXIT-COMMAND" in PAI where you may have implemented your popup, yes? And unless you "leave screen", "set screen" etc etc, or call some other code then your logic should just follow through the subsequent PAI modules. So what happened when you put a break-point in -> where do you see it exiting your logic?
Jonathan
11-30-2007 8:48 AM
&----
*& Module exit INPUT
&----
text
----
*
*on selecting the cancel button
module exit input.
case ok_code2.
when 'CANCEL'.
data answer type c.
set hold data on.
if sy-datar eq 'X'.
call function 'POPUP_TO_CONFIRM'
exporting
text_question = 'Would you like to save the data?'(a02)
importing
answer = answer
exceptions
text_not_found = 1
others = 2.
case answer.
when '1'.
perform save.
when '2'.
message 'SUCCESS: EXITING...SUCCESSFUL' type 'S'.
leave program.
when 'A'.
set screen 200.
endcase.
set hold data off.
else.
leave program.
endif.
*on selecting the exit button
when 'EXIT'.
leave program.
endcase.
endmodule. " exit INPUT