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

delete ztable data thru Exicutable report

Former Member
0 Likes
957

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
939

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.

7 REPLIES 7
Read only

Former Member
0 Likes
939

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

Read only

0 Likes
939

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

Read only

0 Likes
939

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

Read only

Former Member
0 Likes
939

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

Read only

Former Member
0 Likes
939

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.

Read only

former_member787646
Contributor
0 Likes
939

Hi

Try...

DELETE FROM <ZTABLE> [ WHERE <COND>].

Hope it helps.

Murthy

Read only

Former Member
0 Likes
940

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.