2014 Nov 20 5:40 PM
Dear All,
I am working on table control, i am looking to delete the data of z-table if that data is being deleted from table control. I have created a table control, in that data is coming form three tables. 2 of them are z-table and one is standard table. now what i want is, if we select a row fro table control and press delete, in that case it will delete the data from all the 3 tables. but in my case its only deleting the data from the final internal table in which i have saved the data from three database tables. So kindly suggest.
Thanks and regards
Jai
2014 Nov 20 6:21 PM
hi jaiprakash,
can you share the source of the delete so that it can be checked before giving any advise.
2014 Nov 21 3:53 AM
Dear Abdul,
refer the below code, as i have created 3 work area, moved the records of respective table to that work area, and then tried to delete from the database table, that is not working.
WHEN 'DELE'.
MESSAGE 'This will delete entire row,still you want to continue' TYPE 'W'.
READ TABLE it_main2 INTO wa_main2 WITH KEY mark = 'X'.
READ TABLE it_zexp_advice1 INTO wa_zexp_advice1 WITH KEY eorder = wa_main2-eorder
mark = 'X'.
DELETE it_main2 WHERE mark = 'X'.
DESCRIBE TABLE it_main2 LINES tc_it_main2-lines.
MOVE-CORRESPONDING wa_main2 TO wa_vbap1.
MOVE-CORRESPONDING wa_main2 TO wa_zexp_advice2.
MOVE-CORRESPONDING wa_main2 TO wa_zea_packaging2.
BREAK ABAP_BFL.
DELETE vbap FROM wa_vbap1.
DELETE zexp_advice FROM wa_zexp_advice2.
DELETE zea_packaging FROM wa_zea_packaging2.
Thanks and Regards
Jai
2014 Nov 21 7:22 AM
hi jaiprakash,
are you sure that there are values in the work area wa_vbap1?
2014 Nov 21 7:27 AM
Hi Jaiprakadsh,
my suggestion is add sy-subrc after read statement because whenever we use read statement then we have to check whether the data is moved to work area or not.
Tahnks,
Sree
2014 Nov 20 6:25 PM
Are you performing a COMMIT?
Also it does not sound correct to delete data from a standard SAP table. You should be very cautious in doing this.
2014 Nov 21 8:12 AM
HI ,
If you want to delete a particular record then use where condition for delete
DELETE { {FROM target [WHERE sql_cond]}
| {target FROM source} }.
thanks
Vijay