What is the Difference Between Collect and Sum?

Showing Answers 1 - 4 of 4 Answers

SUN

  • Sep 13th, 2005
 

                                                                
 COLLECT allows you to create unique or summarized datasets. The
 system first tries to find a table entry corresponding to the  
 table key. The key values are taken either from the header line
 of the internal table  itab, or from the explicitly-specified  
 work area wa.                                                  
 If the system finds an entry, the numeric fields that are not  
 part of the table key (see ABAP number types) are added to the 
 sum total of the existing entries. If it does not find an      
 entry, the system creates a new entry instead.                 
 The way in which the system finds the entries depends on the   
 type of the internal table:                                    
                                                                
 -  STANDARD TABLE:                                             
    The system creates a temporary hash administration for the  
    table to find the entries. This means that the runtime      
    required to find them does not depend on the number of table
    entries. The administration is temporary, since it is       
    invalidated by operations like DELETE, INSERT, MODIFY, SORT,
    ...). A subsequent COLLECT is then no longer independent of 
    the table size, because the system has to use a linear      
    search to find entries. For this reason, you should only use
    COLLECT to fill standard tables. U                          
                                                                
 -  SORTED TABLE:                                               
    The system uses a binary search to find the entries. There  
    is a logarithmic relationship between the number of table   
    entries and the search time.                                
                                                                

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions