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 rows in database table

Former Member
0 Likes
692

Hi ,

I need to delete all the records in the dtabase table and insert new data into it.

I use the below code , but the delete returns with sy-subrc 4 and doesnt delete the records in table ?

delete ZZVT2_BW.

commit work and wait.

insert ZZVT2_BW from table itab_zvt2 accepting duplicate keys.

commit work and wait.

Thanks,

5 REPLIES 5
Read only

Former Member
0 Likes
637

Hello,

DELETE ZZVT2_BW WHERE.....

Vasanth

Read only

Former Member
0 Likes
637

Hi ,

u can use DELETE FROM dbtab.

in your case write

delete from ZZVT2_BW.

INSERT dbtab FROM TABLE itab.

Regards,

Sruthi.v

Read only

Former Member
0 Likes
637

Use

<b>DELETE dbtab FROM TABLE itab.</b>

Read only

Former Member
0 Likes
637

Deleting from a Database Table

<b>- DELETE FROM dbtab. or

DELETE FROM (dbtabname).</b>

- DELETE dbtab FROM wa. or

DELETE (dbtabname) FROM wa.

- DELETE dbtab FROM TABLE itab. or

DELETE (dbtabname) FROM TABLE itab.

- DELETE dbtab. or

DELETE *dbtab.

- DELETE dbtab VERSION vers. or

DELETE *dbtab VERSION vers.

use the bold text in u r program

Read only

Former Member
0 Likes
637

Depending on the size of the table you might want to check this <a href="https://forums.sdn.sap.com/click.jspa?searchID=-1&messageID=2749963">thread</a>.

It basically describes how to use function module DD_DATABASE_UTILITY to delete big tables (i.e. deleting ALL records).

Guenther