<?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 Get additions throu Select in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/get-additions-throu-select/m-p/999239#M75984</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a doubt in retrieving the data from database.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please assume we have the table as below&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sales doc no    Date        Value      customer No&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1               10/05/2005   10000         1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2               10/02/2005   20000         1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3               05/05/2004   10000         1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4               05/10/2005   30000         2&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;5               12/12/2004   15000         2&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;6               14/10/2005   20000         2&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      If I want to get sales values during the year 2005. Is there any possibility sum-up the sales value in a single field into internal table. It means I want to see in the internal table structure like below during the year 2005&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;customer No     Sales Value&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   1               30000&lt;/P&gt;&lt;P&gt;        &lt;/P&gt;&lt;P&gt;   2               50000&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;       Please help me ASAP. I am very beginner in ABAP.&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;Praveen&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 05 Oct 2005 20:52:51 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2005-10-05T20:52:51Z</dc:date>
    <item>
      <title>Get additions throu Select</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/get-additions-throu-select/m-p/999239#M75984</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a doubt in retrieving the data from database.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please assume we have the table as below&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sales doc no    Date        Value      customer No&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1               10/05/2005   10000         1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2               10/02/2005   20000         1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3               05/05/2004   10000         1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4               05/10/2005   30000         2&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;5               12/12/2004   15000         2&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;6               14/10/2005   20000         2&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      If I want to get sales values during the year 2005. Is there any possibility sum-up the sales value in a single field into internal table. It means I want to see in the internal table structure like below during the year 2005&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;customer No     Sales Value&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   1               30000&lt;/P&gt;&lt;P&gt;        &lt;/P&gt;&lt;P&gt;   2               50000&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;       Please help me ASAP. I am very beginner in ABAP.&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;Praveen&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Oct 2005 20:52:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/get-additions-throu-select/m-p/999239#M75984</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-10-05T20:52:51Z</dc:date>
    </item>
    <item>
      <title>Re: Get additions throu Select</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/get-additions-throu-select/m-p/999240#M75985</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Praveen - this doesn't answer the specific question you're asking, but you can sum amounts from tables like:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;REPORT ztest.
TABLES bsis.
DATA tot LIKE bsis-dmbtr.
SELECT SUM( dmbtr )
  FROM bsis
  INTO tot
  WHERE gjahr = '2006'.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Oct 2005 21:03:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/get-additions-throu-select/m-p/999240#M75985</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-10-05T21:03:19Z</dc:date>
    </item>
    <item>
      <title>Re: Get additions throu Select</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/get-additions-throu-select/m-p/999241#M75986</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Praveen,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For this you have to use control level events.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Select all the fields you want from the database tables into an internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then loop thru that internal table and check for new customer using AT NEW control statement and the use COLLECT statement for summing up the values.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do F1 on AT NEW and COLLECT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;look at the following example code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES: BEGIN OF COMPANIES_TYPE, &lt;/P&gt;&lt;P&gt;        NAME(30), &lt;/P&gt;&lt;P&gt;        PRODUCT(20), &lt;/P&gt;&lt;P&gt;        SALES TYPE I, &lt;/P&gt;&lt;P&gt;      END   OF COMPANIES_TYPE. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: COMPANIES TYPE STANDARD TABLE OF COMPANIES_TYPE WITH &lt;/P&gt;&lt;P&gt;                     NON-UNIQUE DEFAULT KEY INITIAL SIZE 20, &lt;/P&gt;&lt;P&gt;      WA_COMPANIES TYPE COMPANIES_TYPE. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;... &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT COMPANIES INTO WA_COMPANIES. &lt;/P&gt;&lt;P&gt;  AT NEW NAME. &lt;/P&gt;&lt;P&gt;    NEW-PAGE. &lt;/P&gt;&lt;P&gt;    WRITE / WA_COMPANIES-NAME. &lt;/P&gt;&lt;P&gt;  ENDAT. &lt;/P&gt;&lt;P&gt;  WRITE: / WA_COMPANIES-PRODUCT, WA_COMPANIES-SALES. &lt;/P&gt;&lt;P&gt;  AT END OF NAME. &lt;/P&gt;&lt;P&gt;    SUM. &lt;/P&gt;&lt;P&gt;    WRITE: / WA_COMPANIES-NAME, WA_COMPANIES-SALES. &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;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: Naren Somen&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Oct 2005 21:06:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/get-additions-throu-select/m-p/999241#M75986</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-10-05T21:06:37Z</dc:date>
    </item>
    <item>
      <title>Re: Get additions throu Select</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/get-additions-throu-select/m-p/999242#M75987</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;More specifically:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
REPORT ztest.

TABLES vbap.

SELECT-OPTIONS: s_dat FOR vbap-erdat.

DATA tot LIKE vbap-netwr.

SELECT matnr SUM( netwr )
  FROM vbap
  INTO (vbap-matnr, tot)
  WHERE erdat IN s_dat
  GROUP BY MATNR.

ENDSELECT.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;This is very inefficiant because the select is done without using an index.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Oct 2005 21:22:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/get-additions-throu-select/m-p/999242#M75987</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-10-05T21:22:01Z</dc:date>
    </item>
  </channel>
</rss>

