‎2007 Sep 14 3:04 PM
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
‎2007 Sep 14 3:08 PM
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
‎2007 Sep 14 3:08 PM
Hi,
Please try this.
delete isrot where bldat < '20050901'.
Regards,
Ferry Lianto
‎2007 Sep 14 3:09 PM
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
‎2007 Sep 14 3:12 PM
I tried but in this case program doesn't work, it doesn't show data.
Joanna
‎2007 Sep 14 3:50 PM
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
‎2007 Sep 14 3:10 PM
‎2007 Sep 14 3:10 PM
‎2007 Sep 14 3:13 PM
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
‎2007 Sep 14 3:45 PM
DELETE FROM is for database not internal tables, I think.
DELETE isrot WHERE bldat < '20050901' is correct so there must be something else wrong.