‎2006 Sep 01 10:38 AM
hi friends,
i am using read statement as per my requirement follws
READ TABLE ITAB INTO WA_TAB WITH KEY
VBTYP_N = 'H' OR
VBTYP_N = 'O' OR
VBTYP_N = 'P'.
BUT ITS GIVING ERROR MESSAGE.
PLZ HELP MW HOW CAN I GIVE CORRECT READ STATEMENT
REGARDS,
SIREESHA
‎2006 Sep 01 10:46 AM
Hi,
Try the following :
read table itab into wa_tab transporting vbtyp.
CHECK VBTYP_N = 'H' OR
VBTYP_N = 'O' OR
VBTYP_N = 'P'.
****Now use ur logic here.
This should solve ur problem, reward points.
Regards
‎2006 Sep 01 10:40 AM
Hi,
Check whether your itab is a sorted itab, otherwise sort before read statement. Use statements separately.
Regards
Senthil
Message was edited by: senthil kumar
‎2006 Sep 01 10:41 AM
you cant us or statement in your read.
YOu hasve to do separate statments for every condition.
BR, JAcek
(read salp help about read statement - there are examples)
‎2006 Sep 01 10:41 AM
U can't use OR option with READ statament, so
READ TABLE ITAB INTO WA_TAB WITH KEY VBTYP_N = 'H'.
IF SY-SUBRC <> 0
READ TABLE ITAB INTO WA_TAB WITH KEY VBTYP_N = 'O'.
IF SY-SUBRC <> 0
READ TABLE ITAB INTO WA_TAB WITH KEY VBTYP_N = 'P'.
ENDIF.
ENDIF.
or
V_VBTYP = 'H'.
DO 3 TIMES.
READ TABLE ITAB INTO WA_TAB WITH KEY VBTYP_N = V_VBTYP.
IF SY-SUBRC = 0. EXIT. ENDIF.
CASE V_VBTYP.
WHEN 'H'. V_VBTYP = 'O'.
WHEN 'O'. V_VBTYP = 'P'.
ENDCASE.
ENDDO.
Max
‎2006 Sep 01 10:44 AM
read table statment not support logivcal opration .
like or ,and
‎2006 Sep 01 10:46 AM
Hi,
Try the following :
read table itab into wa_tab transporting vbtyp.
CHECK VBTYP_N = 'H' OR
VBTYP_N = 'O' OR
VBTYP_N = 'P'.
****Now use ur logic here.
This should solve ur problem, reward points.
Regards
‎2006 Sep 01 10:46 AM
read do not support 'OR' operators
u can try following
loop at itab into WA_TAB where VBTYP_N = 'H' OR
VBTYP_N = 'O' OR
VBTYP_N = 'P'.
endloop.
regards
Atul
‎2006 Sep 01 10:50 AM
Hi Sireesha,
U have to declare the READ statement as
for example
READ TABLE ITAB WITH KEY matnr = <<some variable>>
werks = <<some variable>>
U can't use 'OR' or 'AND' statements.
Regards,
Nagaraj
‎2006 Sep 01 10:50 AM
hi,
You cannot use OR key word with read statement.
as per your requiremetn you can write three different read statement.
READ TABLE ITAB INTO WA_TAB WITH KEY VBTYP_N = 'H' .
if sy-subrc <> 0.
READ TABLE ITAB INTO WA_TAB WITH KEY VBTYP_N = 'O'.
if sy-subrc <> 0.
READ TABLE ITAB INTO WA_TAB WITH KEY VBTYP_N = 'P'.
if sy-subrc <> 0.
*record not found
endif.
endif.
endif.Regards,
Richa
‎2006 Sep 01 10:52 AM
hi,
We can not use logical operators when specifying conditions after WITH KEY.
Even, we can not use any operator other than <b>=</b>. we can not even use <b>EQ</b> with READ statement.
data: v_cnt type i.
clear itab.
read table itab into wa_tab with key vbtyp_n = 'H'.
if sy-subrc = 0.
v_cnt = v_cnt + 1.
endif.
clear itab.
read table itab into wa_tab with key vbtyp_n = 'H'.
if sy-subrc = 0.
v_cnt = v_cnt + 1.
endif.
clear itab.
read table itab into wa_tab with key vbtyp_n = 'H'.
if sy-subrc = 0.
v_cnt = v_cnt + 1.
endif.
if v_cnt > 1.
//your code
endif.Regards,
Sailaja.
‎2006 Sep 01 10:59 AM
Hi,
You can also loop through the internal table thus reading the entire table..
Loop at itab into wa_itab with the log. expression.
Regards