2008 Aug 07 4:48 AM
Hi Frns,
I need to write a program to delete data from ztable, and thats through exicutable.
pls suggest me with relavant code.
thanx
Rams
2008 Aug 07 5:02 AM
Hi,
Plz try below code that deletes 12 month old data from table.
SELECT mandt
representative
selection_id
sub_date
sub_time
superior
team
status
FROM zo9_user_status
INTO TABLE g_t_zo9_user_status_d
WHERE sub_date LT g_outdate.
IF sy-subrc = 0.
DELETE zo9_user_status FROM TABLE g_t_zo9_user_status_d.
IF sy-subrc = 0.
MESSAGE i029 WITH sy-dbcnt text-002 .
ENDIF.
ENDIF.
REFRESH g_t_zo9_user_status_d.
Hope this helps you.
Thanks,
Dhanashri.
2008 Aug 07 4:51 AM
Hi Rams,
You can make use od DELETE statement .
DELETE { {FROM target [WHERE sql_cond]}
| {target FROM source} }.
Please check this link
http://help.sap.com/saphelp_webas630/helpdata/en/a4/35ff395ef548e5add909b73ca12878/content.htm
Best regards,
raam
2008 Aug 07 5:03 AM
thanx.
is it effect on database table or not.
i mean,
if i run ztable with se16 , the data which i deleted from Exicutable
should not be display.
Thanx
Rams
2008 Aug 07 5:15 AM
Hi Rams,
Definitely, it has effect, the data gets deleted from the table and will not be displayed fro SE16. Just perform the delete operation and check the data.
Regards,
Chandra Sekhar
2008 Aug 07 4:55 AM
Hi Ram,
Sort table that will give system less burden and performance will be high.
check this one DELETE ZTABLE WHERE <appropriate where clause>
Mohinder
Edited by: Mohinder Singh Chauhan on Aug 7, 2008 5:56 AM
2008 Aug 07 4:56 AM
Delete from ztable where fieldname = "X".
here X indicates the value of that fieldname. So based on the where condition it will delete the records from that ztable.
2008 Aug 07 4:58 AM
Hi
Try...
DELETE FROM <ZTABLE> [ WHERE <COND>].
Hope it helps.
Murthy
2008 Aug 07 5:02 AM
Hi,
Plz try below code that deletes 12 month old data from table.
SELECT mandt
representative
selection_id
sub_date
sub_time
superior
team
status
FROM zo9_user_status
INTO TABLE g_t_zo9_user_status_d
WHERE sub_date LT g_outdate.
IF sy-subrc = 0.
DELETE zo9_user_status FROM TABLE g_t_zo9_user_status_d.
IF sy-subrc = 0.
MESSAGE i029 WITH sy-dbcnt text-002 .
ENDIF.
ENDIF.
REFRESH g_t_zo9_user_status_d.
Hope this helps you.
Thanks,
Dhanashri.