dear All,
like mm02 when user change anything and click on back button it should ask
want to save before exit.
and when i don't change any value then it shold not ask .
for this i tried using SY-DATAR but for first screen No. '1111' its showing
SY-DATAR = 'X' a but when i make chages in another screen No '2222' it showing SY-DATAR = ' '.
also i used flag but its not working . Any other logic please.
Point is assured *********
I guess it would depend on your flag. It should work. Anytime you leave any screen, you should check the SY-DATAR flag and set your global.
If sy-datar = 'X'. global_datar = 'X'. endif.
Can you post your coding?
Regards,
RIch Heilman
you are right rich,
but
if i make any chages first screen then only SY-DATAR Is set to 'X'.
actully i m changing code in second screen then sy-datar in not set to 'X'.
problem is that eventhoug i make some changes in second screen it is not asking me ' do you want to Exit' . and as a result its back to first screen without saving.
see rich
code is very big i make comment on my logic when OK_CODE = 'BACK'.
module exit_screen9006 input.
clear amount9006.
clear zinit.
ok_code = sy-ucomm.
case ok_code.
when 'BACK'.
if ztcode = 'ZCAPX3'.
leave to screen '9005'.
else.
**mks ON 20.07.2007 ZCAPX2 TCODE TO CHANGE OR EDIT
if ztcode = 'ZCAPX2' AND SY-DYNNR = '9006' AND FLAG_SAVE_CHECK = 'X'.
FLAG_SAVE_CHECK = ' '.
LEAVE TO SCREEN '9005'.
endif.
**mke
clear zanswer.
call function 'POPUP_TO_CONFIRM'
exporting
titlebar = 'Confirmation'
text_question = 'Do you want to save ?'
text_button_1 = 'Yes'
text_button_2 = 'No'
default_button = '1'
display_cancel_button = 'X'
importing
answer = zanswer.
case zanswer.
when 'A'.
when '2'.
if yflag ne '1'.
clear amount9006.
endif.
clear: tdetail,tdetail[],ttdetail,ttdetail[].",amount9006.
leave to screen '9005'.
when '1'.
*----
copy of function code SAVE
flag_save_check = 'X'.
if ztcode ne 'ZCAPXA'.
loop at tdetail." where zquant ne ''.
read table finalit transporting no fields with key anlhtxt = tdetail-anlhtxt
anlkl = tdetail-anlkl.
if sy-subrc = 0 .
move-corresponding tdetail to finalit.
modify finalit from finalit transporting meins zquant zamtrt zamtrs liefe anlhtxt zareapsf where anlhtxt = tdetail-anlhtxt.
else.
move-corresponding tdetail to finalit.
append finalit.
endif.
endloop.
move tdetail[] to ttdetail[].
clear: tdetail,tdetail[],ttdetail,ttdetail[].
leave to screen '9005'.
endif.
*----
endcase.
endif.
when 'SAVE'.
flag_save_check = 'X'.
loop at tdetail." where zquant ne ''.
read table finalit transporting no fields with key anlhtxt = tdetail-anlhtxt
anlkl = tdetail-anlkl.
if sy-subrc = 0 .
move-corresponding tdetail to finalit.
modify finalit from finalit transporting meins zquant zamtrt zamtrs liefe anlhtxt zareapsf where anlhtxt = tdetail-anlhtxt.
else.
move-corresponding tdetail to finalit.
append finalit.
endif.
endloop.
move tdetail[] to ttdetail[].
clear: tdetail,tdetail[],ttdetail,ttdetail[].
leave to screen '9005'.
when others.
loop at tdetail." where zquant ne ''.
read table finalit transporting no fields with key anlhtxt = tdetail-anlhtxt
ANLKL = tdetail-anlkl.
if sy-subrc = 0 .
move-corresponding tdetail to finalit.
modify finalit from finalit transporting meins zquant zamtrt zamtrs liefe anlhtxt zareapsf where anlhtxt = tdetail-anlhtxt.
else.
move-corresponding tdetail to finalit.
append finalit.
endif.
endloop.
move tdetail[] to ttdetail[].
endcase.
endmodule. " exit_screen9006 INPUT
Dear Jim,
You'll need to go the 'Change Object' as is done by SAP normally in their standard transactions.. But yes for that you'll need to check the feasibility of creating the Change Object...
Else go the route Rich has advised..
Cheers
Nitesh
Add a comment