<?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: Logging processing time in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/logging-processing-time/m-p/2926922#M689554</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;data: a type sy-uzeit,
b type sy-datum,
c type sy-uzeit,
endtime type sy-uzeit,
enddate type sy-datum.

a = sy-uzeit.
b = sy-datum.
c = sy-uzeit.

CALL FUNCTION 'C14B_ADD_TIME'
EXPORTING
i_starttime = a
i_startdate = b
i_addtime = c
IMPORTING
E_ENDTIME = endtime
E_ENDDATE = enddate
.

write : endtime, enddate, a , c.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_thread" href="https://community.sap.com/" __jive_macro_name="thread" modifiedtitle="true" __default_attr="135952"&gt;&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 17 Oct 2007 08:26:38 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-10-17T08:26:38Z</dc:date>
    <item>
      <title>Logging processing time</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/logging-processing-time/m-p/2926921#M689553</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;I have an interface, which is reading XML files, selecting data from sap tables and send a result in XML back.&lt;/P&gt;&lt;P&gt;I now wanted to log the incoming requests and also the processing time, used by SAP.&lt;/P&gt;&lt;P&gt;Therefore I have made a table, which is saving the request typ, time, date, and a field called processing time.&lt;/P&gt;&lt;P&gt;When the function is going to be called, I´m filling the fields date and time directly with sy-date and sy-uzeit.&lt;/P&gt;&lt;P&gt;After processing, I´m subtracting the old sy-uzeit from the new sy-uzeit and save that into the processing time field.&lt;/P&gt;&lt;P&gt;that works sometimes, but sometimes not.... I thought, I´m getting the difference in seconds later on in the field processing time. What am I doing wrong? Or how to record the processing time better?&lt;/P&gt;&lt;P&gt;The field processing time is an int4 field.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for you help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward points guaranteed!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Oct 2007 08:19:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/logging-processing-time/m-p/2926921#M689553</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-10-17T08:19:39Z</dc:date>
    </item>
    <item>
      <title>Re: Logging processing time</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/logging-processing-time/m-p/2926922#M689554</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;data: a type sy-uzeit,
b type sy-datum,
c type sy-uzeit,
endtime type sy-uzeit,
enddate type sy-datum.

a = sy-uzeit.
b = sy-datum.
c = sy-uzeit.

CALL FUNCTION 'C14B_ADD_TIME'
EXPORTING
i_starttime = a
i_startdate = b
i_addtime = c
IMPORTING
E_ENDTIME = endtime
E_ENDDATE = enddate
.

write : endtime, enddate, a , c.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_thread" href="https://community.sap.com/" __jive_macro_name="thread" modifiedtitle="true" __default_attr="135952"&gt;&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Oct 2007 08:26:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/logging-processing-time/m-p/2926922#M689554</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-10-17T08:26:38Z</dc:date>
    </item>
    <item>
      <title>Re: Logging processing time</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/logging-processing-time/m-p/2926923#M689555</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, thank you for the answer. But I just need the processing time in seconds...&lt;/P&gt;&lt;P&gt;How to do that?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Oct 2007 08:34:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/logging-processing-time/m-p/2926923#M689555</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-10-17T08:34:58Z</dc:date>
    </item>
    <item>
      <title>Re: Logging processing time</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/logging-processing-time/m-p/2926924#M689556</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Arne,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you simply want to subtract the time, then&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;" l_time1 has old sy-uzeit value&lt;/P&gt;&lt;P&gt;l_time2 = sy-uzeit.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;l_time = l_time2 - l_time1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Above code should work fine everytime.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If the time zone of TIME1 and TIME2 are different, then you need to use sy-timlo instead of sy-uzeit.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Prashant&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Oct 2007 08:39:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/logging-processing-time/m-p/2926924#M689556</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-10-17T08:39:08Z</dc:date>
    </item>
    <item>
      <title>Re: Logging processing time</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/logging-processing-time/m-p/2926925#M689557</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok, and thats the way I have done it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;At first, I have written the time into a field and after all processing, I have subtracted that from the actual time into an integer field.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
Data: timeFirst LIKE sy-uzeit,
         proc_time TYPE i.

timeFirst = sy-uzeit.

.... processing ....

proc_time = sy-uzeit - timeFirst.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But that seems not to work in all cases and I don´t know why! Because, sometimes I don´t have any value in the proc_time field, but the XML had been processed and has needed many seconds....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Oct 2007 08:43:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/logging-processing-time/m-p/2926925#M689557</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-10-17T08:43:31Z</dc:date>
    </item>
    <item>
      <title>Re: Logging processing time</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/logging-processing-time/m-p/2926926#M689558</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;Two things are possible:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. processing time is very less.. fraction of second..&lt;/P&gt;&lt;P&gt;FIRST TIME = SY-UZEIT. "101010&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;Process Time = sy-uzeit - first time. " Here value could be zero.. bcz of fast processing&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. The code is not executed ...&lt;/P&gt;&lt;P&gt;May be that the code is not executed.. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could you please put a breakpoint &amp;amp; debug. That should help to identify the bug.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Prashant&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Oct 2007 08:47:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/logging-processing-time/m-p/2926926#M689558</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-10-17T08:47:04Z</dc:date>
    </item>
    <item>
      <title>Re: Logging processing time</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/logging-processing-time/m-p/2926927#M689559</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, sometimes, it is very less....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The function is going to be called over RFC from an external application. EVERYTIME, when I run the function manually, it records the right time. But often, when I run it from the external program, it is not working. But it is always writing the logging line to the database table...&lt;/P&gt;&lt;P&gt;Strange thing! At first, the field for processing time was of type NUMC, but now I have changed it to integer. Could that be a problem?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Oct 2007 08:50:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/logging-processing-time/m-p/2926927#M689559</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-10-17T08:50:22Z</dc:date>
    </item>
    <item>
      <title>Re: Logging processing time</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/logging-processing-time/m-p/2926928#M689560</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;I hope the RFC is hit everytime correctly &amp;amp; the code of processing time calculation is not inside any IF condition which would fail occasionaly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please change the data type of TIme fields to SYUZEIT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;Data : l_time1 type syuzeit,
          l_time2 type syuzeit.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Prashant&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Oct 2007 08:53:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/logging-processing-time/m-p/2926928#M689560</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-10-17T08:53:28Z</dc:date>
    </item>
    <item>
      <title>Re: Logging processing time</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/logging-processing-time/m-p/2926929#M689561</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here is the part of my code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
* Read incoming XML request
  PERFORM read_xml_request  USING  i_streamin.

  gs_request_data-req_date = sy-datum.
  gs_request_data-req_time = sy-uzeit.
  gs_request_data-req_type = g_request_type.

.........
.....
...

* Add request information to the log table
  PERFORM log_request.

FORM log_request.

* Update log with processing time
  gs_request_data-proc_time = sy-uzeit - gs_request_data-req_time.

  CALL METHOD g_log_instance-&amp;gt;write_request_to_log
    EXPORTING
      it_request_detail = lt_request_detail
    IMPORTING
      e_return_code  =  l_return_code
    CHANGING
      is_request_info =  gs_request_data.

ENDFORM
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For the time, I have made an own data element, but with the same domain like syuzeit: sytime&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;so that should definately not be the problem...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Oct 2007 09:04:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/logging-processing-time/m-p/2926929#M689561</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-10-17T09:04:47Z</dc:date>
    </item>
    <item>
      <title>Re: Logging processing time</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/logging-processing-time/m-p/2926930#M689562</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I hope gs_request_data-proc_time also has syuzeit as data type.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Oct 2007 09:08:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/logging-processing-time/m-p/2926930#M689562</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-10-17T09:08:46Z</dc:date>
    </item>
    <item>
      <title>Re: Logging processing time</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/logging-processing-time/m-p/2926931#M689563</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;No! Because I would like to have the proecssing seconds....&lt;/P&gt;&lt;P&gt;It is of type integer. What I want to have in this field, are the seconds used by the function.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Oct 2007 09:15:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/logging-processing-time/m-p/2926931#M689563</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-10-17T09:15:18Z</dc:date>
    </item>
    <item>
      <title>Re: Logging processing time</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/logging-processing-time/m-p/2926932#M689564</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Arne,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Integer type should be fine. &lt;/P&gt;&lt;P&gt;The inconsistency in calculation is bcz the time taken for the processing is very less &amp;amp; hence the start &amp;amp; end time dont have any difference.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have create a sample program &amp;amp; tested out.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;REPORT  ztest11111111111.


DATA : l_time1 TYPE syuzeit,
       l_time2 TYPE syuzeit,
       l_ans   TYPE syuzeit,
       l_int   TYPE i.


l_time1 = sy-uzeit.

WAIT UP TO 2 SECONDS. " 1st execute with this as Uncommented
*do 10 times. " for 1st time this should be commented
*write :/ ' '.  " When WAIT UP TO is commented .. Uncomment DO..ENDDO
*enddo

l_time2 = sy-uzeit.


l_ans = l_time2 - l_time1.
l_int = l_time2 - l_time1.

WRITE :/ 'ANS with SYUZEIT datatype' , l_ans.
WRITE :/ 'ANS with INT datatype' , l_int.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Oct 2007 09:22:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/logging-processing-time/m-p/2926932#M689564</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-10-17T09:22:20Z</dc:date>
    </item>
    <item>
      <title>Re: Logging processing time</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/logging-processing-time/m-p/2926933#M689565</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you for the help!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So it should be ok... Maybe it is now working, after I have set it from NUMC5 to integer. Hope so! &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Oct 2007 09:31:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/logging-processing-time/m-p/2926933#M689565</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-10-17T09:31:44Z</dc:date>
    </item>
  </channel>
</rss>

