‎2009 Dec 31 6:57 AM
Hi,
I have used event 'before saving to database table' (01) in table maintenance generator and done some changes to the fileds. when I enter values they are getting saved in the database. but if i delete any entry form table maintenance and when I try to save, values are not getting deleted from database table.
My code in the event form is :
FORM abc.
DATA: F_INDEX LIKE SY-TABIX. "Index to note the lines found
LOOP AT TOTAL.
IF <ACTION> = desired constant.
READ TABLE EXTRACT WITH KEY TOTAL.
IF SY-SUBRC EQ 0.
F_INDEX = SY-TABIX.
ELSE.
CLEAR F_INDX.
ENDIF.
Make desired changes to the line TOTAL
TOTAL-uname = sy-uname.
TOTAL-udate = sy-datum
MODIFY TOTAL.
CHECK F_INDX GT 0.
EXTRACT = TOTAL.
MODIFY EXTRACT INDEX F_INDX.
ENDIF.
ENDLOOP.
SY-SUBRC = 0.
ENDFORM.
Can anyone solve this problem.
Thank you,
Regards,
Kusuma K.
‎2009 Dec 31 8:39 AM
Kusuma,
Check the below give link,may be it can give you some lead
http://wiki.sdn.sap.com/wiki/pages/viewpage.action?pageId=93454609
Kiran.
‎2009 Dec 31 7:21 AM
Hi Kusuma,
I dont think the event 01 , has any thing to do with deleting data from table , it is just used to do some check / modification before the data is saved in the table,.
After deleting the data , please save it and exit from the transaction and then again check if the data was deleetd or not , because i assume that the deleting is done as the last step .
Please feel free to revert in case of more questions.
Regards,
Arun
‎2009 Dec 31 7:22 AM
Hi Kusuma,
For deleting a entry from database, you need to use the primary keys.
On the basis of index, it won't work.
Try this using Primary Key.
I hope it will help you.
Thanks & Regards,
Nidhi kothiyal
‎2009 Dec 31 8:02 AM
You logic will work when any of the record is modified .
You need to consider the case in which a record is deleted from the internal table.
Check rhis.
Edited by: Harsh Bhalla on Dec 31, 2009 1:38 PM
‎2009 Dec 31 8:39 AM
Thank you all. Problem is solved. I need to check status of the action. STATUS-ACTION should be equal to HINZUFUEGEN
Regards,
Kusuma K.
Edited by: kusuma kurapati on Dec 31, 2009 2:09 PM
‎2009 Dec 31 8:39 AM
Kusuma,
Check the below give link,may be it can give you some lead
http://wiki.sdn.sap.com/wiki/pages/viewpage.action?pageId=93454609
Kiran.