‎2007 Jul 09 10:28 AM
hi Experts!
we r using read statement in a loop with binary search, but data is not coming. when we removed binary search, data is coming.
if help me out .
regards,
Rahul
‎2007 Jul 09 10:31 AM
Hi Rahul,
Use SORT before using Binary Search.
REward if useful!
‎2007 Jul 09 10:30 AM
Hi,
SORT the table before you use BINARY SEARCH In READ.
SORT ITAB BY ....
READ TABLE ITAB .......... BINARY SEARCH.
This is needed if your table is of type STANDARD, not required if it is SORTED and cannot use if it is HASHED.
Regards,
Sesh
‎2007 Jul 09 10:34 AM
Its depends on Wat data ur fetching into internal table.
If its item data it happens like that.
So before using binary search sort it and delete adjacent duplicates.
Regards'
Sreenivasa Reddy.
‎2007 Jul 09 10:31 AM
Hi Rahul,
Use SORT before using Binary Search.
REward if useful!
‎2007 Jul 09 10:34 AM
Hi ,
USe sort statement befor you start binary search
and for further info use this link,
http://en.wikipedia.org/wiki/ABAP
If useful reward points.
Thanks
Sanket.
‎2007 Jul 09 10:32 AM
Hi Rahul,
You need to sort the internal table before the loop when you are using BINARY SEARCH
You have to sort those fields which u r using in where condition for the READ statement
‎2007 Jul 09 10:35 AM
Hi,
1) sort the table outside the loop which u r reading.
2) sort the table with keys by which u r reading the table in the same sequence.
like
SORT: p_it_vbkd BY vbeln posnr,
p_it_t001 BY bukrs,
p_it_vbkd1 BY vbeln posnr,
p_it_vbrp BY vbeln.
LOOP AT p_it_out INTO lw_out.
READ TABLE p_it_vbrp
INTO lw_vbrp
WITH KEY vbeln = lw_out-vbeln1
BINARY SEARCH.
If aubel is not intial
IF NOT lw_vbrp-aubel IS INITIAL.
Get exchange rate from it_vbkd for a line item
READ TABLE p_it_vbkd
INTO lw_vbkd
WITH KEY vbeln = lw_vbrp-aubel
posnr = lw_vbrp-posnr
BINARY SEARCH.
regards,
sudha