<?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 select fetching data and processing in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-select-fetching-data-and-processing/m-p/11921232#M1963875</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It doesn't matter whether you're using HANA database or ORACLE or any other. The order of returned records is &lt;STRONG&gt;never&lt;/STRONG&gt; guaranteed to be sorted! &lt;SPAN style="font-size: 10pt;"&gt;If you want it ordered, you &lt;/SPAN&gt;&lt;STRONG style="font-size: 10pt;"&gt;must&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt;"&gt; specify an &lt;/SPAN&gt;&lt;STRONG style="font-size: 10pt;"&gt;ORDER BY&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt;"&gt; clause.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 19 Sep 2016 06:14:57 GMT</pubDate>
    <dc:creator>matt</dc:creator>
    <dc:date>2016-09-19T06:14:57Z</dc:date>
    <item>
      <title>Problem with select fetching data and processing</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-select-fetching-data-and-processing/m-p/11921230#M1963873</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Experts,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;I am doing performance tuning for a program.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am fetching data from EKET table based on EBELN , EBELP and EINDT field entries into I_EKET table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Than I am processing the entries in I_EKET table as &lt;/P&gt;&lt;P&gt;&lt;SPAN class="L0S52"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="L0S52"&gt;SELECT &lt;/SPAN&gt;EBELN EBELP EINDT&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="L0S52"&gt;FROM&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;EKET&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="L0S52"&gt;INTO&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="L0S52"&gt;TABLE &lt;/SPAN&gt;I_EKET&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="L0S52"&gt;FOR &lt;/SPAN&gt;&lt;SPAN class="L0S52"&gt;ALL &lt;/SPAN&gt;ENTRIES &lt;SPAN class="L0S52"&gt;IN &lt;/SPAN&gt;I_EKPO&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="L0S52"&gt;WHERE &lt;/SPAN&gt;EBELN &lt;SPAN class="L0S52"&gt;EQ &lt;/SPAN&gt;I_EKPO&lt;SPAN class="L0S70"&gt;-&lt;/SPAN&gt;EBELN&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="L0S52"&gt;AND&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;EBELP &lt;SPAN class="L0S52"&gt;EQ &lt;/SPAN&gt;I_EKPO&lt;SPAN class="L0S70"&gt;-&lt;/SPAN&gt;EBELP&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="L0S52"&gt;AND&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;EINDT &lt;SPAN class="L0S52"&gt;IN &lt;/SPAN&gt;S_EINDT&lt;SPAN class="L0S55"&gt;.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="L0S52"&gt;IF &lt;/SPAN&gt;I_EKET[] &lt;SPAN class="L0S52"&gt;IS &lt;/SPAN&gt;&lt;SPAN class="L0S52"&gt;NOT &lt;/SPAN&gt;&lt;SPAN class="L0S52"&gt;INITIAL&lt;/SPAN&gt;&lt;SPAN class="L0S55"&gt;.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="L0S52"&gt;SORT &lt;/SPAN&gt;I_EKET &lt;SPAN class="L0S52"&gt;BY &lt;/SPAN&gt;EBELN EBELP&lt;SPAN class="L0S55"&gt;.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="L0S52"&gt;DELETE &lt;/SPAN&gt;&lt;SPAN class="L0S52"&gt;ADJACENT &lt;/SPAN&gt;&lt;SPAN class="L0S52"&gt;DUPLICATES &lt;/SPAN&gt;&lt;SPAN class="L0S52"&gt;FROM &lt;/SPAN&gt;I_EKET &lt;SPAN class="L0S52"&gt;COMPARING &lt;/SPAN&gt;&lt;SPAN class="L0S52"&gt;ALL &lt;/SPAN&gt;&lt;SPAN class="L0S52"&gt;FIELDS&lt;/SPAN&gt;&lt;SPAN class="L0S55"&gt;.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="L0S55"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="L0S55"&gt;is it possible to write the sort and delete adjacent duplicates inside the select query itself.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="L0S55"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="L0S55"&gt;Thanks,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="L0S55"&gt;RG&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 17 Sep 2016 15:13:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-select-fetching-data-and-processing/m-p/11921230#M1963873</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2016-09-17T15:13:16Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with select fetching data and processing</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-select-fetching-data-and-processing/m-p/11921231#M1963874</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ramya G,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think following select statement will cover your duplicates:&lt;/P&gt;&lt;P&gt;&lt;SPAN class="L0S52"&gt;SELECT &lt;/SPAN&gt;&lt;SPAN class="L0S52"&gt;distinct &lt;/SPAN&gt;EBELN EBELP EINDT&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="L0S52"&gt;FROM&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;EKET&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="L0S52"&gt;INTO&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="L0S52"&gt;TABLE &lt;/SPAN&gt;I_EKET&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="L0S52"&gt;FOR &lt;/SPAN&gt;&lt;SPAN class="L0S52"&gt;ALL &lt;/SPAN&gt;ENTRIES &lt;SPAN class="L0S52"&gt;IN &lt;/SPAN&gt;I_EKPO&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="L0S52"&gt;WHERE &lt;/SPAN&gt;EBELN &lt;SPAN class="L0S52"&gt;EQ &lt;/SPAN&gt;I_EKPO&lt;SPAN class="L0S70"&gt;-&lt;/SPAN&gt;EBELN&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="L0S52"&gt;AND&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;EBELP &lt;SPAN class="L0S52"&gt;EQ &lt;/SPAN&gt;I_EKPO&lt;SPAN class="L0S70"&gt;-&lt;/SPAN&gt;EBELP&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="L0S52"&gt;AND&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;EINDT &lt;SPAN class="L0S52"&gt;IN &lt;/SPAN&gt;S_EINDT&lt;SPAN style="font-size: 10pt;"&gt;.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="L0S55"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="L0S55"&gt;Distinct will filter your duplicates. BUT, distinct also has a low performance.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="L0S55"&gt;(&lt;A href="https://wiki.scn.sap.com/wiki/display/Community/ABAP+Performance+tips" title="https://wiki.scn.sap.com/wiki/display/Community/ABAP+Performance+tips"&gt;ABAP Performance tips - Contributor Corner [Read-only] - SCN Wiki&lt;/A&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="L0S55"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="L0S55"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="L0S55"&gt;AND, if you are using a HANA database, it is possible that your data will be unsorted.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="L0S55"&gt;(&lt;/SPAN&gt;&lt;A __default_attr="46714" __jive_macro_name="document" class="jive_macro_document jive_macro" data-orig-content="Best Practice Guide - Considerations for Custom ABAP Code During a Migration to SAP HANA" href="https://community.sap.com/" modifiedtitle="true" style="font-size: 10pt;" title="Best Practice Guide - Considerations for Custom ABAP Code During a Migration to SAP HANA"&gt;&lt;/A&gt;&lt;SPAN style="font-size: 10pt;"&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="L0S55"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="L0S55"&gt;If your data needs to be sorted and you are on a HANA database, then you will have to use the&lt;STRONG&gt; order by&lt;/STRONG&gt; statement.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="L0S55"&gt;With a for all entry you can only use 'order by primary key'. However you &lt;STRONG&gt;do not use all the key fields&lt;/STRONG&gt; in your select statement so it will not be possible to use the 'order by primary key'.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="L0S55"&gt;So, I think the best way to solve this, is by removing the for all entries.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="L0S55"&gt;I see that you are using a for all entries on EKPO. Did you do a select statement on EKPO before the select statement above? Maybe you can Join them, hereby avoiding the use of a 'for all entries' and nicely place the needed ekpo and eket data in one itab. And place a 'sort by ebeln, ebelp' &lt;SPAN style="font-size: 13.3333px;"&gt;and a 'group by ebeln ebelp...' &lt;/SPAN&gt;in the joined select statement. This is of course only valid if you do not have a for all entries in you EKPO select statement.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="L0S55"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="L0S55"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 17 Sep 2016 21:25:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-select-fetching-data-and-processing/m-p/11921231#M1963874</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2016-09-17T21:25:25Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with select fetching data and processing</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-select-fetching-data-and-processing/m-p/11921232#M1963875</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It doesn't matter whether you're using HANA database or ORACLE or any other. The order of returned records is &lt;STRONG&gt;never&lt;/STRONG&gt; guaranteed to be sorted! &lt;SPAN style="font-size: 10pt;"&gt;If you want it ordered, you &lt;/SPAN&gt;&lt;STRONG style="font-size: 10pt;"&gt;must&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt;"&gt; specify an &lt;/SPAN&gt;&lt;STRONG style="font-size: 10pt;"&gt;ORDER BY&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt;"&gt; clause.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Sep 2016 06:14:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-select-fetching-data-and-processing/m-p/11921232#M1963875</guid>
      <dc:creator>matt</dc:creator>
      <dc:date>2016-09-19T06:14:57Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with select fetching data and processing</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-select-fetching-data-and-processing/m-p/11921233#M1963876</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI Ramya,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Go for Secondary index to remove any duplicate entries while fetching data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks, &lt;/P&gt;&lt;P&gt;Paul &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Sep 2016 06:42:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-select-fetching-data-and-processing/m-p/11921233#M1963876</guid>
      <dc:creator>former_member405170</dc:creator>
      <dc:date>2016-09-19T06:42:49Z</dc:date>
    </item>
  </channel>
</rss>

