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: 

Delete a record from Data table

Former Member
0 Kudos

Hi,

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

Regards,

Naveen

7 REPLIES 7

Former Member
0 Kudos

Hi Naveen,

Please check this link,

Regards,

Hema.

    • Reward points if it is useful.

0 Kudos

ex-

DATA wa TYPE sbook. 
wa-carrid = 'LH'. 
wa-connid = '0400'. 
wa-fldate = '20010228'. 
wa-bookid = '00000003'. 

DELETE sbook FROM wa.

Former Member
0 Kudos

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.

Former Member
0 Kudos

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

Former Member
0 Kudos

Hi Naveen,

delete from ztable where (conditions).

Thanks

Vikranth Khimavath

Former Member
0 Kudos

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

Former Member
0 Kudos

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