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

Delete a record from Data table

Hi,

How can i deleted a record from a z table using abap.

Regards,

Naveen

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

6 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Jan 05, 2007 at 09:09 AM

    Hi Naveen,

    Please check this link,

    delete

    Regards,

    Hema.

    • Reward points if it is useful.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 05, 2007 at 09:13 AM

    Hi Naveen

    <b>Deleting from a Database Table</b>

    - DELETE FROM dbtab. or

    DELETE FROM (dbtabname).

    - DELETE dbtab FROM wa. or

    DELETE (dbtabname) FROM wa.

    - DELETE dbtab FROM TABLE itab. or

    DELETE (dbtabname) FROM TABLE itab.

    - DELETE dbtab. or

    DELETE *dbtab.

    - DELETE dbtab VERSION vers. or

    DELETE *dbtab VERSION vers.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 05, 2007 at 09:15 AM

    hi

    http://help.sap.com/saphelp_nw04/helpdata/en/a4/35ff395ef548e5add909b73ca12878/content.htm

    or

    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. 
    
    -------------------------------------------
    
    PARAMETERS p_carrid TYPE sflight-carrid. 
    
    DELETE FROM sflight 
    WHERE  carrid = p_carrid AND 
           fldate = sy-datum AND 
           seatsocc = 0. 
    
    

    thx

    rams

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 05, 2007 at 09:21 AM

    Hi Naveen,

    delete from ztable where (conditions).

    Thanks

    Vikranth Khimavath

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 05, 2007 at 09:24 AM

    Hi Naveen,

    DELETE FROM <dbtab> [CLIENT SPECIFIED] WHERE <full_qualified_key>.

    The syntax specified above for the DELETE command enables you to delete a single row in a database table. In this syntax version, you must define the record to be changed in the WHERE clause by exactly specifying all the key field evaluations. For details on specification of a possibly existing MANDT field, refer to the graphic, Accessing Client-Specific Tables. n A row can also be deleted from views. However, the view must already be created in the ABAP Dictionary with the maintenance status read and change and must contain only fields from a table. This DELETE variant has the following return codes:

    0 = Line was deleted.

    4 :=Line could not be deleted because, for example, it does not exist in the database.

    Alternative syntax : DELETE <dbtab> [CLIENT SPECIFIED] FROM <wa>.

    With this syntax version, the structure <wa> must have the same structure as the records in the respective database table and must be filled with the key fields of the records to be deleted before the command is called. However, the key field MANDT, which possibly exists in <wa>, is only taken into consideration if the CLIENT SPECIFIED addition is specified (otherwise the execution client

    applies).

    Regards,

    Balaji

    *Rewards for useful answers

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 10, 2007 at 11:59 AM

    deleting from tables is a risky job and you should avoid it but still,

    delete db from wa

    this will simply do,

    please rewadr points

    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.