![activereports 7 sort table activereports 7 sort table](http://lightswitchhelpwebsite.com/Portals/0/Blog/Files/1/3251/Windows-Live-Writer-LightSwitch-Reports-using-Active-Reports_10790-image_d72e237d-7f80-4f13-9318-8cc4b6826646.png)
LOOP AT li_positions_sorted FROM sy-tabix. READ TABLE li_positions_sorted WITH KEY docnr = li_head-docnr START_MEASUREMENT 'BINARY SEARCH SORTED TABLE'. READ TABLE li_positions WITH KEY docnr = li_head-docnr LOOP AT li_positions_sorted WHERE docnr = li_head-docnrĮND_MEASUREMENT 'LOOP WHERE SORTED TABLE'. START_MEASUREMENT 'LOOP WHERE SORTED TABLE'. LOOP AT li_positions WHERE docnr = li_head-docnr
#Activereports 7 sort table code#
LI_HEAD will contain 5000 entries and each of this entries will contain 5 entries in the LI_POSITIONS and LI_POSITIONS_SORTED tables, the program is going to perform just the LOOPs, no code inside, as show below (You can ignore the macros i used to get runtime measurement): START_MEASUREMENT 'SORT'. Li_positions_sorted TYPE SORTED TABLE OF lt_position Li_positions TYPE STANDARD TABLE OF lt_position I prepared the variables below for my program: TYPES: BEGIN OF lt_head,ĭATA: li_head TYPE STANDARD TABLE OF lt_head READ TABLE BINARY SEARCH + LOOP FROM INDEX over a SORTED TABLE.READ TABLE BINARY SEARCH + LOOP FROM INDEX over a STANDARD TABLE (Sorted with a sort statement).LOOP WHERE over a STANDARD TABLE (Sorted with a sort statement).I coded a little example testing 4 cases: When using LOOP WHERE the BINARY SEARCH is performed under the hood, so for newbies it can become even more complex to understand when and why ABAP is doing this search optimal for you. Most probably you know that the use of this addition improves performance, but when you’re starting you may be not aware of how much it does. When you start to code ABAP you are probably not paying much atention to the table typekind you use (STANDARD, SORTED, HASHED), and you usually forgot to use the statement addition BINARY SEARCH.