<?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: logic in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/logic/m-p/2380267#M528207</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI ..&lt;/P&gt;&lt;P&gt; Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But TBTCO table does not give avg runtime, min , max&lt;/P&gt;&lt;P&gt;i found out runtime by subtracting strttime from endtime.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i have to calculate it&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 13 Jun 2007 10:50:46 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-06-13T10:50:46Z</dc:date>
    <item>
      <title>logic</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/logic/m-p/2380264#M528204</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;&lt;/P&gt;&lt;P&gt;i have a internal table with 90000 enteries,it has got details of background jobs. itab will have currently only details of jobname and runtime, other fields are blank.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Eg : jobname  | runtime |   averageruntime |  minruntime | maxruntime | Count&lt;/P&gt;&lt;P&gt;        JOB1      | 28        |                          |                   |                  |&lt;/P&gt;&lt;P&gt;       JOB1       | 14        |                          |                   |                  |                  &lt;/P&gt;&lt;P&gt;       JOB2       | 10        |                          |                   |                  |  &lt;/P&gt;&lt;P&gt;       JOB2       | 5          |                          |                   |                 |&lt;/P&gt;&lt;P&gt;       JOB3       | 8          |                          |                   |                 |&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;required is:&lt;/P&gt;&lt;P&gt;       jobname  | runtime |   averageruntime |  minruntime | maxruntime | Count&lt;/P&gt;&lt;P&gt;        JOB1      | 28        |        21                |     14              |    28      | 2&lt;/P&gt;&lt;P&gt;       JOB1       | 14        |        21                |     14              |     28     | 2          &lt;/P&gt;&lt;P&gt;       JOB2       | 10        |         7.5              |      5               |     10     | 2          &lt;/P&gt;&lt;P&gt;       JOB2       | 5          |         7.5              |      5               |      10    | 2&lt;/P&gt;&lt;P&gt;       JOB3       | 8          |            8              |      8               |       8     | 1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kindly suggest the code.&lt;/P&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;&lt;P&gt;Bijal&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Jun 2007 10:31:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/logic/m-p/2380264#M528204</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-13T10:31:25Z</dc:date>
    </item>
    <item>
      <title>Re: logic</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/logic/m-p/2380265#M528205</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 get and populate other data from table TBTCO.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks and regards,&lt;/P&gt;&lt;P&gt;S. Chandra Mouli.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Jun 2007 10:45:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/logic/m-p/2380265#M528205</guid>
      <dc:creator>former_member784222</dc:creator>
      <dc:date>2007-06-13T10:45:57Z</dc:date>
    </item>
    <item>
      <title>Re: logic</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/logic/m-p/2380266#M528206</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;try this logic.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;take another itab itab2&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;loop at itab1.&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;clear: i, sumruntime, maxruntime, minruntime.&lt;/P&gt;&lt;P&gt;               &lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;loop at itab2 where jobname =itab1-jobname.&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i = i + 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if i = 1.&lt;/P&gt;&lt;P&gt;     minruntime = itab2-runtime.&lt;/P&gt;&lt;P&gt;     maxruntime = itab2-runtime.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if itab2-runtime GT maxruntime.&lt;/P&gt;&lt;P&gt;    maxruntime = itab2-runtime.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if itab2-runtime LT minruntime.&lt;/P&gt;&lt;P&gt;    minruntime = itab2-runtime.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sumruntime = sumruntime + itab2-runtime.&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;endloop.&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;itab1-minruntime = minruntime.&lt;/P&gt;&lt;P&gt;itab1-maxruntime = maxruntime.&lt;/P&gt;&lt;P&gt;itab1-count = i.&lt;/P&gt;&lt;P&gt;itab1-averageruntime = sumruntime / i.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;modify itab1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;endloop.&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;---patil&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: &lt;/P&gt;&lt;P&gt;        Santhosh Patil&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: &lt;/P&gt;&lt;P&gt;        Santhosh Patil&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Jun 2007 10:48:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/logic/m-p/2380266#M528206</guid>
      <dc:creator>santhosh_patil</dc:creator>
      <dc:date>2007-06-13T10:48:57Z</dc:date>
    </item>
    <item>
      <title>Re: logic</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/logic/m-p/2380267#M528207</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI ..&lt;/P&gt;&lt;P&gt; Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But TBTCO table does not give avg runtime, min , max&lt;/P&gt;&lt;P&gt;i found out runtime by subtracting strttime from endtime.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i have to calculate it&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Jun 2007 10:50:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/logic/m-p/2380267#M528207</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-13T10:50:46Z</dc:date>
    </item>
    <item>
      <title>Re: logic</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/logic/m-p/2380268#M528208</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Bijal,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do you remember the construct called At New ... EndAt.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It works like this -&lt;/P&gt;&lt;P&gt;1. The fields you are using in AT NEW clause show be inorder in table declaration.&lt;/P&gt;&lt;P&gt;2. The table should be sorted as per the field order, either sort table explicitly using SORT statement or modify your SELECT query itself to fetch sorted records.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rest follow this code - &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
DATA: BEGIN OF gt_jobs OCCURS 0,  "Assume appropriate declaration here
        jobname    TYPE char01,
        runtime    TYPE i,
        averageruntime     TYPE i,
        minruntime         TYPE i,
        maxruntime         TYPE i,
        count              TYPE i,
      END OF gt_jobs.
DATA:
  gv_totruntime         TYPE i,
  gs_job                LIKE LINE OF gt_jobs.

* I assume sorted records as per job name here

LOOP AT gt_jobs.
  gs_job-runtime = gt_jobs-runtime.

  AT NEW jobname.
    gs_job-count = 0.
    gv_totruntime = 0.
    gs_job-maxruntime = 0.
    gs_job-minruntime = gs_job-runtime.
  ENDAT.

  IF gs_job-minruntime &amp;gt; gt_jobs-runtime.
    gs_job-minruntime = gt_jobs-runtime.
  ENDIF.
  IF gs_job-maxruntime &amp;lt; gt_jobs-runtime.
    gs_job-maxruntime = gt_jobs-runtime.
  ENDIF.
  ADD 1 TO gs_job-count.
  ADD gt_jobs-runtime TO gv_totruntime.

  AT END OF jobname.
    gs_job-averageruntime = gv_totruntime / gs_job-count.
    MODIFY gt_jobs FROM gs_job
           TRANSPORTING averageruntime
                        minruntime
                        maxruntime
                        count
           WHERE jobname = gt_jobs-jobname.
  ENDAT.
ENDLOOP.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can also view &amp;lt;b&amp;gt;zirt_table_control_events&amp;lt;/b&amp;gt; at .91 / .83 server&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tell me if your problem is solved.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Manish Joshi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Jun 2007 05:45:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/logic/m-p/2380268#M528208</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-14T05:45:30Z</dc:date>
    </item>
  </channel>
</rss>

