Hi.
I have two ITABS: ITAB_REF0011 and ITAB_REF0011A.
ITAB_REF0011 has 169 records. When I run the following statement, ITAB_REF0011A returns no records. Why is that so? Thanks.
*************************************************************
SORT ITAB_REF0011 BY LN_DAT6 .
READ TABLE ITAB_REF0011 WITH KEY
LN_DAT8 = ITAB_TRA-DT_DAT8 LN_TIM6 = ITAB_TRA-DT_TIM6
BINARY SEARCH TRANSPORTING NO FIELDS INTO TABLE ITAB_REF0011A.
Hi Kian,
I never heard of this syntax:
TRANSPORTING NO FIELDS INTO TABLE ITAB_REF0011A
1. You cant' read INTO TABLE - this is only for SELECT
2. If you use TRANSPORTING NO FIELDS you don't need a work area as target because nothing is returned.
You may
loop at ITAB_REF0011 where LN_DAT8 = ITAB_TRA-DT_DAT8 and LN_TIM6 = ITAB_TRA-DT_TIM6. append ITAB_REF0011 to ITAB_REF0011A. endloop. If you think this is too slow, then - define ITAB_REF0011 like sorted table of ... with [NON-] unique key DT_DAT8 DT_TIM6 - use loop ... assigning <field-symbol>. Regards, Clemens
SORT ITAB_REF0011 BY LN_DAT6 LN_TIM6. " add LN_TIM6. LOOP AT ITAB_TRA. " Add this line READ TABLE ITAB_REF0011 WITH KEY LN_DAT8 = ITAB_TRA-DT_DAT8 LN_TIM6 = ITAB_TRA-DT_TIM6 BINARY SEARCH. if sy-subrc eq 0. Append itab_ref0011 to ITAB_REF0011A. endif. ENDLOOP.
Hi kian,
If both tables having the same structure.Better to use this syntax.That will copy one table contents to another.
ITAB_REF0011[] = ITAB_REF0011A[].
or
MOVE ITAB_REF0011 TO ITAB_REF0011A.
If u r satisfy with the answer give me the REWARD POINTS..
Hi,
<b>When you are using a binarysearch on an internal table
You need to sort the table using the same keys you are reading or else you will not get the correct data
Data will be mismatched.</b>
Regards,
Siva chalasani
Reward points if usefull.
Add a comment