Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

problem in read statement

Former Member
0 Kudos

hi,

my code is ;

select vbeln audat kunnr auart

from vbak

into table t_vbak2

for all entries in t_vbfa2

where vbeln = t_vbfa2-vbelv

and audat in r_daterange

and kunnr = partner_number.

if not t_vbak2[] is initial.

sort t_vbak2 by vbeln audat auart.

endif.

now if i use read statement :

read table t_vbak2 into wa_vbak2

with key vbeln = wa_vbfa1-vbelv

audat in r_daterange

kunnr = partner_number binary search.

i get a syntax error.

can any one help me with this..

Thanks,

Challa.

1 ACCEPTED SOLUTION

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

You can't use the IN operator in your READ statement, only = as you are trying to read with key. In your case, you must use the LOOP statement.

Loop at t_vbak2 into wa_vbak2
          where vbeln = wa_vbfa1-vbelv
             and audat in R_daterange
             and kunnr = Partner_Number.

* Do whatever you need to do
Exit.   " This is so you only read one record.
Endloop.

Regards,

RIch Heilman

2 REPLIES 2

Former Member
0 Kudos

Hi

check what type of error you are getting

May be you can't use the IN parameter with ranges like where condition of select in READ

so have to use only EQUAL symbol

Regards

Anji

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

You can't use the IN operator in your READ statement, only = as you are trying to read with key. In your case, you must use the LOOP statement.

Loop at t_vbak2 into wa_vbak2
          where vbeln = wa_vbfa1-vbelv
             and audat in R_daterange
             and kunnr = Partner_Number.

* Do whatever you need to do
Exit.   " This is so you only read one record.
Endloop.

Regards,

RIch Heilman