01-05-2007 9:05 AM
Hi,
How can i deleted a record from a z table using abap.
Regards,
Naveen
01-05-2007 9:09 AM
01-05-2007 9:10 AM
ex-
DATA wa TYPE sbook.
wa-carrid = 'LH'.
wa-connid = '0400'.
wa-fldate = '20010228'.
wa-bookid = '00000003'.
DELETE sbook FROM wa.
01-05-2007 9: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.
01-05-2007 9: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
01-05-2007 9:21 AM
Hi Naveen,
delete from ztable where (conditions).
Thanks
Vikranth Khimavath
01-05-2007 9: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
01-10-2007 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