‎2007 May 22 10:28 PM
i have an itab ITAB1 , with a field NAME which is supposed to have many A's, but
i have to report error if all entries are A's.
LOOP AT ITAB1 WHERE NAME .....................
WRITE: / 'ERROR'.
EXIT.
ENDLOOP.
what do i put in the where clause.
plz help
‎2007 May 22 10:39 PM
‎2007 May 22 10:39 PM
‎2007 May 22 10:40 PM
I did not quite get it.
Do you have to report an error if all the entries in internal table are 'A' or do you have to report an error if all the character in field NAME are 'A'?
Can you please give more details?
If you need to check whether all the entries in table are 'A' or not then you can use:
CLEAR FLAG.
LOOP AT ITAB1 WHERE NAME <b><> 'A'</b>.
FLAG = 'X'.
ENDLOOP.
IF FLAG = ' '.
WRITE 'ERROR'.
ENDIF.
Message was edited by:
Darshil Shah
‎2007 May 22 10:49 PM
Saritha,
This statement will work if you still need the EXIT.
READ TABLE itab1 INTO wa_itab1 WITH KEY name = 'A'.
if sy-subrc = 0.
WRITE: /'ERROR'.
endif.
‎2007 May 22 10:49 PM
‎2007 May 22 10:53 PM
felip , i think you did not get my point.
your code returns sy-subrc as soon as it gets first A entry and reports error at very first entry.
but my situation was if all the entries were A's it should give error.
but anyways i got solution.
good try, thank you.