04-27-2006 8:55 AM
Hi All,
I have a issue while using READ statement.
Issue IS:
In following Code
<b> SORT i_konv BY knumv.
LOOP AT i_ekbe INTO wa_ekbe.
CLEAR wa_konv.
READ TABLE i_konv WITH KEY knumv = wa_ekbe-knumv
kschl <> space
lifnr <> space
kwert <> space
BINARY SEARCH.
IF sy-subrc EQ 0.
ENDIF.
ENDLOOP.</b>
When i am checking syntax for above code it is giving error as <b>KSCHL <> SPACE LIFNR <> SPACE is not expected</b>.
Can anybody tell me what is the issue over here!
Thanks in advance.
Thanks & Regards,
Prasad.
04-27-2006 9:02 AM
Hi prasad,
I dont think you can do <> comparison in READ statment.
Try
READ TABLE i_konv WITH KEY knumv = wa_ekbe-knumv BINARY SEARCH.
use IF after reading, for this comparison.
Regards,
Tanveer.
Mark helpful answers.
04-27-2006 9:01 AM
Hi,
Ok i got the issue,
Only <b>=</b> can be used in <b>READ</b>.
Thanks,
Prasad.
04-27-2006 9:02 AM
04-27-2006 9:02 AM
A negative condition does not work with a read statement.Please try for a better option with the read.
Cheers
Nishanth
04-27-2006 9:05 AM
Hi,
I got the solution as:
SORT i_konv BY knumv.
LOOP AT i_ekbe INTO wa_ekbe.
CLEAR wa_konv.
READ TABLE i_konv INTO wa_konv
WITH KEY
knumv = wa_ekbe-knumv
BINARY SEARCH.
IF sy-subrc EQ 0.
IF wa_konv-kschl NE space OR
wa_konv-lifnr NE space OR
wa_konv-kwert NE space.
some code
ENDIF.
ENDIF.
ENDLOOP.
Thanks,
Prasad.
04-27-2006 9:02 AM
Hi prasad,
I dont think you can do <> comparison in READ statment.
Try
READ TABLE i_konv WITH KEY knumv = wa_ekbe-knumv BINARY SEARCH.
use IF after reading, for this comparison.
Regards,
Tanveer.
Mark helpful answers.
04-27-2006 9:05 AM
I idea is to get only one record using the READ statement.
Regards,
Ravi
NOte : Please mark all the helpful answers
04-27-2006 9:07 AM
Hi Prasad,
You can only use = in Read statement while using WITH clause.
Solution to your problem :
Declare three variables of the type that you want to use in the Read Statement.
lv_kschl type kschl.
lv_lifnr type lifnr.
lv_kwert type kwert.
Don't clear the variables and use like this.
READ TABLE i_konv WITH KEY knumv = wa_ekbe-knumv
kschl = lv_kschl
lifnr = lv_lifnr
kwert = lv_kwert
BINARY SEARCH.
Please mark helpful answer and close this thread.
Regards,
Amit Mishra
04-27-2006 9:28 AM
Prasad,
Please close the thread and award points for helpful answers if your query has been solved.
Cheers
Nishanth