Application Development and Automation 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: 
Read only

delete from internal table

Former Member
0 Likes
849

Hi,

I want to delete from internal table some regords.

I write code:

delete isrot where bldat < '01.09.2005'.

it doesn't work, what is wrong?

regards,

Joanna

9 REPLIES 9
Read only

Former Member
0 Likes
816

could be the date format..

store the date in a variable of type sydatum & then try the delete ie

data: w_date type sydatum.

w_date = '20050901'.

delete isrot where bldate lt w_date.

Arya

Read only

ferry_lianto
Active Contributor
0 Likes
816

Hi,

Please try this.


delete isrot where bldat < '20050901'.

Regards,

Ferry Lianto

Read only

JozsefSzikszai
Active Contributor
0 Likes
816

hi Joanna,

you should write

DELETE isrot WHERE bldat < '20050901'.

i. e. the date must be in YYYYMMDD format and without the dots (like internally, you can check this in debug mode).

hope this helps

ec

Read only

0 Likes
816

I tried but in this case program doesn't work, it doesn't show data.

Joanna

Read only

0 Likes
816

Joanna - I think Ferry's and Eric's code is correct. If it's still not working then the problem lies elsewhere. Can you post your code please?

Rob

Read only

Former Member
0 Likes
816

Try :

delete isrot where bldat < '20050109'.

Read only

RaymondGiuseppi
Active Contributor
0 Likes
816

Conversion Exits are not active in Abap source

You have to write the constants in internal format, in this case :

DELETE isrot WHERE bldat < '20090901'.

Regards

Read only

Former Member
0 Likes
816

hi,

you write the statement like....

<b>delete FROM isrot where bldat < '01.09.2005'.</b>

now it will work...

To select the lines that you want to delete using a condition, use the following:

<b>DELETE FROM <target> WHERE <cond> .</b>

All of the lines in the database table that satisfy the conditions in the WHERE clause are deleted. The FROM expression must occur between the keyword and the database table.

You should take particular care when programming the WHERE clause to ensure that you do not delete the wrong lines. For example, if you specify an empty internal table in a dynamic WHERE clause, all of the lines in the table are deleted.

If at least one line is deleted, the system sets SY-SUBRC to 0, otherwise to 4. SY-DBCNT contains the number of lines deleted.

follow this link for more information on internal table operation.

http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3aef358411d1829f0000e829fbfe/content.htm

regards,

Ashok Reddy

Message was edited by:

Ashok Reddy

Read only

0 Likes
816

DELETE FROM is for database not internal tables, I think.

DELETE isrot WHERE bldat < '20050901' is correct so there must be something else wrong.