06-13-2006 3:20 PM
How can I put in a read table <= or >= like this:
READ TABLE t_pcec1 INTO wa_pcec1 with key checf <=
wa_payr1-chect chect >= wa_payr1-chect.
Thanks!!
06-13-2006 3:21 PM
Hi,
You can't use logical and aritmetic operators in READ Statement. Instead after reading first time you can use an IF condition to check whatever you want to and then use READ Statement again with different WITH KEY fields.
You can do this multiple times.
<b>But, you can't use operators in READ statement.</b>
<b>Reward points if it helps you.</b>
Message was edited by: Amit Mishra
06-13-2006 3:23 PM
I think you cannot use <= and >= in read statement,
use Loop at t_pcec1 where checf le
wa_payr1-chect chect ge wa_payr1-chect ....endloop
and exit after first hit.
Regards
Sridhar
06-13-2006 3:23 PM
<b>Binary Search in Standard Tables</b>
If you read entries from standard tables using a key other than the default key, you can use a binary search instead of the normal linear search. To do this, include the addition BINARY SEARCH in the corresponding READ statements.
READ TABLE <itab> WITH KEY <k1> = <f1>... <kn> = <fn> <result>
BINARY SEARCH.
OR Use <b>LOOP AT</b>
regards
vinod
06-13-2006 3:28 PM
READ TABLE t_pcec1 INTO wa_pcec1 with key checf <=
wa_payr1-chect chect >= wa_payr1-chect.
it is not possible. but you can try this..
loop at t_pcec1 INTO wa_pcec1 where checf <= wa_payr1-chect and chect >= wa_payr1-chect.
"here you get the record,
"after that use exit
endloop.
Regards
vijay
06-13-2006 7:31 PM
Hi,
READ TABLE can only fetch 1 record at a time. so you say > or < in the WHERE condition of READ TABLE,there is chance that more than 1 record satisfying the criteria,which read table can NOT hold.
so its always have to give '=' in READ TABLE WHERE condition.
if you are looking for more than 1 record processing,
LOOP AT t_pcec1 INTO wa_pcec1
WHERE checf <=
wa_payr1-chect chect >= wa_payr1-chect.
*--Do some processing..
ENDLOOP.
Regards
srikanth
06-13-2006 8:14 PM
hi carlos,
u cannot use conditional operators in read statement.
so , it is better to loop at the table checking the condition key checf <=
wa_payr1-chect chect >= wa_payr1-chect.
hope this helps,
keerthi.
06-14-2006 3:57 AM
Hi,
Hope this will give you some idea since you cannot use operators in a read statement just like what others said.
loop at itab1.
read table itab2 with key f1 = itab1-f1
f2 = itab1-f1.
if sy-subrc = 0.
move itab2-f1 to itab3-f1.
else.
delete itab1.
clear itab1.
continue.
endif.
endloop.
06-14-2006 4:03 AM
Carlos - I think you question has been pretty well answered. You're getting the same answers over and over. Why not assign some points (not to this) and close it?
Rob
06-14-2006 4:09 AM
u cant use conditions other than '='.
to achive ur purpose u can code like below:
loop at t_pcec1 INTO wa_pcec1 where checf <=
wa_payr1-chect and chect >= wa_payr1-chect.
endloop.
u need to ue loop............, no other go.