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 table at database level using ABAP report

Former Member
0 Likes
2,496

Hi,

Can anyone tell me how we can delete a table at the database level using an ABAP report ?

5 REPLIES 5
Read only

Former Member
0 Likes
1,339

HI,

Yes you can do that by using Native SQL.

IF the DB is oracle then u can use Drop Ztab.

Regards

Naveen Gupta

PS: Reward Points if helpfull.

Read only

ThomasZloch
Active Contributor
0 Likes
1,339

try FM RPY_TABLE_DELETE or DB_DROP_TABLE.

Read only

Former Member
0 Likes
1,339

Hi try like this:

In a report program give a statement like:

Drop table <tablename>.

And execute this report program. Thats all, ur table gets deleted along with its structure in the DB level.

with regards,

Hema Sundara.

Read only

Former Member
0 Likes
1,339

Thanks guys, I created the report. I have reproduced it below...

REPORT zdeletetable.

EXEC SQL.

DROP TABLE ZTESTTABLE

ENDEXEC.

IF sy-subrc = 0.

WRITE:/ 'Table ztesttable deleted from the database !'.

ENDIF.

Read only

Former Member
0 Likes
1,339

Hi ,

You can only delete a transparent table in the ABAP Dictionary when it is no longer used in other objects .

Proceed as follows to delete a table:

Enter the name of the table in the initial screen of the ABAP Dictionary.

Select object type Tables.

Choose DD object ® Delete.

A dialog box appears asking you to confirm the deletion request again.

Confirm the deletion request.

If it is no longer used in other objects and there is no longer a corresponding database table, the table is now deleted.

The corresponding table definition must be deleted on the database before deleting the table. You will be informed in a dialog box if the table was already created on the database. You must confirm that you want to delete the database table in this dialog box. If you do not do so, the deletion will be canceled.