<?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: db tables in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/db-tables/m-p/2746962#M638649</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;select distinct cusid from zvcustomer into corresponding fields of table itab.

loop at itab.
  select max(ttime) from zvcustomer into itab-maxtime where cusid = itab-cusid.
  select min(ttime) from zvcustomer into itab-mintime where cusid = itab-cusid.
  modify itab.
endloop.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;then write the data&lt;/P&gt;&lt;P&gt;i am just guessing your field names&lt;/P&gt;&lt;P&gt;ttime -&amp;gt; the database field for your transaction time&lt;/P&gt;&lt;P&gt;cusid -&amp;gt; the database field for your customer id&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;declare the internal table itab with &lt;/P&gt;&lt;P&gt;1. customer id like zvcustomer-cusid&lt;/P&gt;&lt;P&gt;2. maxtime like zvcustomer-time&lt;/P&gt;&lt;P&gt;3. mintime like zvcustomer-time&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: &lt;/P&gt;&lt;P&gt;        Kris Donald&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 03 Sep 2007 11:04:02 GMT</pubDate>
    <dc:creator>former_member189059</dc:creator>
    <dc:date>2007-09-03T11:04:02Z</dc:date>
    <item>
      <title>db tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/db-tables/m-p/2746961#M638648</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;we have an ztable(zvcustomer),in that ztable there are 2 fileds customer id and transaction time",one customer may have multiple  "transaction time",based on customer id i have to pick the  maximum or minimum  "transaction time". plse help me how to fetch the data.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Sep 2007 11:00:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/db-tables/m-p/2746961#M638648</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-03T11:00:11Z</dc:date>
    </item>
    <item>
      <title>Re: db tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/db-tables/m-p/2746962#M638649</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;select distinct cusid from zvcustomer into corresponding fields of table itab.

loop at itab.
  select max(ttime) from zvcustomer into itab-maxtime where cusid = itab-cusid.
  select min(ttime) from zvcustomer into itab-mintime where cusid = itab-cusid.
  modify itab.
endloop.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;then write the data&lt;/P&gt;&lt;P&gt;i am just guessing your field names&lt;/P&gt;&lt;P&gt;ttime -&amp;gt; the database field for your transaction time&lt;/P&gt;&lt;P&gt;cusid -&amp;gt; the database field for your customer id&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;declare the internal table itab with &lt;/P&gt;&lt;P&gt;1. customer id like zvcustomer-cusid&lt;/P&gt;&lt;P&gt;2. maxtime like zvcustomer-time&lt;/P&gt;&lt;P&gt;3. mintime like zvcustomer-time&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: &lt;/P&gt;&lt;P&gt;        Kris Donald&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Sep 2007 11:04:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/db-tables/m-p/2746962#M638649</guid>
      <dc:creator>former_member189059</dc:creator>
      <dc:date>2007-09-03T11:04:02Z</dc:date>
    </item>
    <item>
      <title>Re: db tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/db-tables/m-p/2746963#M638650</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Get the data first - for a particular user- &lt;/P&gt;&lt;P&gt;SELECT *&lt;/P&gt;&lt;P&gt;from       ZTABLE&lt;/P&gt;&lt;P&gt;into        i_tran&lt;/P&gt;&lt;P&gt;where     userid = p_user.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;now do a sort DESCENDING if you want to have the max.&lt;/P&gt;&lt;P&gt;SORT i_TRAN by TRAN_TIME DESCENDING .&lt;/P&gt;&lt;P&gt;READ TABLE I_TRAN INDEX 1. "Fetching the Max value of Tran time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;or&lt;/P&gt;&lt;P&gt;SORT i_TRAN by TRAN_TIME ASCENDING .&lt;/P&gt;&lt;P&gt;READ TABLE I_TRAN INDEX 1. "Fetching the Min value of Tran time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; Hope it helps.&lt;/P&gt;&lt;P&gt;SKC&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Sep 2007 11:08:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/db-tables/m-p/2746963#M638650</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-03T11:08:57Z</dc:date>
    </item>
    <item>
      <title>Re: db tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/db-tables/m-p/2746964#M638651</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi serma......&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;          here is the coding:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
 data:
      begin of wa,
       id TYPE &amp;lt;dbtab-fieldname&amp;gt;,
      maxtime TYPE &amp;lt;dbtab-fieldname&amp;gt;,
      mintime TYPE &amp;lt;dbtab-fieldname&amp;gt;,
     END OF wa,

     it like STANDARD TABLE OF wa.

select max( ttime ) min( ttime ) FROM &amp;lt;dbtab&amp;gt; INTO TABLE it where
  cid = '&amp;lt;customer id&amp;gt;'. &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Sep 2007 11:22:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/db-tables/m-p/2746964#M638651</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-03T11:22:41Z</dc:date>
    </item>
  </channel>
</rss>

