在sap 之abap语言中,有BINARY SEARCH这个查找条件。使用read table 来读取内表时,使用BINARY SEARCH可以大大的提高查找的效率,为什么呢?学过数据库的人会知道,“二分查找”法,其实这个BINARY SEARCH就是这样方法来查找的。书中也许会说,在使用BINARY SEARCH时,必须要先对内表排序,道理就是这样,因为...
在使用binary search之前必须首先将内表排序,否则有可能找不到记录,因为二分查找反复将查找区间对半划分,如果要查找的值小于查找区间的中间位置的数据项值,则查找区间将缩小到前半个区间,否则查找将局限于后半区间。要了解更多的关于二分查找算法介绍,请点击这里。
SAP Managed Tags: ABAP Testing and Analysis Hi, Note: The standard table must be sorted in ascending order by the specified search key. The BINARY SEARCH addition means that you can access an entry in a standard table by its key as quickly as you would be able to in a sorted table....
从结果来看,ABAP的二分机制实际是没用的。 >> 对哦,问问题的人没错阿,难道是我把学过的东西还给老师了?赶紧又Google了一翻,翻阅binary search的算法,还是觉得那位同学说得没错,那到底是哪里错了呢?...找阿找,翻阿翻... 终于在刚才,有人查到了SAP的官方解释,回贴了: << 首先,binary search 是二分查...
SAP Managed Tags: ABAP Testing and Analysis before using BINARy SEARCH the internal table must be SORTed on the fields which we are using in READ statement. Now binary search looks the middle record in the internal table. if the KEY is less than the middle record then it will take first...
SAP Managed Tags: ABAP Development hi, linear search searches one one records(sequentially from first record to last record.)it takes more time Binary search applies binary logic..takes less time gets the ( (first record + last record) / 2) = value.. Now search for the given record whe...
SAP Managed Tags: ABAP Development hi, binary search will always return the first record in the internal table matching the search criteria. you can sort table by char or number or numeric fields and binary search will always return the first record if there are duplicates Reply Former Membe...
SAP Managed Tags: ABAP Development 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 WITH KEY ...
2、二分查找的基本思想 二分查找的基本思想是:(设R[low..high]是当前的查找区间) (1)首先确定该区间的中点位置: [转帖]SAPABAP性能优化技巧—使用二分查找(BinarySearch)选项 (2)然后将待查的K值与R[mid].key比较:若相等,则查找成功并返回此位置,否则须确定新的查找区间,继续二分查找,具体方法如下: ①若...
SAP Managed Tags: ABAP Development Hi, Check this links: SCMS_XSTRING_TO_BINARY: http://blog.csdn.net/CompassButton/archive/2007/08/08/1731473.aspx SCMS_BINARY_TO_STRING: http://code.google.com/p/saplink/issues/detail?id=106 Search SDN form with function module name's. Regards Adil ...