<?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 SELECT Major record in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-major-record/m-p/12129664#M1975029</link>
    <description>&lt;P&gt;in a ZTAB, for the same ZFIELD1 field that is not a key field, I have to take the record with the higher ZFIELD2, how can I do it?&lt;/P&gt;</description>
    <pubDate>Mon, 02 Mar 2020 18:16:42 GMT</pubDate>
    <dc:creator>f_allocca</dc:creator>
    <dc:date>2020-03-02T18:16:42Z</dc:date>
    <item>
      <title>SELECT Major record</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-major-record/m-p/12129664#M1975029</link>
      <description>&lt;P&gt;in a ZTAB, for the same ZFIELD1 field that is not a key field, I have to take the record with the higher ZFIELD2, how can I do it?&lt;/P&gt;</description>
      <pubDate>Mon, 02 Mar 2020 18:16:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-major-record/m-p/12129664#M1975029</guid>
      <dc:creator>f_allocca</dc:creator>
      <dc:date>2020-03-02T18:16:42Z</dc:date>
    </item>
    <item>
      <title>Re: SELECT Major record</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-major-record/m-p/12129665#M1975030</link>
      <description>&lt;P&gt;For a single select you can filter for ZFIELD1 and then order by ZFIELD2 descending:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;select *&lt;BR /&gt;from ztab&lt;BR /&gt;where zfield1 eq 'ABC'
order by zfield2 descending&lt;BR /&gt;into @data(select_result_single).&lt;BR /&gt;endselect.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;For a mass selection you can group by ZFIELD1 and select the maximum ZFIELD2 if you are only interested in these fields:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;select zfield1,&lt;BR /&gt;       max(zfield2)&lt;BR /&gt;from ztab&lt;BR /&gt;group by zfield1&lt;BR /&gt;into table @data(select_result_multiple).&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;If you need the whole line you will have to use above select as preselection and select the whole record afterwards (best: join, also possible: sub-select). This could the also be hidden inside cds-views.&lt;BR /&gt;This is often needed when needing to select the most up to data record for every key combination.&lt;/P&gt;</description>
      <pubDate>Mon, 02 Mar 2020 19:19:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-major-record/m-p/12129665#M1975030</guid>
      <dc:creator>BiberM</dc:creator>
      <dc:date>2020-03-02T19:19:09Z</dc:date>
    </item>
  </channel>
</rss>

