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

delete database table entries

hi experts,

can u plz send me a simple code to delete data from z table.

regards,

raman

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

7 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Jun 05, 2008 at 09:57 AM

    Hello.

    Use statement: DELETE FROM ztable WHERE ....

    Regards.

    Valter Oliveira.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 05, 2008 at 09:58 AM

    Hi Raman,

    Yes, Above answer is correct. We can use DELETE command for deleting records.

    Regards,

    Kumar.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 05, 2008 at 09:59 AM

    Have you ever thought about pressing the F1 key on the keyword DELETE.

    OR IS THAT TO EASY FOR YOU TO DO.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 05, 2008 at 09:59 AM

    DELETE { {FROM target (WHERE sql_cond)}

    | {target FROM source} }.

    Effect

    The statement DELETE deletes one or more rows from the database table specified in target. The rows that are to be deleted are specified either in a WHERE condition sql_cond or with data objects in source.

    System Fields

    The statement DELETE sets the values of the system fields sy-subrc and sy-dbcnt.

    sy-subrc Meaning

    0 A least one row was deleted.

    4 At least one row could not be deleted, since it was not found in the database table.

    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. If no WHERE condition is specified, all rows are deleted.

    ... FROM wa|{TABLE itab}.

    Alternatives:

    1. ... FROM wa

    2. ... FROM TABLE itab

    Effect

    After FROM, you can specifiy a data object wa that is not table-type or an internal table itab. The content of the data objects determines the row(s) to be deleted.

    thanks

    Reward If useful

    richa

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 05, 2008 at 10:00 AM

    You can use

    DELETE <DB table name > FROM <Work Area>.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jun 05, 2008 at 10:00 AM

    please use search help which already given by SDN.

    I gave Delete database entry i got my answer.

    please close this thread by giving mark.

    Amit.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 05, 2008 at 10:02 AM

    DELETE { {FROM target [WHERE sql_cond]}

    | {target FROM source} }.

    Example :

    PARAMETERS p_carrid TYPE sflight-carrid.

    DELETE FROM sflight

    WHERE carrid = p_carrid AND

    fldate = sy-datum AND

    seatsocc = 0.

    PARAMETERS p_carrid TYPE sflight-carrid.

    TYPES: BEGIN OF sflight_key,

    mandt TYPE sflight-mandt,

    carrid TYPE sflight-carrid,

    connid TYPE sflight-connid,

    fldate TYPE sflight-fldate,

    END OF sflight_key.

    DATA sflight_key_tab TYPE TABLE OF sflight_key.

    SELECT carrid connid fldate

    FROM sflight

    INTO CORRESPONDING FIELDS OF TABLE sflight_key_tab

    WHERE carrid = p_carrid AND

    fldate = sy-datum AND

    seatsocc = 0.

    DELETE sflight FROM TABLE sflight_key_tab.

    if any other probs do let us know..

    Add a comment
    10|10000 characters needed characters exceeded

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.