<?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: getting last record in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/getting-last-record/m-p/1288978#M154801</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;first declare a variable of type i. say count.&lt;/P&gt;&lt;P&gt;data : count type i.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;next, select all the rows from the database table into an internal table, so that we get the total number of rows in the table.&lt;/P&gt;&lt;P&gt;The total count corresponds to the last row in the table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select * from tablename into table internaltablename.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Describe table internaltablename lines count.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;read table internaltablename index count.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This will have the last row read from the internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;Smitha&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 13 Mar 2006 05:02:01 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-03-13T05:02:01Z</dc:date>
    <item>
      <title>getting last record</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/getting-last-record/m-p/1288973#M154796</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;Is there any way to get last record from any db table?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;kaki&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Mar 2006 04:29:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/getting-last-record/m-p/1288973#M154796</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-03-13T04:29:41Z</dc:date>
    </item>
    <item>
      <title>Re: getting last record</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/getting-last-record/m-p/1288974#M154797</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;PRE&gt;&lt;CODE&gt;report adtest.
data: index type i.

data : begin of itab occurs 0.
       include structure zdbtable.
data: end of itab.

select * from zdbtable into table itab .

Describe table itab lines index.
read table itab index index.

write index.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Anjali&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Mar 2006 04:33:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/getting-last-record/m-p/1288974#M154797</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-03-13T04:33:00Z</dc:date>
    </item>
    <item>
      <title>Re: getting last record</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/getting-last-record/m-p/1288975#M154798</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Kaki,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As such there is no way you can get the number of records in a db table without querying it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, in your case, first get all the records from database into an internal table. Then using the DESCRIBE keyword find the number of records in that internal table. Then read that internal table using that total number of records as index.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this would be useful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Priya&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Mar 2006 04:40:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/getting-last-record/m-p/1288975#M154798</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-03-13T04:40:12Z</dc:date>
    </item>
    <item>
      <title>Re: getting last record</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/getting-last-record/m-p/1288976#M154799</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi&lt;/P&gt;&lt;P&gt;U can be used MAX in the select query. i.e. Suppose Material or Sales order u want select then u can use&lt;/P&gt;&lt;P&gt;SELECT MAX (VBELN) .........&lt;/P&gt;&lt;P&gt;Hope this will be useful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;vinod&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Mar 2006 04:41:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/getting-last-record/m-p/1288976#M154799</guid>
      <dc:creator>vinod_gunaware2</dc:creator>
      <dc:date>2006-03-13T04:41:58Z</dc:date>
    </item>
    <item>
      <title>Re: getting last record</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/getting-last-record/m-p/1288977#M154800</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;YOU CAN USE THE CODE&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;DESCRIBE TABLE ITAB LINES SY-TFILL. &lt;/P&gt;&lt;P&gt;READ TABLE ITAB INDEX SY-TFILL.&amp;lt;/b&amp;gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TO GET THE LAST RECORD INSERTED TO A TABLE&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF USEFUL PLEASE REWARD POINTS&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REGARDS&lt;/P&gt;&lt;P&gt;ANOOP&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Mar 2006 04:45:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/getting-last-record/m-p/1288977#M154800</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-03-13T04:45:47Z</dc:date>
    </item>
    <item>
      <title>Re: getting last record</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/getting-last-record/m-p/1288978#M154801</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;first declare a variable of type i. say count.&lt;/P&gt;&lt;P&gt;data : count type i.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;next, select all the rows from the database table into an internal table, so that we get the total number of rows in the table.&lt;/P&gt;&lt;P&gt;The total count corresponds to the last row in the table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select * from tablename into table internaltablename.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Describe table internaltablename lines count.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;read table internaltablename index count.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This will have the last row read from the internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;Smitha&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Mar 2006 05:02:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/getting-last-record/m-p/1288978#M154801</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-03-13T05:02:01Z</dc:date>
    </item>
    <item>
      <title>Re: getting last record</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/getting-last-record/m-p/1288979#M154802</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi kaki,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Is there any way to get last record from any db table?&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;  Last in what sense ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. Last added to the table ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. If so then,&lt;/P&gt;&lt;P&gt;   if the fields are available in the table,&lt;/P&gt;&lt;P&gt;   ie. (add date)&lt;/P&gt;&lt;P&gt;  then still we can get.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4. Other wise, there is not technique&lt;/P&gt;&lt;P&gt;   by which database can provide&lt;/P&gt;&lt;P&gt;   the last record.&lt;/P&gt;&lt;P&gt;  (the sequence of records returned in&lt;/P&gt;&lt;P&gt;  sql by the database,&lt;/P&gt;&lt;P&gt;  is never the same way, i mean,&lt;/P&gt;&lt;P&gt;  no body can guarantee that it returns&lt;/P&gt;&lt;P&gt;  the last record, at the last)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;5. eg&lt;/P&gt;&lt;P&gt;   suppose we want to get the lastest record from&lt;/P&gt;&lt;P&gt;   ekko table,&lt;/P&gt;&lt;P&gt;   then based upon the field AEDAT&lt;/P&gt;&lt;P&gt;   we can write this logic&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   (just copy paste in new program)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REPORT abc.&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;HR originaltext="----------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA : aedat LIKE ekko-aedat.&lt;/P&gt;&lt;P&gt;DATA : ekko LIKE TABLE OF ekko WITH HEADER LINE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="--------" /&gt;&lt;P&gt; First get MAX / LATEST date&lt;/P&gt;&lt;P&gt;SELECT SINGLE MAX( aedat ) FROM&lt;/P&gt;&lt;P&gt;ekko INTO aedat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="--------" /&gt;&lt;P&gt; Then get the record&lt;/P&gt;&lt;P&gt;SELECT * FROM ekko&lt;/P&gt;&lt;P&gt;INTO TABLE ekko&lt;/P&gt;&lt;P&gt;WHERE aedat = aedat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BREAK-POINT.&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;&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;HR originaltext="-----------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;*PARAMETERS : a RADIOBUTTON GROUP g1  USER-COMMAND rad,&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;            b RADIOBUTTON GROUP g1.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;*PARAMETERS : t1(10) TYPE c DEFAULT 'Hello' MODIF ID p,&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;            t2(10) TYPE c DEFAULT 'Abdul' MODIF ID q.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;**----&lt;/P&gt;&lt;HR originaltext="-------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;*INITIALIZATION.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; a = 'X'.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;**----&lt;/P&gt;&lt;HR originaltext="-------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;*AT SELECTION-SCREEN OUTPUT.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; LOOP AT SCREEN.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;   IF a = 'X'.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;     IF screen-group1 = 'Q'.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;       screen-input = 0.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;       screen-invisible  = 1.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;       MODIFY SCREEN.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;     ENDIF.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;   ENDIF.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&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;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;   IF b = 'X'.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;     IF screen-group1 = 'P'.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;       screen-input = 0.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;       screen-invisible  = 1.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;       MODIFY SCREEN.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;     ENDIF.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;   ENDIF.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; ENDLOOP.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;amit m.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Mar 2006 05:06:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/getting-last-record/m-p/1288979#M154802</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-03-13T05:06:54Z</dc:date>
    </item>
    <item>
      <title>Re: getting last record</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/getting-last-record/m-p/1288980#M154803</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for all replies,&lt;/P&gt;&lt;P&gt;points alloted.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cheers&lt;/P&gt;&lt;P&gt;kaki&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Mar 2006 05:38:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/getting-last-record/m-p/1288980#M154803</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-03-13T05:38:55Z</dc:date>
    </item>
    <item>
      <title>Re: getting last record</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/getting-last-record/m-p/1288981#M154804</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Mar 2006 05:40:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/getting-last-record/m-p/1288981#M154804</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-03-13T05:40:06Z</dc:date>
    </item>
    <item>
      <title>Re: getting last record</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/getting-last-record/m-p/1288982#M154805</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;what i have done here is that &lt;/P&gt;&lt;P&gt;i have read the data from the table&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;marav &amp;lt;/b&amp;gt;into an internal table &amp;lt;b&amp;gt;itab&amp;lt;/b&amp;gt;.&lt;/P&gt;&lt;P&gt;after which i have read the last index&lt;/P&gt;&lt;P&gt;of the internal table and displayed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;try the following logic.&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="---" /&gt;&lt;P&gt;data: begin of itab occurs 0,&lt;/P&gt;&lt;P&gt;matnr like marav-matnr,&lt;/P&gt;&lt;P&gt;end of itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: i_lines like sy-tabix.&lt;/P&gt;&lt;P&gt;select matnr from marav into corresponding&lt;/P&gt;&lt;P&gt;fields of table itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;clear i_lines.&lt;/P&gt;&lt;P&gt;describe table itab lines i_lines.&lt;/P&gt;&lt;P&gt;read table itab index i_lines.&lt;/P&gt;&lt;P&gt;write:/ itab-matnr.&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="---" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;reward if found helpful...  &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;cheers,&lt;/P&gt;&lt;P&gt;Aditya.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Mar 2006 05:43:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/getting-last-record/m-p/1288982#M154805</guid>
      <dc:creator>former_member184495</dc:creator>
      <dc:date>2006-03-13T05:43:49Z</dc:date>
    </item>
    <item>
      <title>Re: getting last record</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/getting-last-record/m-p/1288983#M154806</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;select * into corresponding fields of table wa_zgkpf from zgkpf.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(populate data of table into wa)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;read table wa_zgkpf index sy-dbcnt.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(read the last record of wa)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;required field is wa_zgkpf-docno.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hope this will give u idea&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Mar 2006 05:53:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/getting-last-record/m-p/1288983#M154806</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-03-13T05:53:51Z</dc:date>
    </item>
    <item>
      <title>Re: getting last record</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/getting-last-record/m-p/1288984#M154807</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;you can try to use Select upto 1 row and use decending in select statment.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sample code:&lt;/P&gt;&lt;P&gt;data: wa_matnr like mara.      &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   select * into wa_matnr &lt;/P&gt;&lt;P&gt;   from mara  up to 1 rows&lt;/P&gt;&lt;P&gt;   order by matnr descending.&lt;/P&gt;&lt;P&gt;   endselect.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Niranjan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Mar 2006 12:46:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/getting-last-record/m-p/1288984#M154807</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-03-14T12:46:11Z</dc:date>
    </item>
  </channel>
</rss>

