Skip to Content
author's profile photo Former Member
Former Member

Deletion in one shot.

Hi Guys,

i hava requirement after a condtion check ...if it becomes true ..i have to delete all the rows from that table.

can any body suggest me the statement which do this..

i got syntax from documentation like this.

To DELETE all the lines..

where condition must use a itab which is empty..

then u r able to delete all the lines in one shot..

But i need a simple soltuion.

any body help me plz.

i appreciate ur help in advance.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

8 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Oct 19, 2005 at 12:22 PM

    do you want to delete from an internal table or a DB table...

    for internal table....u can use clear itab[] or refresh itab once your condition is true.

    check <cond>

    refresh itab.

    for DB table...u can use <b>delete from dbtab</b>

    check <cond>

    delete from itab.

    rgds,

    PJ

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Oct 19, 2005 at 12:25 PM

    Hi,

    delete itab.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 19, 2005 at 12:27 PM

    Refresh itab

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 19, 2005 at 12:28 PM

    i want to delete from data base table only.

    i dont have any itab for this data to use <b>FROM</b> clause

    Delete from dbtab ...deletes only one record

    see the documentaion:

    <b>These are SAP-specific short forms used to delete one line of a database table</b>.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 19, 2005 at 12:35 PM

    hi,

    have you delete an internal table or a db table?

    for internal table you can use

    refresh your_table.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 19, 2005 at 12:36 PM

    I think, you have already asked this question.

    delete-clause-clarification

    Svetlin

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 19, 2005 at 12:45 PM

    Thanks to all of u.

    it seems to be where clause mandatory to delete all lines following is the extract from documentation.

    Dear Rajendra...

    i hope u have given right answer.

    let me check if it works.

    Thanks

    Note

    To delete all the lines in a table, you must specify a WHERE condition that is true for all lines. You can achieve this with

    ... WHERE f IN itab

    If the internal table itab is empty, such a condition would select all lines.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      strange....

      read this...

      DELETE dbtab - cond

      Syntax

      ... WHERE sql_cond.

      Effect

      The WHERE addition uses a logical expression sql_cond to specify which rows in the database table are deleted. The same applies to the logical expression sql_cond as for the WHERE condition of the SELECT statement. If there is no row in the database that satisfies the WHERE condition, no row is deleted and sy-subrc is set to 4. <b>If no WHERE condition is specified, all rows are deleted.</b>

      Note

      As of Release 6.10, specifying the WHERE condition is optional. Prior to Release 6.10, you had to specify the WHERE condition in this variant of the DELETE statement and you could not use dynamic logical expressions.

  • author's profile photo Former Member
    Former Member
    Posted on Oct 19, 2005 at 02:02 PM

    Hi Priyannk,

    Thanks for ur reply.

    I applied Rajendra logic , it is working but One thing if we include mandt in Where clause, we should mention CLIENT SPECIFIED. it is mandatory.

    Thanks rajendra..i rewarded u for ur helpful answer.

    6.10 version means what?

    I am using 4.6c version of SAP

    clarify me 6.10 means...

    Thanks in advance...

    RAJA

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      6.10 is the BASIS Release .

      46C is older release as compared to 6.10.

      ( SAP has various releases LIKE 40b-> 45b -> 46b.. )

      You are correct i.e. in 46C where condition is mandatory if you want to delete all the data .

      Priyank is also correct in saying that as of release 6.10 where clause is not manadatory and if not specified will delete all the data in table . This will not work for you as you are on 46C .

      So all the confusion due to version ( Basis Release ).

      Cheers.

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.