<?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 data from the table in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/selecting-the-data-from-the-table/m-p/3134013#M744623</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Kumar,&lt;/P&gt;&lt;P&gt; if u have begda and endda then in wher condition specify endda = 31.12.999 this wil fetch latest record..or else..&lt;/P&gt;&lt;P&gt;sort itab by date..&lt;/P&gt;&lt;P&gt;loop at itab.&lt;/P&gt;&lt;P&gt;at new customer.&lt;/P&gt;&lt;P&gt;append to itab1.&lt;/P&gt;&lt;P&gt;endat.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Kaveri&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 14 Dec 2007 05:55:28 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-12-14T05:55:28Z</dc:date>
    <item>
      <title>selecting the data from the table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/selecting-the-data-from-the-table/m-p/3134012#M744622</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have a query where in the table a single customer is having many entries and all those entries has corresponding date on which it was created  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My select statement has to get the most recent date out of it.&lt;/P&gt;&lt;P&gt;ex-&lt;/P&gt;&lt;P&gt;cus    date&lt;/P&gt;&lt;P&gt;1 - 20.07.2007&lt;/P&gt;&lt;P&gt;2 - 13.06.2007&lt;/P&gt;&lt;P&gt;3 - 15.09.2007&lt;/P&gt;&lt;P&gt;then it should fetch 3 - 15.09.2007&lt;/P&gt;&lt;P&gt;I cannot use the MAX or any of the aggregate function as i am using FOR ALL ENTRIES statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any pointers will be very helpful.&lt;/P&gt;&lt;P&gt;Please suggest the solution keeping the  performance in mind as FOR ALL ENTRIES itab is having many customer data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Kumar Shantanu&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Dec 2007 05:50:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/selecting-the-data-from-the-table/m-p/3134012#M744622</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-12-14T05:50:21Z</dc:date>
    </item>
    <item>
      <title>Re: selecting the data from the table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/selecting-the-data-from-the-table/m-p/3134013#M744623</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Kumar,&lt;/P&gt;&lt;P&gt; if u have begda and endda then in wher condition specify endda = 31.12.999 this wil fetch latest record..or else..&lt;/P&gt;&lt;P&gt;sort itab by date..&lt;/P&gt;&lt;P&gt;loop at itab.&lt;/P&gt;&lt;P&gt;at new customer.&lt;/P&gt;&lt;P&gt;append to itab1.&lt;/P&gt;&lt;P&gt;endat.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Kaveri&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Dec 2007 05:55:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/selecting-the-data-from-the-table/m-p/3134013#M744623</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-12-14T05:55:28Z</dc:date>
    </item>
    <item>
      <title>Re: selecting the data from the table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/selecting-the-data-from-the-table/m-p/3134014#M744624</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;suppose itab have two fileds cutomer n date...&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;sort itab by customer number date descending.&lt;/P&gt;&lt;P&gt;delete adjacent duplicates from itab comparing customernumber.&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;now only customernumber and corresponding latest dates will only be left....&lt;/P&gt;&lt;P&gt;if u want the entries for later use.. u can move it to diff internal table n do the same ..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: &lt;/P&gt;&lt;P&gt;        Sheeba Bhaskaran&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Dec 2007 05:57:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/selecting-the-data-from-the-table/m-p/3134014#M744624</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-12-14T05:57:11Z</dc:date>
    </item>
    <item>
      <title>Re: selecting the data from the table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/selecting-the-data-from-the-table/m-p/3134015#M744625</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Kumar&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can fetch using ur select query and then sort the table by in descending order by date and then by your key field.&lt;/P&gt;&lt;P&gt;Then use the statement, delete adjacent duplicates, comaping your key field which will leave only rows which have recent date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;pseudo code:&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;&lt;/P&gt;&lt;P&gt;  SORT itab DESCENDING STABLE  BY date key_field.&lt;/P&gt;&lt;P&gt;  DELETE ADJACENT DUPLICATES FROM itab comparing key_filed.&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ravish&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Dec 2007 05:58:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/selecting-the-data-from-the-table/m-p/3134015#M744625</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-12-14T05:58:20Z</dc:date>
    </item>
    <item>
      <title>Re: selecting the data from the table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/selecting-the-data-from-the-table/m-p/3134016#M744626</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;  Usde order by statement&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;do like this &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select f1 f2 f3  ...........&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;where date = s_date  order by (date) descending&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Prashant&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Dec 2007 05:58:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/selecting-the-data-from-the-table/m-p/3134016#M744626</guid>
      <dc:creator>former_member386202</dc:creator>
      <dc:date>2007-12-14T05:58:25Z</dc:date>
    </item>
    <item>
      <title>Re: selecting the data from the table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/selecting-the-data-from-the-table/m-p/3134017#M744627</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;         Hi first select the data from database table to internal table using max function then using that internal table u can use FOR ALL ENTRIES clause.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;data : zkna1 like kna1 occurs 0 with header line.

select * from kna1 into zkna1 where kunnr in s_kunnr and
                                                     &amp;lt;condition on date &amp;gt;.

* now use for all entry

select field1 field2 from &amp;lt;dbtab&amp;gt;into corresponding fields of table itab  for all entries in ZKNA1 were kunnr = zkna1-kunnr.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rewards if helpful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Gagan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Dec 2007 05:59:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/selecting-the-data-from-the-table/m-p/3134017#M744627</guid>
      <dc:creator>former_member194152</dc:creator>
      <dc:date>2007-12-14T05:59:37Z</dc:date>
    </item>
    <item>
      <title>Re: selecting the data from the table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/selecting-the-data-from-the-table/m-p/3134018#M744628</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;thanks sheeba for the answer but performance is not improved it is still fetching all the data from the table and then i am doing what you have send.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It would be better if i do the select query by restricting the date field there.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;AS i have already told most of the people have answered using order by or something else(we cannot use these if the statement FOR ALL ENTRIES is there), and some by asking me to hit the database table twice &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please suggest answer by hitting the table only once.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Dec 2007 06:46:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/selecting-the-data-from-the-table/m-p/3134018#M744628</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-12-14T06:46:04Z</dc:date>
    </item>
  </channel>
</rss>

