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 all the database table content

Former Member
0 Likes
9,521

Hello Friends,

I have a z table with 5 fields (all the key fields) and I want to delete all the table content and load fresh content from internal table.

I tried using syntax 'delete ztable' but sy-subrc value is coming as 4, means no table content is getting deleted.

Please suggest me any alternative way to delete all the database table content.

Thanks in advance,

Shreekant

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
3,432

Hi Shreeekant,

You can do on thing. First take all data in to the internal table for which u want to delete.

then use command DELETE <databse tablename> FROM TABLE <itab> .

It will delete all the etries from ur desired table.

Rgds,

Sachin.

9 REPLIES 9
Read only

Former Member
0 Likes
3,432

Hi,

to delete a Ztable you can use key word : ' Delete from '

delete from Ztable.

try this

safel.

Read only

Former Member
0 Likes
3,432

Hi Use

DELETE from ZTABLE.

It will work

Thanks,

Mathivanan.G

Read only

Former Member
0 Likes
3,432

Using DELETE tablename or DELETE FROM tablename

or by writing some piece of code u can delete

tables: ztable.

data: itab type table of ztable.

select * from ztable into table itab.

if sy-subrc = 0.

delete ztable from table itab.

endif.

Read only

Former Member
0 Likes
3,432

Need to use DELETE FROM <DATABASE TABLE>. Your statment works for internal tables.

Read only

Former Member
0 Likes
3,433

Hi Shreeekant,

You can do on thing. First take all data in to the internal table for which u want to delete.

then use command DELETE <databse tablename> FROM TABLE <itab> .

It will delete all the etries from ur desired table.

Rgds,

Sachin.

Read only

former_member632458
Participant
0 Likes
3,432

Hi,

Got Transaction Se14 and delete activate and adjust by selecting radiobutton

' Delete Data'

It will work Fine.

Warm Regards,

rajesh S.

Read only

Former Member
0 Likes
3,432

Hi,

Use like this

delete from ztable.

Regards,

Jyothi CH.

Read only

Former Member
0 Likes
3,432

Go into the data browser area of ur table..

select the record u want to delete ...

put /h in the command line and enter .....now debugger will be on ... and from here u can do somthing ...

.. i dont know whether i sld disclose it openly !! Its little sensitive..

Read only

Former Member
0 Likes
3,432

Hi,

try using

delete from ztable.

This will delete all records from your ztable. After this command u can fill your ztable from itab by the following command

select *

from std table

into corresponding fields of itab.

insert ztable from table itab.

Hopefully this will solve your problem.

Regards,

Ibrar