<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: collect in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/collect/m-p/2221104#M476938</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Vijay&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let me come up with a simple answer!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;COLLECT:&amp;lt;/b&amp;gt; This keyword is used to sum up all the records' numeric fields in an internal table. i.e, say there is an internal table with two fields: w_char and w_int of types CHAR and INT respectively. A collect operation will result in adding up of w_int for all the records which have same value for w_char.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;READ:&amp;lt;/b&amp;gt; This statement reads any specified record of an internal table based on the index/key.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;MODIFY:&amp;lt;/b&amp;gt; This modifies the mentioned record from the internal table. The modification can be controlled for only a few fields by using the extension &amp;lt;b&amp;gt;transporting&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;APPEND:&amp;lt;/b&amp;gt; This appends a new record to an internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;INSERT:&amp;lt;/b&amp;gt; This adds a new record to the internal table...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I strongly suggest you to go through the SAP library help in detail for a deep understanding of internal tables, as these are the heart of ABAP programming.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward points if useful&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 12 May 2007 14:46:53 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-05-12T14:46:53Z</dc:date>
    <item>
      <title>collect</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/collect/m-p/2221100#M476934</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;can u guys  explain contact,read,modify,append,editor call,insert with an example.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 May 2007 09:41:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/collect/m-p/2221100#M476934</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-11T09:41:06Z</dc:date>
    </item>
    <item>
      <title>Re: collect</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/collect/m-p/2221101#M476935</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hii vijay&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;please read this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Syntax Diagram &lt;/P&gt;&lt;P&gt;COLLECT &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Basic form &lt;/P&gt;&lt;P&gt;COLLECT [wa INTO] itab. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Extras: &lt;/P&gt;&lt;P&gt;1. ... ASSIGNING &amp;lt;fs&amp;gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. ... REFERENCE INTO dref &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. ... SORTED BY f &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The syntax check performed in an ABAP Objects context is stricter than in other ABAP areas. See Cannot Use Short Forms in Line Operations. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Effect &lt;/P&gt;&lt;P&gt;COLLECT allows you to create unique or summarized datasets. The system first tries to find a table entry corresponding to the table key. (See also Defining Keys for Internal Tables). The key values are taken either from the header line of the internal table itab, or from the explicitly-specified work area wa. The line type of itab must be flat - that is, it cannot itself contain any internal tables. All the components that do not belong to the key must be numeric types ( ABAP Numeric Types). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If the system finds an entry, the numeric fields that are not part of the table key (see ABAPNumeric 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. &lt;/P&gt;&lt;P&gt;The way in which the system finds the entries depends on the kind of the internal table: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;STANDARD TABLE: &lt;/P&gt;&lt;P&gt;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 (such as DELETE, INSERT, MODIFY, or 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. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SORTED TABLE: &lt;/P&gt;&lt;P&gt;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. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HASHED TABLE: &lt;/P&gt;&lt;P&gt;The system uses the internal hash administration of the table to find records. Since (unlike standard tables), this remains intact even after table modification operations, the search time is always independent of the number of table entries. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For standard tables and SORTED TABLEs, the system field SY-TABIX contains the number of the existing or newly-added table entry after the COLLECT. With HASHED TABLEs, SY-TABIX is set to 0. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Notes &lt;/P&gt;&lt;P&gt;COLLECT allows you to create a unique or summarized dataset, and you should only use it when this is necessary. If neither of these characteristics are required, or where the nature of the table in the application means that it is impossible for duplicate entries to occur, you should use INSERT [wa INTO] TABLE itab instead of COLLECT. If you do need the table to be unique or summarized, COLLECT is the most efficient way to achieve it. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you use COLLECT with a work area, the work area must be compatible with the line type of the internal table. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you edit a standard table using COLLECT, you should only use the COLLECT or MODIFY ... TRANSPORTING f1 f2 ... statements (where none of f1, f2, ... may be in the key). Only then can you be sure that: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-The internal table actually is unique or summarized &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-COLLECT runs efficiently. The check whether the dataset &lt;/P&gt;&lt;P&gt;already contains an entry with the same key has a constant &lt;/P&gt;&lt;P&gt;search time (hash procedure). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you use any other table modification statements, the check for entries in the dataset with the same key can only run using a linear search (and will accordingly take longer). You can use the function module ABL_TABLE_HASH_STATE to test whether the COLLECT has a constant or linear search time for a given standard table. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example &lt;/P&gt;&lt;P&gt;Summarized sales figures by company: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES: BEGIN OF COMPANY, &lt;/P&gt;&lt;P&gt;        NAME(20) TYPE C, &lt;/P&gt;&lt;P&gt;        SALES    TYPE I, &lt;/P&gt;&lt;P&gt;      END OF COMPANY. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: COMP    TYPE COMPANY, &lt;/P&gt;&lt;P&gt;      COMPTAB TYPE HASHED TABLE OF COMPANY &lt;/P&gt;&lt;P&gt;                                WITH UNIQUE KEY NAME. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;COMP-NAME = 'Duck'.  COMP-SALES = 10. COLLECT COMP INTO COMPTAB. &lt;/P&gt;&lt;P&gt;COMP-NAME = 'Tiger'. COMP-SALES = 20. COLLECT COMP INTO COMPTAB. &lt;/P&gt;&lt;P&gt;COMP-NAME = 'Duck'.  COMP-SALES = 30. COLLECT COMP INTO COMPTAB. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Table COMPTAB now has the following contents: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;          NAME    | SALES &lt;/P&gt;&lt;P&gt;          -&lt;/P&gt;&lt;HR originaltext="--------------" /&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;          Duck    |   40 &lt;/P&gt;&lt;P&gt;          Tiger   |   20 &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Addition 1 &lt;/P&gt;&lt;P&gt;... ASSIGNING &amp;lt;fs&amp;gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Effect &lt;/P&gt;&lt;P&gt;If this statement is successfully executed, the field symbol &amp;lt;fs&amp;gt; is set to the changed or new entry. Otherwise the field symbol remains unchanged. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Addition 2 &lt;/P&gt;&lt;P&gt;... REFERENCE INTO dref &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Effect &lt;/P&gt;&lt;P&gt;If this statement is successfully executed the reference to the relevant line is placed in dref. Otherwise the data reference dref remains unchanged. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Addition 3 &lt;/P&gt;&lt;P&gt;... SORTED BY f &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Effect &lt;/P&gt;&lt;P&gt;COLLECT ... SORTED BY f is obsolete, and should no longer be used. It only applies to standard tables, and has the same function as APPEND ... SORTED BY f, which you should use instead. (See also Obsolete Language Elements). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note &lt;/P&gt;&lt;P&gt;Performance: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you are still using internal tables with headers but, as recommended, keep your data in work areas with a different name, you do not need to assign the data to the header first in order to pass it to the internal tables. Instead, you should use the work area directly as with tables without headers. For example, "APPEND wa TO itab." is roughly twice as fast as "itab = wa. APPEND itab.". The same applies to COLLECT and INSERT. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The runtime of a COLLECT increases with the width of the table key and the number of numeric fields whose contents are summated. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Exceptions &lt;/P&gt;&lt;P&gt;Catchable Exceptions &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CX_SY_ARITHMETIC_OVERFLOW &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cause: Overflow in the integer field when forming totals &lt;/P&gt;&lt;P&gt;Runtime Error: COLLECT_OVERFLOW &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cause: overflow in type P field when forming totals &lt;/P&gt;&lt;P&gt;Runtime Error: COLLECT_OVERFLOW_TYPE_P &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Non-Catchable Exceptions &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cause: COLLECT on non-numeric fileds &lt;/P&gt;&lt;P&gt;Runtime Error: TABLE_COLLECT_CHAR_IN_FUNCTION &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;reward if useful&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;vikaas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 May 2007 09:44:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/collect/m-p/2221101#M476935</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-11T09:44:13Z</dc:date>
    </item>
    <item>
      <title>Re: collect</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/collect/m-p/2221102#M476936</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI,&lt;/P&gt;&lt;P&gt;COLLECT:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;is used to sum up all the numeric values of a workarea into an internal table record with same key as that of the workarea.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;READ to read from an internal table based on index or using key (WITH KEY).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MODIFY is used to modify the records of an internal table either changing all the fields or only some fields using the option TRANSPORTING.&lt;/P&gt;&lt;P&gt;MODIFY can also be used for DB tables where it inserts the record if it does not exist else updates the record.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;append is used to append records to internal tables of type STANDARD and SORTED.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EDITOR-CALL&lt;/P&gt;&lt;P&gt;This statement starts the ABAP editor for the source text of the program specified in prog. prog has to be a character-type data object, which contains the name of a program in capital letters that exists in the Repository. Otherwise you will get a corresponding status message. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After starting the ABAP editor, it provides the full functionality, as if called from the ABAP-Workbench. You can navigate forward to branch to other tools. After returning from the ABAP-editor, the current program continues after the statement EDITOR-CALL.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;INSERT: &lt;/P&gt;&lt;P&gt;again can be used for internal tables of type  to insert records into it. For database tables also can be used. check out the syntax for both of them.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Sesh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 May 2007 09:49:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/collect/m-p/2221102#M476936</guid>
      <dc:creator>seshatalpasai_madala</dc:creator>
      <dc:date>2007-05-11T09:49:08Z</dc:date>
    </item>
    <item>
      <title>Re: collect</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/collect/m-p/2221103#M476937</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Inserts new lines or updates existing lines in a database table (s. relational database). If a line with the specified primary key already exists, an UPDATE is executed. Otherwise, an INSERT is performed. You can specify the name of the database table either in the program itself in the form MODIFY dbtab ... or at runtime as the contents of the variable dbtabname in the form MODIFY (dbtabname) .... In both cases, the database table must be defined in the ABAP Dictionary. If the program contains the name of the database table, it must also have a corresponding TABLES statement. Normally, records are inserted or updated only in the current client. Data can only be inserted or updated using a view, if the view refers to a single table and was created in the ABAP Dictionary with the maintenance status "No restriction". &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;example&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: wa TYPE scustom. &lt;/P&gt;&lt;P&gt;wa-id        = '12400177'. &lt;/P&gt;&lt;P&gt;wa-name      = 'Robinson'. &lt;/P&gt;&lt;P&gt;wa-postcode  = '69542'. &lt;/P&gt;&lt;P&gt;wa-city      = 'Heidelberg'. &lt;/P&gt;&lt;P&gt;wa-custtype  = 'P'. &lt;/P&gt;&lt;P&gt;wa-discount  = '003'. &lt;/P&gt;&lt;P&gt;wa-telephone = '06201/44889'. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MODIFY scustom FROM wa.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;read:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reads an entry from an internal table, using either its key or its index. The return code SY-SUBRC specifies whether an entry could be read. If you specify a non-unique key (the table must have a NON-UNIQUE key for this to be valid), the system returns the entry with the lowest index from the set of entries that meet the condition&lt;/P&gt;&lt;P&gt; READ TABLE itab FROM wa [ additions]. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. READ TABLE itab WITH TABLE KEY k1 = v1 ... kn = vn [additions]. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. READ TABLE itab WITH KEY k1 = v1 ... kn = vn [BINARY SEARCH] [additions]. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4. READ TABLE itab INDEX i [additions]. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;append &lt;/P&gt;&lt;P&gt;Appends a new line to the end of the internal table itab. You can only use this variant with index tables (standard or sorted table). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; APPEND [wa TO|INITIAL LINE TO] itab[ASSIGNING &amp;lt;fs&amp;gt; |REFERENCE INTO dref]. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. APPEND LINES OF itab1 [FROM idx1] [TO idx2] TO itab2. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. APPEND [wa TO] itab SORTED BY f [ASSIGNING &amp;lt;fs&amp;gt; &lt;/P&gt;&lt;P&gt;|REFERENCE INTO dref].&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Editor call&lt;/P&gt;&lt;P&gt;Displays the internal table itab in an editor similiar to the ABAP Editor. You can then use normal editor functions to make changes. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Changes to the table contents are only adopted if you save before leaving the editor.&lt;/P&gt;&lt;P&gt;DATA: BEGIN OF T OCCURS 200, &lt;/P&gt;&lt;P&gt;        TEXT1(60),TEXT2(12), &lt;/P&gt;&lt;P&gt;      END OF T. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;T-TEXT1 = 'Text 1'. T-TEXT2 = 'A'. APPEND T. &lt;/P&gt;&lt;P&gt;T-TEXT1 = 'Text 2'. T-TEXT2 = 'B'. APPEND T. &lt;/P&gt;&lt;P&gt;T-TEXT1 = 'Text 3'. T-TEXT2 = 'C'. APPEND T. &lt;/P&gt;&lt;P&gt;T-TEXT1 = 'Text 4'. T-TEXT2 = 'D'. APPEND T. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EDITOR-CALL FOR T TITLE 'Editor for internal tables'. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT T. &lt;/P&gt;&lt;P&gt;  WRITE: / T-TEXT1, T-TEXT2. &lt;/P&gt;&lt;P&gt;ENDLOOP. &lt;/P&gt;&lt;P&gt;collect&lt;/P&gt;&lt;P&gt;COLLECT allows you to create unique or summarized datasets. The system first tries to find a table entry corresponding to the table key. (See also Defining Keys for Internal Tables). The key values are taken either from the header line of the internal table itab, or from the explicitly-specified work area wa. The line type of itab must be flat - that is, it cannot itself contain any internal tables. All the components that do not belong to the key must be numeric types ( ABAP Numeric Types). &lt;/P&gt;&lt;P&gt;TYPES: BEGIN OF COMPANY, &lt;/P&gt;&lt;P&gt;        NAME(20) TYPE C, &lt;/P&gt;&lt;P&gt;        SALES    TYPE I, &lt;/P&gt;&lt;P&gt;      END OF COMPANY. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: COMP    TYPE COMPANY, &lt;/P&gt;&lt;P&gt;      COMPTAB TYPE HASHED TABLE OF COMPANY &lt;/P&gt;&lt;P&gt;                                WITH UNIQUE KEY NAME. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;COMP-NAME = 'Duck'.  COMP-SALES = 10. COLLECT COMP INTO COMPTAB. &lt;/P&gt;&lt;P&gt;COMP-NAME = 'Tiger'. COMP-SALES = 20. COLLECT COMP INTO COMPTAB. &lt;/P&gt;&lt;P&gt;COMP-NAME = 'Duck'.  COMP-SALES = 30. COLLECT COMP INTO COMPTAB. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Table COMPTAB now has the following contents: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;          NAME    | SALES &lt;/P&gt;&lt;P&gt;          -&lt;/P&gt;&lt;HR originaltext="--------------" /&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;          Duck    |   40 &lt;/P&gt;&lt;P&gt;          Tiger   |   20&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 May 2007 09:50:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/collect/m-p/2221103#M476937</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-11T09:50:11Z</dc:date>
    </item>
    <item>
      <title>Re: collect</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/collect/m-p/2221104#M476938</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Vijay&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let me come up with a simple answer!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;COLLECT:&amp;lt;/b&amp;gt; This keyword is used to sum up all the records' numeric fields in an internal table. i.e, say there is an internal table with two fields: w_char and w_int of types CHAR and INT respectively. A collect operation will result in adding up of w_int for all the records which have same value for w_char.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;READ:&amp;lt;/b&amp;gt; This statement reads any specified record of an internal table based on the index/key.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;MODIFY:&amp;lt;/b&amp;gt; This modifies the mentioned record from the internal table. The modification can be controlled for only a few fields by using the extension &amp;lt;b&amp;gt;transporting&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;APPEND:&amp;lt;/b&amp;gt; This appends a new record to an internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;INSERT:&amp;lt;/b&amp;gt; This adds a new record to the internal table...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I strongly suggest you to go through the SAP library help in detail for a deep understanding of internal tables, as these are the heart of ABAP programming.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward points if useful&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 12 May 2007 14:46:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/collect/m-p/2221104#M476938</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-12T14:46:53Z</dc:date>
    </item>
    <item>
      <title>Re: collect</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/collect/m-p/2221105#M476939</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Vijay,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check this out&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/collect.htm" target="test_blank"&gt;http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/collect.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Santosh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 12 May 2007 15:40:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/collect/m-p/2221105#M476939</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-12T15:40:14Z</dc:date>
    </item>
  </channel>
</rss>

