2007 May 22 9:38 PM
hello friends,
i was trying to execute the following .
read table itab1 with key name NE 'A'.
if sy-subrc = 0.
write:/ ' error'.
endif.
it says " Unable to interpret 'NE'. possible causes of error : incorrect spelling.
can any one tell what my mistake is.
2007 May 22 9:52 PM
Hi,
Yes, you need to use LOOP statement.
LOOP AT ITAB1 WHERE NAME NE 'A'.
WRITE: / 'ERROR'.
EXIT.
ENDLOOP.
Regards,
Ferry Lianto
Hi,
Yes, you need to use LOOP statement.
LOOP AT ITAB1 WHERE NAME NE 'A'.
WRITE: / 'ERROR'.
EXIT.
ENDLOOP.
Regards,
Ferry Lianto
2007 May 22 9:41 PM
You should not use ne operator in read table command,always you should use =
2007 May 22 9:43 PM
Hi Sarita,
do this
read table itab1 with key name Eq 'A'.
if sy-subrc ne 0.
write:/ ' error'.
endif.
Thanks
Venki
2007 May 22 9:49 PM
then how should i do if ,
i have to report error if name field has an entry other than 'A'.
cant i do that using read, if not then i have to use loop at.
2007 May 22 10:01 PM
Hello Saritha,
i have two internal table..
data : begin of i_jtab occurs 0,
empno like ztable-empno,
loc like ztable-loc,
end of i_jtab.
data : begin of itab1 occurs 0,
empno like ztable1-empno,
name like ztable1-name,
end of itab1.
let assume you have data in both internal table
loop at i_jtab.
read table itab1 with key empno = i_jtab-empno.
if sy-subrc eq 0.
if itab1-name = 'A'.
write:/ 'Error'.
endif.
endif.
endloop.
You should not use NE Condition in Read table and it will not support,so use = and then keep IF Condition below.
2007 May 22 9:52 PM
Hi,
Yes, you need to use LOOP statement.
LOOP AT ITAB1 WHERE NAME NE 'A'.
WRITE: / 'ERROR'.
EXIT.
ENDLOOP.
Regards,
Ferry Lianto
2007 May 22 10:08 PM
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |