‎2009 Jul 09 2:11 PM
Hi,
can i write a Read table like for example,
read table itab into wa_itab with key matnr ne '4'.
as its giving me an error.
can suggest any other way to write the Read Table statement.
Thanks in advance.
Robert
‎2009 Jul 09 2:13 PM
‎2009 Jul 09 2:17 PM
Hi,
READ with NE is not possible.
You will have to make use of LOOP.
Regards,
Ankur Parab
‎2009 Jul 09 2:19 PM
in the READ TABLE statement you can ONLY compare on equality, not on differences, unequality or ranges.
for your requirement use
Loop at itab into wa where XXX. "your criterias here
endloop.
‎2009 Jul 09 2:20 PM
‎2009 Jul 09 2:21 PM
Hi Robert,
Use Loop instead of Read statement.
Or declare itab1 like itab.
itab1[] = itab[].
delete itab1 where matnr ne '4'.
then loop it so that there will be less entries in table.
Regards,
Vijay
‎2009 Jul 09 2:22 PM
Hi,
it is not possible.
try this way..
"delete the material which is not equal to 4 ..now itab contains values matnr ne4
delete table itab where matnr ne '4'.
or
loop at itab into wa_itab wher matnr ne '4'.
"move to another table
endloop.
or
loop at itab into wa_itab .
if wa_itab-matnr ne '4'.
continue
"move to another table
else.
delete itab index sy-tabix.
endif.
endloop.
prabhudas
‎2009 Jul 09 2:22 PM
Hi,
If matnr = '4', then you can write the read statement as
Read table itab into wa_itab with key matnr = '4'.
if matnr NE 4, then you may be having more than one record in itab, then read statement can't be used. Read statement can read only one record from itab. then you have to use Loop and endloop.
loop at itab into wa_itab where matnr = '4'.
-
-
endloop.
Hope this is helpful.
Regards
Ramesh.
‎2009 Jul 09 2:23 PM
read table itab into wa_itab with key matnr ne '4'. "not possible
read table itab into wa_itab with key matnr eq '4'. "not possible
read table itab into wa_itab with key matnr = '4'. "Possible
‎2009 Jul 09 2:30 PM
Please press F1 on Read before posting basic questions - thread locked.
And please do not answer these sorts of questions.
Rob
Edited by: Rob Burbank on Jul 9, 2009 9:30 AM