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

Problem with EVENT 01 in Table maintenance

Former Member
0 Likes
3,830

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.

1 ACCEPTED SOLUTION
Read only

kiran_k8
Active Contributor
0 Likes
1,770

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.

5 REPLIES 5
Read only

Former Member
0 Likes
1,770

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

Read only

Former Member
0 Likes
1,770

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

Read only

Former Member
0 Likes
1,770

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

Read only

Former Member
0 Likes
1,770

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

Read only

kiran_k8
Active Contributor
0 Likes
1,771

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.