Application Development 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: 

What is the difference between 'DELETE DTAB' and 'DELETE FROM DTAB'

Former Member
0 Kudos

Hello

Can someone tell me the basic difference between the above the 2 commands?

Regards,

Srinivas.

1 ACCEPTED SOLUTION

prasenjit_sharma
Active Contributor
0 Kudos

Hi,

The usage is same, it all depends how you use it.

Regards

Prasenjit

6 REPLIES 6

prasenjit_sharma
Active Contributor
0 Kudos

Hi,

The usage is same, it all depends how you use it.

Regards

Prasenjit

Former Member
0 Kudos

delete from dtab can delete more than one line

delete dtab only deletes one line since it uses the whole primary key

Clemenss
Active Contributor
0 Kudos

F1

Former Member
0 Kudos

You can also do F1 on 'DELETE' and find these details in the SAP Keyword Documentation.

You didn't have to cut and paste it - the reference would have been good enough.

Edited by: Rob Burbank on Dec 9, 2009 5:24 PM

Former Member
0 Kudos

Let me be more specific

I have table ZTAB which has 100 records.

1. If I say: DELETE FROM ZTAB.

a. Will it wipe out the entire table; all the records along with the keys?

b. Or does it keep the key field and only delete the data for the other fields.

2. If I say: DELETE ZTAB.

a. Again, will it delete all the records in the table.. along with the header line or does CLEAR ZTAB do that?

My question revolves round the key field/s (in case of a composite key). What happens to this column in the table?

Moderator message - You should have been more specific to start with. The question you are asking now is different from the original one. But peple will probably not see this and contineue to answere your original question. So I'm going to lock this. If you still don't have your answer, please start a new thread, but make sure your question is specific.

Edited by: Rob Burbank on Dec 9, 2009 5:25 PM

Former Member
0 Kudos

1. The help is very clear. The Where condition is obligatory, delete from ztab would throw a syntax error.

2. delete ztab would delete the record that has the same primary key in the header line. If you want to delete an internal table, you need to use refresh (obsolete) or a clear to the internal table (not the header line of the table).

This is why you should never use header lines. Just adds unnecesary complexity to simple tasks