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

Deleting Database Contents

Former Member
0 Likes
923

Hi,

I want to delete the contents of my table. I have the following requirements:

(*) i want to specify the table name dynamically

(*) i dont want to provide any where/from condition in the delete statement

(*) i want to delete all the contents of the database.

<b>I am working on 4.0B version.</b>

Is this possible ?

thanks

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
893

Hi Navneeth,

PARAMETERS:

pa_dbnam TYPE tabname.

DELETE FROM (pa_dbnam)

WHERE mandt = syst-mandt.

Ofcourse this is a VERY dangerous progam!

Regards,

John.

Hi Navneeth,

PARAMETERS:

pa_dbnam TYPE tabname.

DELETE FROM (pa_dbnam)

WHERE mandt = syst-mandt.

Ofcourse this is a VERY dangerous progam!

Regards,

John.

7 REPLIES 7
Read only

Former Member
0 Likes
894

Hi Navneeth,

PARAMETERS:

pa_dbnam TYPE tabname.

DELETE FROM (pa_dbnam)

WHERE mandt = syst-mandt.

Ofcourse this is a VERY dangerous progam!

Regards,

John.

Read only

0 Likes
893

hi,

i dont want to specify any where condition. and i dont have any mandt field , i want to delete a custom table

Read only

Former Member
0 Likes
893

Personally, I wouldn't do this, but this should meet your requirements:


REPORT ztest MESSAGE-ID 00.
DATA: tab(10) VALUE 'ZTAB'.
DELETE FROM (tab).

Rob

Read only

0 Likes
893

HI,

Its now working in 4.0B its giving a error

"DELETE FROM dbtab" must be followed by "WHERE".

Read only

0 Likes
893

Then you will have to go to the data dictionary for the table, find a key field and add that to a dynamic WHERE.

Rob

Read only

Former Member
0 Likes
893

Hi,

Do you have this standard program RADCVBTC in 4.0B?

If you do then you can use to delete all contents of your custom program.

Also you can use database utility (SE14) to delete as well (if exits in 4.0B).

Regards,

Ferry Lianto

Read only

Former Member
0 Likes
893

Hi,

Make use of this:

Delete Dbtab(D/b table) from itab.

this will delete all the contents of the d/b table ,

urs,

seshu