06-19-2006 8:22 AM
I'm trying to delete rows from an internal table, but though the program gets activated the rows don't get deleted from the table! The rows that should not be deleted are the ones whose locno value is contained in select option p_sup, all others should be deleted.
SELECT-OPTIONS: p_sup FOR p_prdsel,
DELETE intab
WHERE locno NOT IN p_sup AND
COMMIT WORK.
When this didn't work I then also tryed to import the rows - with the values of locno that should be kept in intab - in an internal table intab1. The rows that should be deleted are the ones whose locno value is in intab1~locno.
DELETE intab
WHERE locno NOT IN intab1-locno.
This failed with the error: "intab1 is a table without a header line and therefore has no component called "LOCNO"".
Does anybody have an idea about why the above mentioned delete codes failed or how I should go about to delete rows from an internal table when select option or another internal table (intab1) contain rows that should not be deleted (NOT IN) from intab?
06-19-2006 8:47 AM
data: intab1 like intab occurs 0 with header line.
For this data definition I get the error: "When using "WITH HEADER LINE" the line type cannot be a table".
06-19-2006 8:25 AM
By the way the first code example is:
DELETE intab
WHERE locno NOT IN p_sup.
There is no:
... AND
COMMIT WORK...
06-19-2006 8:30 AM
Try this ..
DELETE intab
WHERE NOT locno = intab1-locno.
Regards,
Ravi
06-19-2006 8:32 AM
DELETE intab
WHERE locno NOT IN p_sup.
I THINK THIS IS NOT VALID COMMAND..
USE
DELETE intab
WHERE NOT locno = intab1-locno.
06-19-2006 8:36 AM
Hi,
<b>
DELETE intab
WHERE locno NE intab1-locno.
</b>
Rgds,
Jothi.
Mark useful answers.
06-19-2006 8:42 AM
<i>DELETE intab
WHERE locno NOT IN p_sup AND
COMMIT WORK</i>
loop at p_sub.
read table intab with key locno eq p_sub-locno.
if sy-subrc eq 0.
else.
delete intab.
endloop.
reward points if it helps
Regards
Gunjan
06-19-2006 8:40 AM
Hi ,
DELETE intab
WHERE locno NOT IN p_sup AND
COMMIT WORK.
i never used Commit Work ? how did u know abt Commit work along with <b>DELETE</b>first remove the commit work then check.
DELETE intab
WHERE locno NOT IN intab1-locno.
data defination should be like this.
data: intab1 like intab occurs 0 with header line.
so
regards
Prabhu
06-19-2006 8:41 AM
When I try suggested codes:
DELETE intab
WHERE NOT locno = intab1-locno.
or:
DELETE intab
WHERE locno NE intab1-locno.
I get the error "intab1 is a table without a header line and therefore has no component called "LOCNO"". The table intab1 is declared the same way as the table intab. Why do I get this error?
06-19-2006 8:47 AM
data: intab1 like intab occurs 0 with header line.
For this data definition I get the error: "When using "WITH HEADER LINE" the line type cannot be a table".
06-19-2006 8:57 AM
hi
create a work area and loop at the internal table and move the contents to wrokarea ...and do operations...
06-19-2006 9:29 AM
Thanx a lot for all the helpful suggestions, but Mr. Gunjan Kumar was the one who cracked the problem this time. Thank you Gunjan!
/ armin