ABAP READ TABLE使用BINARY SEARCH如题,read table使用binary search,with key有多个字段的时候,寻找数据的内部逻辑是怎样的比如有内表(按A,B已排好序)T_DATAA B C1 1 11 2 22 1 32 2 42 3 53 1 63 2 73 3 8现在用如下语句查找READ TABLE T_DATA INTO W_DATA WITH KEY A='2' B = '3' BINA...
READ TABLE TBA1 INTO INTO LS_TAB1 WITH KEY ID = '01' NAME = 'ZS' BINARY SEARCH. 如果TAB1内表是根据ZFIT001自建表定义的,而ZFIT001-ID字段长度定义为了字符串三位,那么可能由于数据导入的过程中存在‘01’后面多了一个空格,从而导致获取不到数据的情况。 补充READ TABLE的使用方式: 通过主键查找(WI...
READTABLEitabINTOwaWITHKEY col1 ='001'col2='0001'BINARYSEARCH. 这时得到的是第一条,001 0001 20100101 而不是 001 0001 20100103 这好像不符合二分法查找逻辑。按结果来看,这里的机制是先去匹配了查询条件,将匹配查询条件的数据全拉出来,然后取第一条,而不是按binary search 正常机制,先将low+high / 2位...
abap read table 1.如果使用READ TABLE语句来读取内部表数据,而不是简单看返回值判断是否存在,那么在使用READ TABLE语句之前,一定要记得使用CLEAR语句清空内部表的工作区。 2.READ TABLE itab WITH KEY = v BINARY SEARCH. 使用READ TABLE语句的二分法搜索以代替标准顺序搜索时,必须首先按关键字中指定的次序对内表...
If there are multiple hits (due to an incomplete search key or duplicate entries in the table), binary searches (using the addition BINARY SEARCH in standard tables; automatic in sorted tables) also return the first hit in accordance with the order of the rows in the primary index. This is...
3'的数据,如果有多条满足条件的数据,则返回内表中满足条件的索引最小的一条。在做二分查找之前,需要先对内表以查找的字段顺序进行升序排序,也就是说,在你的例子中用二分查找之前要对内表按A、B的顺序进行排序,即 SORT T_DATA[] BY A B ASCENDING.否则不一定能查找到正确的确结果 ...
READ TABLE it_ekpo INTO wa_it_ekpo WITH KEY ebeln = wa_asnmain_ref-vgbel ebelp = wa_asnmain_ref-vgpos binary search. MOVE-CORRESPONDING wa_it_ekpo TO wa_asnmain_ref. *APPEND wa_it_ekpo to it_ekpo. *MOVE-CORRESPONDING *CONCATENATE wa_it_lips wa_it_ekpo INTO WA_ASNMAIN_ref. ...
...{FROM wa[USING KEYkeyname]} |{WITH TABLE KEY[keynameCOMPONENTS] {comp_name1|(name1)}= operand1 {comp_name2|(name2)}= operand2 ...}... Alternatives: Effect Specifying a Table Key as a Search Key Either the primary table key or a secondary table key can be specified. The val...
In a loop over table tkomp, new lines are appended to tkomp, because read table tkomp with key komp-kposn binary search. fails to find the line in the table, but it is definetly there.. I have never seen this syntax before, where the "key =" statement is missing, but the syntax...
INTO TABLE scarr_tab. READ TABLE scarr_tab WITH TABLE KEY carrid = p_carrid TRANSPORTING NO FIELDS. IF sy-subrc = 0. idx = sy-tabix. ENDIF. The addition COMPARING compares the specified components comp1 comp2 ... (or the subareas or attributes thereof) in a found line ...