<?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 Function module for calculating diff between time in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-for-calculating-diff-between-time/m-p/1822293#M351256</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt; Is there any FM to check for the below requirement,&lt;/P&gt;&lt;P&gt;   &lt;/P&gt;&lt;P&gt; Here request is the time, I have to &lt;/P&gt;&lt;P&gt;     1.cmp the time between two intervals and &lt;/P&gt;&lt;P&gt;     2.the day(Whether Holiday).&lt;/P&gt;&lt;P&gt;     If a request is made Local time (0TIME) between 10PM to 6AM&lt;/P&gt;&lt;P&gt;     If a request is made on a Holiday.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Pts will be awarded.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;vinoth.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 11 Jan 2007 06:49:33 GMT</pubDate>
    <dc:creator>vinothkumar_g</dc:creator>
    <dc:date>2007-01-11T06:49:33Z</dc:date>
    <item>
      <title>Function module for calculating diff between time</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-for-calculating-diff-between-time/m-p/1822293#M351256</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt; Is there any FM to check for the below requirement,&lt;/P&gt;&lt;P&gt;   &lt;/P&gt;&lt;P&gt; Here request is the time, I have to &lt;/P&gt;&lt;P&gt;     1.cmp the time between two intervals and &lt;/P&gt;&lt;P&gt;     2.the day(Whether Holiday).&lt;/P&gt;&lt;P&gt;     If a request is made Local time (0TIME) between 10PM to 6AM&lt;/P&gt;&lt;P&gt;     If a request is made on a Holiday.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Pts will be awarded.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;vinoth.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Jan 2007 06:49:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-for-calculating-diff-between-time/m-p/1822293#M351256</guid>
      <dc:creator>vinothkumar_g</dc:creator>
      <dc:date>2007-01-11T06:49:33Z</dc:date>
    </item>
    <item>
      <title>Re: Function module for calculating diff between time</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-for-calculating-diff-between-time/m-p/1822294#M351257</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;check &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SRET_TIME_DIFF_GET&lt;/P&gt;&lt;P&gt;SD_DATETIME_DIFFERENCE&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="---" /&gt;&lt;P&gt;santhosh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Jan 2007 06:52:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-for-calculating-diff-between-time/m-p/1822294#M351257</guid>
      <dc:creator>santhosh_patil</dc:creator>
      <dc:date>2007-01-11T06:52:16Z</dc:date>
    </item>
    <item>
      <title>Re: Function module for calculating diff between time</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-for-calculating-diff-between-time/m-p/1822295#M351258</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;CCU_TIMESTAMP_DIFFERENCE&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Have a look at below link.&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_message" href="https://community.sap.com/" __jive_macro_name="message" modifiedtitle="true" __default_attr="2732670"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope it helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Vibha &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Please mark all the helpful answers&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Jan 2007 06:52:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-for-calculating-diff-between-time/m-p/1822295#M351258</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-01-11T06:52:25Z</dc:date>
    </item>
    <item>
      <title>Re: Function module for calculating diff between time</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-for-calculating-diff-between-time/m-p/1822296#M351259</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi,,&lt;/P&gt;&lt;P&gt;check the below link may be useful for you&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_message" href="https://community.sap.com/" __jive_macro_name="message" modifiedtitle="true" __default_attr="1185482"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;~~Guduri&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Jan 2007 06:54:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-for-calculating-diff-between-time/m-p/1822296#M351259</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-01-11T06:54:30Z</dc:date>
    </item>
    <item>
      <title>Re: Function module for calculating diff between time</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-for-calculating-diff-between-time/m-p/1822297#M351260</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;&lt;/P&gt;&lt;P&gt;check the fm below for your requirments.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;1. SCOV_TIME_DIFF_46B&lt;/P&gt;&lt;P&gt;2. DATE_CHECK_PLAUSIBILITY&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Jan 2007 06:55:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-for-calculating-diff-between-time/m-p/1822297#M351260</guid>
      <dc:creator>dani_mn</dc:creator>
      <dc:date>2007-01-11T06:55:34Z</dc:date>
    </item>
    <item>
      <title>Re: Function module for calculating diff between time</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-for-calculating-diff-between-time/m-p/1822298#M351261</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;try this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DELTA_TIME_DAY_HOUR&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SD_DATETIME_DIFFERENCE&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;shiba dutta&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Jan 2007 06:55:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-for-calculating-diff-between-time/m-p/1822298#M351261</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-01-11T06:55:51Z</dc:date>
    </item>
    <item>
      <title>Re: Function module for calculating diff between time</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-for-calculating-diff-between-time/m-p/1822299#M351262</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;       these are some function modules that u could make use of.&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;&lt;/P&gt;&lt;P&gt;     L_MC_TIME_DIFFERENCE&lt;/P&gt;&lt;P&gt;     HR_PDC_CALCULATE_TIME_DIFF&lt;/P&gt;&lt;P&gt;     SRET_TIME_DIFF_GET&lt;/P&gt;&lt;P&gt;     SD_DATETIME_DIFFERENCE&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      &lt;/P&gt;&lt;P&gt;     if the answer solves ur problem do reward points.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Kiran&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Jan 2007 06:59:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-for-calculating-diff-between-time/m-p/1822299#M351262</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-01-11T06:59:42Z</dc:date>
    </item>
    <item>
      <title>Re: Function module for calculating diff between time</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-for-calculating-diff-between-time/m-p/1822300#M351263</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;try &lt;/P&gt;&lt;P&gt;CCU_TIMESTAMP_DIFFERENCE&lt;/P&gt;&lt;P&gt;FITP_GET_TIME_DIFFERENCE&lt;/P&gt;&lt;P&gt;SCOV_TIME_DIFF&lt;/P&gt;&lt;P&gt;SRET_TIME_DIFF_GET&lt;/P&gt;&lt;P&gt;TIMECALC_DIFF&lt;/P&gt;&lt;P&gt;SD_DATETIME_DIFFERENCE&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Jan 2007 06:59:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-for-calculating-diff-between-time/m-p/1822300#M351263</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-01-11T06:59:43Z</dc:date>
    </item>
    <item>
      <title>Re: Function module for calculating diff between time</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-for-calculating-diff-between-time/m-p/1822301#M351264</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;for first case use&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SD_DATETIME_DIFFERENCE&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for second one use&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BKK_CHECK_HOLIDAY&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Shiva&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Jan 2007 07:02:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-for-calculating-diff-between-time/m-p/1822301#M351264</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-01-11T07:02:35Z</dc:date>
    </item>
    <item>
      <title>Re: Function module for calculating diff between time</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-for-calculating-diff-between-time/m-p/1822302#M351265</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi vinoth ..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;See u r looking for the time interval to be &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;checked between the interval 220000 hrs (10 pm &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;) to 060000hrs ( 6 am ) of next day ..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then why are you calculating the difference? is &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;it for a shift timing check ..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;to get the diff " but im sure u may not require this ..&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;data:DATE_FROM LIKE  LTAK-BDATU,
       DATE_TO   LIKE  LTAK-BDATU,
       TIME_FROM LIKE  LTAK-BZEIT,
       TIME_TO LIKE  LTAK-BZEIT,
       DELTA_TIME LIKE  MCWMIT-BE_AE,
       DELTA_UNIT LIKE  MCWMIT-LZEIT.


       DATE_FROM = SY-DATUM.
       DATE_TO   = DATE_FROM + 1.
       TIME_FROM = '220000'.   
       TIME_TO   = '060000'.

       CALL FUNCTION 'L_MC_TIME_DIFFERENCE'
         EXPORTING
           date_from             = DATE_FROM
           date_to               = DATE_TO
          TIME_FROM             =  TIME_FROM
          TIME_TO               =  TIME_TO
        IMPORTING
          DELTA_TIME            = DELTA_TIME
          DELTA_UNIT            = DELTA_UNIT
        EXCEPTIONS
          FROM_GREATER_TO       = 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.

WRITE:/ DELTA_TIME , DELTA_UNIT.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. to check  //If a request is made Local time (0TIME) between 10PM to 6AM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you can use this logic..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA : VAL LIKE SY-UZEIT.

VAL = SY-UZEIT. " if u have this

IF VAL BETWEEN TIME_FROM AND '240000' OR 
VAL  BETWEEN '000000' AND TIME_TO.
WRITE:/ 'IN THE INTERVAL'.
ELSE .
WRITE:/ 'NOT IN THE INTERVAL'.
ENDIF.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. to check for a holiday ..use this&lt;/P&gt;&lt;P&gt;*CHECK HOLIDAY&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;data: ld_date                 like scal-date  ,
      lc_holiday_cal_id       like scal-hcalid ,
      ltab_holiday_attributes like thol occurs 0 with header line,
      lc_holiday_found        like scal-indicator.

ld_date = sy-datum.
lc_holiday_cal_id  = 'US'.

CALL FUNCTION 'HOLIDAY_CHECK_AND_GET_INFO'
  EXPORTING
    date                               = ld_date
    holiday_calendar_id                = lc_holiday_cal_id
    WITH_HOLIDAY_ATTRIBUTES            = 'X'
  IMPORTING
    HOLIDAY_FOUND                      = lc_holiday_found
  tables
    holiday_attributes                 = ltab_holiday_attributes
  EXCEPTIONS
    CALENDAR_BUFFER_NOT_LOADABLE       = 1
    DATE_AFTER_RANGE                   = 2
    DATE_BEFORE_RANGE                  = 3
    DATE_INVALID                       = 4
    HOLIDAY_CALENDAR_ID_MISSING        = 5
    HOLIDAY_CALENDAR_NOT_FOUND         = 6
    OTHERS                             = 7.

if sy-subrc = 0 and
   lc_holiday_found = 'X'.
  write: / ld_date, 'is a holiday'.
else.
  write: / ld_date, 'is not a holiday.
endif.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you can calculate the diff if u want to but in my opinion you are looking for the time interval to fall in hte range for this u need to manipulate the logic cause 10pm to 6am is the date cuts twice and u need to take care of that .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;execute logic 1 and 2 and see how this can be done to check whether the time was in that interval .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;to check the holiday &lt;/P&gt;&lt;P&gt; holiday_calendar_id                = lc_holiday_cal_id&lt;/P&gt;&lt;P&gt;make sure that u have this entry for the plant in t006w for calender id or &lt;/P&gt;&lt;P&gt;tfacd table . an entry for the plant and the country has to be there before trying to find holiday.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;vijay&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Jan 2007 07:46:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-for-calculating-diff-between-time/m-p/1822302#M351265</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-01-11T07:46:14Z</dc:date>
    </item>
  </channel>
</rss>

