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 database table entries

Former Member
0 Kudos

hi experts,

can u plz send me a simple code to delete data from z table.

regards,

raman

7 REPLIES 7

valter_oliveira
Active Contributor
0 Kudos

Hello.

Use statement: DELETE FROM ztable WHERE ....

Regards.

Valter Oliveira.

Former Member
0 Kudos

Hi Raman,

Yes, Above answer is correct. We can use DELETE command for deleting records.

Regards,

Kumar.

Former Member
0 Kudos

Have you ever thought about pressing the F1 key on the keyword DELETE.

OR IS THAT TO EASY FOR YOU TO DO.

Former Member
0 Kudos

DELETE { {FROM target (WHERE sql_cond)}

| {target FROM source} }.

Effect

The statement DELETE deletes one or more rows from the database table specified in target. The rows that are to be deleted are specified either in a WHERE condition sql_cond or with data objects in source.

System Fields

The statement DELETE sets the values of the system fields sy-subrc and sy-dbcnt.

sy-subrc Meaning

0 A least one row was deleted.

4 At least one row could not be deleted, since it was not found in the database table.

Syntax

... WHERE sql_cond.

Effect

The WHERE addition uses a logical expression sql_cond to specify which rows in the database table are deleted. The same applies to the logical expression sql_cond as for the WHERE condition of the SELECT statement. If there is no row in the database that satisfies the WHERE condition, no row is deleted and sy-subrc is set to 4. If no WHERE condition is specified, all rows are deleted.

... FROM wa|{TABLE itab}.

Alternatives:

1. ... FROM wa

2. ... FROM TABLE itab

Effect

After FROM, you can specifiy a data object wa that is not table-type or an internal table itab. The content of the data objects determines the row(s) to be deleted.

thanks

Reward If useful

richa

Former Member
0 Kudos

You can use

DELETE <DB table name > FROM <Work Area>.

former_member181995
Active Contributor
0 Kudos

please use search help which already given by SDN.

I gave Delete database entry i got my answer.

please close this thread by giving mark.

Amit.

Former Member
0 Kudos

DELETE { {FROM target [WHERE sql_cond]}

| {target FROM source} }.

Example :

PARAMETERS p_carrid TYPE sflight-carrid.

DELETE FROM sflight

WHERE carrid = p_carrid AND

fldate = sy-datum AND

seatsocc = 0.

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.

if any other probs do let us know..