‎2008 Dec 11 2:14 AM
I have an internal table called table1 with data as below:
col1
-
123
234
456
I would like to write a an one line condition check like this: (i.e. replace words between brackets with code)
IF (table1 has col1 with the data '234').
" do this code
ENDIF.
I'm not sure which function to use to do this. Do I have to first read the data then check the result count or can I just put it on one line like this?
‎2008 Dec 11 2:17 AM
use
read table table1 with key col1 = 'xxxx'.
if sy-subrc = 0.
endif.
‎2008 Dec 11 2:17 AM
use
read table table1 with key col1 = 'xxxx'.
if sy-subrc = 0.
endif.
‎2008 Dec 11 2:23 AM
ok, so it looks like I do need two lines. Thanks for your help.
‎2008 Dec 11 2:21 AM
Loop at itb1.
If itab1-col1 = '234'.
Do this.
else.
Do this.
endif.
Endloop.