2009 Jan 08 4:02 AM
Hi Experts,
I am looping at itab1 and then using read table itab2 as below:
sort itab1 by f1.
sort itab2.
loop at itab1 into wa1.
read table itab2 into wa2 with key f2 = wa1-f2 binary search. --> fails for matched entries
if sy-subrc eq 0.
...etc
endif.
endloop.
read table is showing sy-subrc ne 0 even when there are matched entries for field f2 in itab1 & itab2(when seen in debug mode) . f2 is not a primary field in the source table.
Can someone please help me?
Thanks
Dan
2009 Jan 08 4:06 AM
sort itab1 by f1.
sort itab2 by f2. " add F2 field here
loop at itab1 into wa1.
read table itab2 into wa2 with key f2 = wa1-f2 binary search. --> fails for matched entries
if sy-subrc eq 0.
...etc
endif.
endloop.
Hi Experts,
I am looping at itab1 and then using read table itab2 as below:
sort itab1 by f1.
sort itab2.
loop at itab1 into wa1.
read table itab2 into wa2 with key f2 = wa1-f2 binary search. --> fails for matched entries
if sy-subrc eq 0.
...etc
endif.
endloop.
read table is showing sy-subrc ne 0 even when there are matched entries for field f2 in itab1 & itab2(when seen in debug mode) . f2 is not a primary field in the source table.
Can someone please help me?
Thanks
Dan
2009 Jan 08 4:06 AM
sort itab1 by f1.
sort itab2 by f2. " add F2 field here
loop at itab1 into wa1.
read table itab2 into wa2 with key f2 = wa1-f2 binary search. --> fails for matched entries
if sy-subrc eq 0.
...etc
endif.
endloop.
2009 Jan 08 4:11 AM
Hi,
If you Binary search in read statement then Searching increase fast and efficiency will be increase.
Check your data once again.
Regards
Md.MahaboobKhan
2009 Jan 08 4:18 AM
Hi,
Try this.Before reading the table using binary search, it is advisable to sort the table.
sort itab1 by f2.
sort itab2 by f2.
loop at itab1 into wa1.
read table itab2 into wa2 with key f2 = wa1-f2 binary search.
if sy-subrc eq 0.
...etc
endif.
endloop.
2009 Jan 08 4:20 AM
Hi,
Whenever a binary search is used in a Read statement, the internal table used in read statement should be sorted ascendingly based on the field which is used for matching.
In your case, sort the table itab2 using field F2.
Regards,
Prasana.
2009 Jan 08 6:06 PM
2009 Jan 08 6:15 PM
Dan - if Prashant solved your problem, maybe you should consider assigning him 'solved problem' rather than just 'helpful'.
Rob
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |