<?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: Function Module for the differences in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-for-the-differences/m-p/1607846#M272803</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;use fm.&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;'SD_DATETIME_DIFFERENCE'&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;or&lt;/P&gt;&lt;P&gt;SD_CALC_DURATION_FROM_DATETIME&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ex-&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
data : date1 type sy-datum,  
     date2 type sy-datum,    
   time1 type sy-uzeit,   
    time2 type sy-uzeit,   
    v_datediff type p,      
 v_timediff type p.      
 date1 = '20060101'.   
    date2 = sy-datum.    


   time1 = '010101'.     
  time2 = sy-uzeit.
CALL FUNCTION 'SD_DATETIME_DIFFERENCE'  
EXPORTING    
DATE1                  = DATE1   
TIME1                  = TIME1  
DATE2                  = DATE2   
TIME2                  = TIME2
IMPORTING  
DATEDIFF               = v_DATEDIFF   TIMEDIFF               = v_TIMEDIFF
*EARLIEST              = EARLIEST 
EXCEPTIONS  
 INVALID_DATETIME      = 1  
 OTHERS                = 2          .
IF SY-SUBRC &amp;lt;&amp;gt; 0. 
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.ENDIF.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 27 Sep 2006 07:47:42 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-09-27T07:47:42Z</dc:date>
    <item>
      <title>Function Module for the differences</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-for-the-differences/m-p/1607841#M272798</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;Can you pl let me know the function module to find the difference between two times. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;Input&amp;lt;/b&amp;gt;  time1(hours:minits:seconds)  time2 (hours:minits:seconds)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Need &amp;lt;b&amp;gt;output&amp;lt;/b&amp;gt; in hours:minits:seconds&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Badari&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Sep 2006 07:36:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-for-the-differences/m-p/1607841#M272798</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-09-27T07:36:54Z</dc:date>
    </item>
    <item>
      <title>Re: Function Module for the differences</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-for-the-differences/m-p/1607842#M272799</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;use this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HR_PDC_CALCULATE_TIME_DIFF&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;rgds&lt;/P&gt;&lt;P&gt;anver&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Sep 2006 07:39:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-for-the-differences/m-p/1607842#M272799</guid>
      <dc:creator>anversha_s</dc:creator>
      <dc:date>2006-09-27T07:39:55Z</dc:date>
    </item>
    <item>
      <title>Re: Function Module for the differences</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-for-the-differences/m-p/1607843#M272800</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;u can use this also.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Z_PM_CALC_TIME_DIFFERENCE&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;rgds&lt;/P&gt;&lt;P&gt;anver&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Sep 2006 07:42:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-for-the-differences/m-p/1607843#M272800</guid>
      <dc:creator>anversha_s</dc:creator>
      <dc:date>2006-09-27T07:42:43Z</dc:date>
    </item>
    <item>
      <title>Re: Function Module for the differences</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-for-the-differences/m-p/1607844#M272801</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;CALL FUNCTION &amp;lt;b&amp;gt;'SD_DATETIME_DIFFERENCE'&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; EXPORTING&lt;/P&gt;&lt;P&gt;       DATE1            = D1&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;       TIME1            = T1&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;        DATE2            = D2&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;        TIME2            = T2&amp;lt;/b&amp;gt;   &lt;/P&gt;&lt;P&gt; IMPORTING&lt;/P&gt;&lt;P&gt;        DATEDIFF         = D3&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;        TIMEDIFF         = T3&amp;lt;/b&amp;gt; &lt;/P&gt;&lt;P&gt; EXCEPTIONS&lt;/P&gt;&lt;P&gt;        INVALID_DATETIME = 1&lt;/P&gt;&lt;P&gt;        OTHERS           = 2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Sudheer&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Sep 2006 07:44:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-for-the-differences/m-p/1607844#M272801</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-09-27T07:44:01Z</dc:date>
    </item>
    <item>
      <title>Re: Function Module for the differences</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-for-the-differences/m-p/1607845#M272802</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi badari,&lt;/P&gt;&lt;P&gt;try this also.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: t1 type tims,&lt;/P&gt;&lt;P&gt;t2 type tims,&lt;/P&gt;&lt;P&gt;t3 type tims,&lt;/P&gt;&lt;P&gt;time_second type i.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;t1 = '193030'.&lt;/P&gt;&lt;P&gt;t2 = '093000'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;t3 = t1 - t2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;time_second = ( 60 * t3+0(2) ) + ( 60 * t3+2(2) ) + t3+4(2).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;write &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt; 't1:-', t1 ,' t2:-', t2 , ' t3:-', t3.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;write &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt; 'time_second ' , time_second .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;rgds&lt;/P&gt;&lt;P&gt;anver&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Sep 2006 07:45:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-for-the-differences/m-p/1607845#M272802</guid>
      <dc:creator>anversha_s</dc:creator>
      <dc:date>2006-09-27T07:45:40Z</dc:date>
    </item>
    <item>
      <title>Re: Function Module for the differences</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-for-the-differences/m-p/1607846#M272803</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;use fm.&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;'SD_DATETIME_DIFFERENCE'&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;or&lt;/P&gt;&lt;P&gt;SD_CALC_DURATION_FROM_DATETIME&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ex-&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
data : date1 type sy-datum,  
     date2 type sy-datum,    
   time1 type sy-uzeit,   
    time2 type sy-uzeit,   
    v_datediff type p,      
 v_timediff type p.      
 date1 = '20060101'.   
    date2 = sy-datum.    


   time1 = '010101'.     
  time2 = sy-uzeit.
CALL FUNCTION 'SD_DATETIME_DIFFERENCE'  
EXPORTING    
DATE1                  = DATE1   
TIME1                  = TIME1  
DATE2                  = DATE2   
TIME2                  = TIME2
IMPORTING  
DATEDIFF               = v_DATEDIFF   TIMEDIFF               = v_TIMEDIFF
*EARLIEST              = EARLIEST 
EXCEPTIONS  
 INVALID_DATETIME      = 1  
 OTHERS                = 2          .
IF SY-SUBRC &amp;lt;&amp;gt; 0. 
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.ENDIF.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Sep 2006 07:47:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-for-the-differences/m-p/1607846#M272803</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-09-27T07:47:42Z</dc:date>
    </item>
    <item>
      <title>Re: Function Module for the differences</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-for-the-differences/m-p/1607847#M272804</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi again,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Difference is always returned in SECONDS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. use this code (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;data : t1 type sy-uzeit.&lt;/P&gt;&lt;P&gt;data : t2 type sy-uzeit.&lt;/P&gt;&lt;P&gt;DATA : DIFF TYPE I.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;t1 = '090000'.&lt;/P&gt;&lt;P&gt;t2 = '100000'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DIFF = T2 - T1.&lt;/P&gt;&lt;P&gt;WRITE &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt; DIFF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;u can manipulate the DIFF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;rgds&lt;/P&gt;&lt;P&gt;anver&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Sep 2006 07:49:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-for-the-differences/m-p/1607847#M272804</guid>
      <dc:creator>anversha_s</dc:creator>
      <dc:date>2006-09-27T07:49:16Z</dc:date>
    </item>
    <item>
      <title>Re: Function Module for the differences</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-for-the-differences/m-p/1607848#M272805</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Badari,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can use the FM &amp;lt;b&amp;gt;L_MC_TIME_DIFFERENCE&amp;lt;/b&amp;gt;.&lt;/P&gt;&lt;P&gt;Since this FM requires a FROM_DATE and TO_DATE you can pass SY-DATUM for both.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Saurabh&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: Saurabh Punshi&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Sep 2006 07:56:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-for-the-differences/m-p/1607848#M272805</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-09-27T07:56:16Z</dc:date>
    </item>
  </channel>
</rss>

