<?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: problem with collect in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-collect/m-p/1364642#M180554</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;i want only the menge to make collect the other need to stay&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 24 May 2006 12:18:44 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-05-24T12:18:44Z</dc:date>
    <item>
      <title>problem with collect</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-collect/m-p/1364641#M180553</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;how i do 2 lines instead of 3&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;matnr ............ menge&lt;/P&gt;&lt;P&gt;11111 10 4 3 3 3 3 10&lt;/P&gt;&lt;P&gt;22222 10 3 3 3 3 3 5&lt;/P&gt;&lt;P&gt;22222 10 3 3 3 3 3 10&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 May 2006 12:16:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-collect/m-p/1364641#M180553</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-05-24T12:16:34Z</dc:date>
    </item>
    <item>
      <title>Re: problem with collect</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-collect/m-p/1364642#M180554</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;i want only the menge to make collect the other need to stay&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 May 2006 12:18:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-collect/m-p/1364642#M180554</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-05-24T12:18:44Z</dc:date>
    </item>
    <item>
      <title>Re: problem with collect</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-collect/m-p/1364643#M180555</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi Rani,&lt;/P&gt;&lt;P&gt;   In that case use &amp;lt;b&amp;gt;SUM&amp;lt;/b&amp;gt; statement instead of collect. Since Collect statement sums up all the numeric fields.&lt;/P&gt;&lt;P&gt;  Use in this way i.,e SUM(MENGE).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 May 2006 12:20:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-collect/m-p/1364643#M180555</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-05-24T12:20:39Z</dc:date>
    </item>
    <item>
      <title>Re: problem with collect</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-collect/m-p/1364644#M180556</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;/P&gt;&lt;P&gt;chk this out&lt;/P&gt;&lt;P&gt;&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;plz reward if useful&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 May 2006 12:21:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-collect/m-p/1364644#M180556</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-05-24T12:21:54Z</dc:date>
    </item>
    <item>
      <title>Re: problem with collect</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-collect/m-p/1364645#M180557</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;  LOOP AT T_BOM.

    AT END OF VBELN.

      READ TABLE T_BOM INDEX SY-TABIX.
      SUM.
      MOVE T_BOM TO IT_BOM.
      APPEND IT_BOM.

    ENDAT.

  ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the above code due to the Use of SUM we get the final sum values into a new internal table IT_BOM... &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;otherwise u need to use modify statement and delete duplicate entries again&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: Rahul Kavuri&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 May 2006 12:22:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-collect/m-p/1364645#M180557</guid>
      <dc:creator>rahulkavuri</dc:creator>
      <dc:date>2006-05-24T12:22:33Z</dc:date>
    </item>
    <item>
      <title>Re: problem with collect</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-collect/m-p/1364646#M180558</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Rani,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; Am assuming menge is the last field in itab&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;loop at itab. 
  at end of menge.
  SUM.
  endat.
endloop.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;or declarare all other fields as char and menge as numeric and then use&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;loop at itab.
collect itab.
endloop.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 May 2006 12:22:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-collect/m-p/1364646#M180558</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-05-24T12:22:39Z</dc:date>
    </item>
    <item>
      <title>Re: problem with collect</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-collect/m-p/1364647#M180559</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi rani,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TRY USING SUM.&lt;/P&gt;&lt;P&gt;SORT ITAB.&lt;/P&gt;&lt;P&gt;LOOP AT ITAB.&lt;/P&gt;&lt;P&gt;AT END OF MENGE.&lt;/P&gt;&lt;P&gt;SUM.&lt;/P&gt;&lt;P&gt;ENDAT.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HOPE THIS HELPS,&lt;/P&gt;&lt;P&gt;PRIYA.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 May 2006 12:23:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-collect/m-p/1364647#M180559</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-05-24T12:23:31Z</dc:date>
    </item>
    <item>
      <title>Re: problem with collect</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-collect/m-p/1364648#M180560</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Rani,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you tell me what are the other fields. i can't see your internal table fields fully. where exactly MENGE is there.&lt;/P&gt;&lt;P&gt;can you show your required Output.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;vijay&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 May 2006 12:23:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-collect/m-p/1364648#M180560</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-05-24T12:23:42Z</dc:date>
    </item>
    <item>
      <title>Re: problem with collect</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-collect/m-p/1364649#M180561</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;how what is the code pls&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 May 2006 12:24:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-collect/m-p/1364649#M180561</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-05-24T12:24:12Z</dc:date>
    </item>
    <item>
      <title>Re: problem with collect</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-collect/m-p/1364650#M180562</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;the itab is 3 lines&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ebeln ebelp ....menge&lt;/P&gt;&lt;P&gt;11111  10       30&lt;/P&gt;&lt;P&gt;22222  20       10&lt;/P&gt;&lt;P&gt;22222  20       5&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 May 2006 12:26:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-collect/m-p/1364650#M180562</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-05-24T12:26:33Z</dc:date>
    </item>
    <item>
      <title>Re: problem with collect</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-collect/m-p/1364651#M180563</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi rani,&lt;/P&gt;&lt;P&gt;ucan use &lt;/P&gt;&lt;P&gt;loop at itab.&lt;/P&gt;&lt;P&gt;at end of matnr .&lt;/P&gt;&lt;P&gt;sum(menge).&lt;/P&gt;&lt;P&gt;endat.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;award if helpful.&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;keerthi.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 May 2006 12:28:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-collect/m-p/1364651#M180563</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-05-24T12:28:55Z</dc:date>
    </item>
    <item>
      <title>Re: problem with collect</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-collect/m-p/1364652#M180564</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Considering the input that you have specified ..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;11111 10 4 3 3 3 3 10&lt;/P&gt;&lt;P&gt;22222 10 3 3 3 3 3 5&lt;/P&gt;&lt;P&gt;22222 10 3 3 3 3 3 10 &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;do u want the 2 lines as below &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;11111 10 4 3 3 3 3 10&lt;/P&gt;&lt;P&gt;22222 10 3 3 3 3 3 15       ....( 5 + 10 ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if so then code like this .. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data : l_menge type menge.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sort itab by matnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at itab.&lt;/P&gt;&lt;P&gt;l_menge = l_menge + itab-menge.&lt;/P&gt;&lt;P&gt;at end of matnr.&lt;/P&gt;&lt;P&gt;move-corresponding fields of itab to itab_collect.&lt;/P&gt;&lt;P&gt;itab_collect-menge = l_menge.&lt;/P&gt;&lt;P&gt;append itab_collect.&lt;/P&gt;&lt;P&gt;clear l_menge.&lt;/P&gt;&lt;P&gt;endat.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 May 2006 12:36:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-collect/m-p/1364652#M180564</guid>
      <dc:creator>nishanthbhandar</dc:creator>
      <dc:date>2006-05-24T12:36:01Z</dc:date>
    </item>
    <item>
      <title>Re: problem with collect</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-collect/m-p/1364653#M180565</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;define your destination table as sorted table with unique key &amp;lt;field 1&amp;gt; &amp;lt;field 2&amp;gt;...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;read table destination_tab with key&lt;/P&gt;&lt;P&gt;&amp;lt;field 1&amp;gt; =  itab-&amp;lt;field 1&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;field 2&amp;gt; =  itab-&amp;lt;field 2&amp;gt;.&lt;/P&gt;&lt;P&gt;if sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;insert itab into table destination_tab.&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;add itab-field3 to destination_tab-field3.&lt;/P&gt;&lt;P&gt;add itab-field4 to destination_tab-field4.&lt;/P&gt;&lt;P&gt;add itab-field5 to destination_tab-field5.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;put this into a form-routine, use field symbols and itabs without headlines and we all like it better...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Clemens&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 May 2006 14:16:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-collect/m-p/1364653#M180565</guid>
      <dc:creator>Clemenss</dc:creator>
      <dc:date>2006-05-24T14:16:39Z</dc:date>
    </item>
  </channel>
</rss>

