<?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: selecting the last record from a database table in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/selecting-the-last-record-from-a-database-table/m-p/3472951#M834793</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;take sy-tfill or decribe table stmt, then u will get total no of records,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;then read it with index sy-tfill.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 07 Mar 2008 16:55:49 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-03-07T16:55:49Z</dc:date>
    <item>
      <title>selecting the last record from a database table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/selecting-the-last-record-from-a-database-table/m-p/3472949#M834791</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In my ABAP Program, I have to use a select statement to retrieve the last record from the database table with the same key.  In other words, the Program will get more than one hit on the database table for the selected keys and I need to retrieve values from only the last record and not the first.  I know I can use an internal table to sort the records first and then retrieve the right value.   But to make things easier, is there a SELECT statement keyword than I can use to do this in one single step?  Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Mar 2008 16:50:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/selecting-the-last-record-from-a-database-table/m-p/3472949#M834791</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-07T16:50:39Z</dc:date>
    </item>
    <item>
      <title>Re: selecting the last record from a database table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/selecting-the-last-record-from-a-database-table/m-p/3472950#M834792</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;May be this way&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
select single * from mara
  ....
  ....
  ....
order by matnr descending.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; a®&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Mar 2008 16:54:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/selecting-the-last-record-from-a-database-table/m-p/3472950#M834792</guid>
      <dc:creator>former_member194669</dc:creator>
      <dc:date>2008-03-07T16:54:40Z</dc:date>
    </item>
    <item>
      <title>Re: selecting the last record from a database table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/selecting-the-last-record-from-a-database-table/m-p/3472951#M834793</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;take sy-tfill or decribe table stmt, then u will get total no of records,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;then read it with index sy-tfill.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Mar 2008 16:55:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/selecting-the-last-record-from-a-database-table/m-p/3472951#M834793</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-07T16:55:49Z</dc:date>
    </item>
    <item>
      <title>Re: selecting the last record from a database table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/selecting-the-last-record-from-a-database-table/m-p/3472952#M834794</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;SELECT * FROM (table)
  UP TO 1 ROWS
  ORDER BY (key fields) DESCENDING.

ENDSELECT.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Mar 2008 17:07:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/selecting-the-last-record-from-a-database-table/m-p/3472952#M834794</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-07T17:07:01Z</dc:date>
    </item>
    <item>
      <title>Re: selecting the last record from a database table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/selecting-the-last-record-from-a-database-table/m-p/3472953#M834795</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;can u say one thing u want the last record after sorting your table  or u want it after just selecting the table&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Mar 2008 17:12:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/selecting-the-last-record-from-a-database-table/m-p/3472953#M834795</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-07T17:12:17Z</dc:date>
    </item>
    <item>
      <title>Re: selecting the last record from a database table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/selecting-the-last-record-from-a-database-table/m-p/3472954#M834796</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;tables:mara.&lt;/P&gt;&lt;P&gt;    data: begin of it_mara occurs 0,&lt;/P&gt;&lt;P&gt;            matnr like mara-matnr,&lt;/P&gt;&lt;P&gt;            meins like mara-meins,&lt;/P&gt;&lt;P&gt;            mtart like mara-mtart,&lt;/P&gt;&lt;P&gt;            end of it_mara.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select-options:s_matnr for mara-matnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select matnr&lt;/P&gt;&lt;P&gt;          meins&lt;/P&gt;&lt;P&gt;          mtart &lt;/P&gt;&lt;P&gt;from mara&lt;/P&gt;&lt;P&gt;into table it_mara&lt;/P&gt;&lt;P&gt;where matnr in s_matnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if not it_mara[] is initial.&lt;/P&gt;&lt;P&gt;sort it_mara by matnr descending.&lt;/P&gt;&lt;P&gt;read table it_mara index 1.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;then you get the last record of the select statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;reward points if useful,&lt;/P&gt;&lt;P&gt;venkat.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Mar 2008 17:21:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/selecting-the-last-record-from-a-database-table/m-p/3472954#M834796</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-07T17:21:27Z</dc:date>
    </item>
  </channel>
</rss>

