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: 

Deletion

kiran_k8
Active Contributor
0 Kudos

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.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

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

3 REPLIES 3

Former Member
0 Kudos

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

former_member194152
Contributor
0 Kudos

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

former_member402443
Contributor
0 Kudos

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