12-26-2007 4:18 AM
Hi Folks,
Does the delete statement works only for internal tables?
I want to delete some entries from a ztable.
TABLES:ZMM__DER.
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
SELECT-OPTIONS: S_DATE FOR ZMM_DER-RUNDAT OBLIGATORY,
SELECTION-SCREEN END OF BLOCK B1.
DELETE ZMM_DER WHERE RUNDAT IN S_DATE.
K.Kiran.
12-26-2007 4:23 AM
Hi,
Delete statement is used to delete records for both internal table and database table.
For Database table :
DELETE FROM zmm_der WHERE rundat IN s_date.
Sytax:
DELETE FROM dbtab WHERE cond.
Edited by: Ramesh Hirial on Dec 26, 2007 1:23 PM
12-26-2007 4:23 AM
Hi,
Delete statement is used to delete records for both internal table and database table.
For Database table :
DELETE FROM zmm_der WHERE rundat IN s_date.
Sytax:
DELETE FROM dbtab WHERE cond.
Edited by: Ramesh Hirial on Dec 26, 2007 1:23 PM
12-26-2007 4:33 AM
Hi,
Code which u mentioned can only delete records from internal table it won't work for database table for deletion record from dbtab u have to use delete from clause.
Regards
Gagan
12-26-2007 4:44 AM
Hi Kiran,
Delete statement is used to delete records for both internal table and database table.
For Database table :
PARAMETERS p_carrid TYPE sflight-carrid.
DELETE FROM sflight
WHERE carrid = p_carrid AND
fldate = sy-datum AND
seatsocc = 0.
For Internal table.
PARAMETERS p_carrid TYPE scarr-carrid.
DATA scarr_tab TYPE SORTED TABLE OF scarr
WITH UNIQUE KEY carrid.
SELECT *
FROM scarr
INTO TABLE scarr_tab.
READ TABLE scarr_tab WITH TABLE KEY carrid = p_carrid
TRANSPORTING NO FIELDS.
IF sy-subrc = 0.
DELETE scarr_tab INDEX sy-tabix.
ENDIF.
Reward Points, if useful.
Regards,
Manoj Kumar