‎2007 Jul 06 7:40 AM
I have created a table control which is fetching data from db table and displaying it.
I want to check, before exiting the table it should check to see if data has been modified and display a popup window to save.
Thanks,
Abhijeet.
‎2007 Jul 06 7:44 AM
Hi,
Suppose your data has come in itab , copy itab into jtab.
now again change whaterver you want in Table control , it will come into itab again
check if itab[] = jtab[]. then give popup message.
Reward if useful!
‎2007 Jul 06 7:44 AM
Hi,
Suppose your data has come in itab , copy itab into jtab.
now again change whaterver you want in Table control , it will come into itab again
check if itab[] = jtab[]. then give popup message.
Reward if useful!
‎2007 Jul 06 8:04 AM
Hi Abhijeet,
do the following
In PBO do the following.
if flag is initial.
select * into table itab1 from vbak.
itab2[] = itab1[].
flag = 'X'.
endif.
in the PAI event, do the following.
if itab1[] NE itab2[].
message 'DATA CHANGED' Type 'I'.
endif.
Regards,
Niyaz
‎2007 Jul 06 8:22 AM
What u can do is when user press EXIT, u can save your own value in
OK_CODE = 'SAVE_EXIT'.
in USER_COMMAND write the code like below as an e.g.
WHEN 'SAVE_EXIT'.
CLEAR OK_CODE.
LOOP AT ITAB.
select single * from ZTAB
WHERE
KEY1 EQ ITAB-KEY1 AND "Key Field
KEY2 EQ ITAB-KEY2 AND "Key Field
FIELD NE ITAB-FIELD. "Field Check for change
IF SY-SUBRC EQ 0.
OK_CODE = 'SAVE_EXIT'.
EXIT.
ENDIF.
ENDLOOP.
IF SY-SUBRC EQ 0 AND OK_CODE EQ 'SAVE_EXIT'.
CLEAR OK_CODE.
PERFORM ASK_FOR_SAVE.
ELSE.
CLEAR OK_CODE.
LEAVE TO SCREEN 0.
ENDIF.
&----
*& Form ASK_FOR_SAVE
&----
text
----
--> p1 text
<-- p2 text
----
FORM ASK_FOR_SAVE.
CALL FUNCTION 'POPUP_TO_CONFIRM_STEP'
EXPORTING
DEFAULTOPTION = 'Y'
TEXTLINE1 = 'Do you want to Save Data?'
TITEL = 'Save Data?'
START_COLUMN = 25
START_ROW = 6
IMPORTING
ANSWER = ANS.
IF ANS EQ 'J'. "Yes
PERFORM SAVE.
LEAVE TO SCREEN 0.
ELSEIF ANS EQ 'N'. "No
LEAVE TO SCREEN 0.
ELSE. "Cancel
ENDIF.
ENDFORM. " ASK_FOR_SAVE
&----
*& Form SAVE
&----
text
----
--> p1 text
<-- p2 text
----
FORM SAVE.
LOOP AT ITAB.
select single * from ZTAB
WHERE
KEY1 EQ ITAB-KEY1 AND "Key Field
KEY2 EQ ITAB-KEY2 AND "Key Field
FIELD NE ITAB-FIELD. "Field Check for change
IF SY-SUBRC EQ 0.
UPDATE ZIFRSIT002
SET
Whatever u wanna Update
WHERE
KEY1 EQ ITAB-KEY1 AND "Key Field
KEY2 EQ ITAB-KEY2. "Key Field
IF SY-SUBRC EQ 0.
MESSAGE S214(ZIFI) WITH
'Database updated successfully...'.
ENDIF.
ENDIF.
ENDLOOP.
COMMIT WORK.
ENDFORM. " SAVE
‎2007 Jul 06 8:27 AM
HI.
case.
when 'SAVE'.
modify dbt.
if sy-subrc = 0.
messge 'Data updated succusfully'type 'S'.
end case.
reward all helpfull answers.
Regards.
Jay