cancel
Showing results for 
Search instead for 
Did you mean: 

SLA reference Date based on Start date

0 Kudos

Hi All,

We have come across a requirement where Client is requesting for an SLA creation based on the start date of Service Request.

Is it achievable through Configuration.

Scenario :

Service Request created on 10/10/2014 at 9:00 AM

Service Level Agreement based on client calendar :

Calendar : 8:00 AM to 7 : 00 PM , 5 days weekly

SLA to be based on priority:

First Response Date/Time : 2 Hours after service request created

To be Completed Date/Time : 8 Hours after service request created

Date Profile created :

Date Type : SR Created

Date rule : Todays Date and Time

Date type : First Response

Date Rule : First Response - Based on SR Created add Duration

(XML rule is as follows

     <VarTimeExp name="RESULT" position='F'/>

     <MoveTimeExp direction="+">

       <VarTimeExp name="SR created" position='F'/>

       <VarDuraExp name="SRV_RF_DURA" />

     </MoveTimeExp>

  )

But here every time the First response created it calculates based on Todays Date and Time. It does not calculate First response based on SR Created.

Kindly provide which date rule to be used to get the SR created date and time. Because everytime the Priority is changed, again the Service request gets the new First response based on SR Created Date rule which is Todays Date and time.

Many Thanks

Regards,

Shakeel

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Shakeel,

I would recommend to add one more date type which should store the today's date and time and should have a check box date date only once on.

Use this date type in Date rules for further calculation.This should be easy.

Other option with code is Date rule itself we can include FM which should have logic to check the creation date and time of service request if it exixts else consider the today's date and time for calculation.

Thanks

Ajay

0 Kudos

Hi Ajay,

I have checked the Configuration of using a different date type with determine once option, but it did not work.

Can you kindly provide any sample logic of the FM and how to call the FM in Date rule , as it is an XML logic.

Many Thanks,

Help will be appreciated.

Regards,

Shakeel

dharmakasi
Active Contributor
0 Kudos

Hi Shakeel,

You can refer to below sample to call a function module in data rule.

<?xml version="7"?>

<SAPTimeRule>

<ABAPTimeRule function="Function module name" />

</SAPTimeRule>.

Best Regards,

Dharmakasi.

0 Kudos

Thanks Dharmakasi

0 Kudos

Hi Dharmakasi,

For our requirement, we need to fetch the start date of the service request. We have fetched the date from the Functional module.

Now our requirement is to add the duration based on Service profile- SLA.

We have used the XML logic provided by you.

Can you kindly provide any inputs on either to incorporate the addition of duration in FM or in XML logic.

Regards,

Shakeel

dharmakasi
Active Contributor
0 Kudos

Hi Shakeel,

Please use the below sample code to increase date, you have to build similar to the below code in FM.

FUNCTION

*"----------------------------------------------------------------------

*"*"Local Interface:

*"  IMPORTING

*"     REFERENCE(CONTEXT) TYPE REF TO  IF_TIMECONTEXT

*"     REFERENCE(TIMEMESSAGE) TYPE REF TO  CL_TIMEMESSAGE

*"  EXPORTING

*"     REFERENCE(ERROR) TYPE  XFLAG

*"----------------------------------------------------------------------

*"*"Local Interface:

*"  IMPORTING

*"     REFERENCE(CONTEXT) TYPE REF TO IF_TIMECONTEXT

*"     REFERENCE(TIMEMESSAGE) TYPE REF TO CL_TIMEMESSAGE

*"  EXPORTING

*"     REFERENCE(ERROR) TYPE  XFLAG

*"--------------------------------------------------------------------

*Created by LOMO for Defect  to send reminder mail before 3 months contract ends

  CLASS  cl_timecalc DEFINITION LOAD.

  CLASS  cl_timeunit_broker DEFINITION LOAD.

  INCLUDE timecalc_const.

  DATA:

         lv_object_guid TYPE crmt_object_guid,

         lv_header_guid TYPE crmt_object_guid,

         ls_orderadm_i TYPE crmt_orderadm_i_wrk,

         lv_name TYPE timename,

         li_cont_end TYPE REF TO cl_timeevent,

         li_result TYPE REF TO cl_timeevent,

         li_result_from TYPE REF TO cl_timetime,

         li_result_to TYPE REF TO  cl_timetime,

         lv_timestamp_from TYPE timestamp,

         lv_timestamp_to TYPE timestamp,

         lr_timeobject_from     TYPE REF TO if_timeobject,

         lr_timeobject_to       TYPE REF TO if_timeobject,

         li_duraset TYPE REF TO cl_timeset_generic,

         li_timeunit TYPE REF TO cl_timeunit,

         li_dura_1day TYPE REF TO cl_timedura,

         lv_process_type TYPE crmt_process_type,

         li_dura TYPE REF TO cl_timedura,

         lv_duration_u TYPE timeunitna,

         lv_duration TYPE timedura,

         lv_object_kind TYPE crmt_object_kind,

         li_eventset TYPE REF TO cl_timeset_generic.

  CONSTANTS:

          gc_cont_end TYPE timename VALUE 'CONTEND'.

  TRY.

      li_eventset  = context->get_eventset( ).

      CALL FUNCTION 'CRM_CONTEXT_GET_ACTUALGUID_OW'

        IMPORTING

          ev_ref_guid = lv_object_guid

          ev_ref_kind = lv_object_kind.

      IF lv_object_kind = 'A'.

        CALL FUNCTION 'CRM_ORDERADM_H_READ_OW'

          EXPORTING

            iv_orderadm_h_guid     = lv_object_guid

          IMPORTING

            ev_process_type        = lv_process_type

          EXCEPTIONS

            admin_header_not_found = 1

            OTHERS                 = 2.

      ELSEIF lv_object_kind = 'B'. "For Items

        CALL FUNCTION 'CRM_ORDERADM_I_READ_OW'

          EXPORTING

            iv_guid           = lv_object_guid

          IMPORTING

            ev_header_guid    = lv_header_guid

            es_orderadm_i_wrk = ls_orderadm_i

          EXCEPTIONS

            item_not_found    = 1

            OTHERS            = 2.

        CALL FUNCTION 'CRM_ORDERADM_H_READ_OW'

          EXPORTING

            iv_orderadm_h_guid     = lv_header_guid

          IMPORTING

            ev_process_type        = lv_process_type

          EXCEPTIONS

            admin_header_not_found = 1

            OTHERS                 = 2.

      ENDIF.

      CASE  lv_process_type .

        WHEN 'ZSCF'.

          lv_name = gc_cont_end.

          li_cont_end ?= li_eventset->get_by_name( lv_name ).

          IF li_cont_end IS INITIAL.

            error = 'X'.

            RETURN.

          ENDIF.

          IF li_cont_end->m_time_from->m_timestamp IS NOT  INITIAL.

            lv_timestamp_from = li_cont_end->m_time_from->m_timestamp.

            CALL METHOD cl_timetime=>create

              EXPORTING

                timeobject = li_cont_end->m_time_from->m_timeobject

                timestamp  = lv_timestamp_from

              IMPORTING

                time       = li_result_from

              EXCEPTIONS

                OTHERS     = 1.

          ENDIF.

         CHECK li_result_from is NOT INITIAL.

*Create Needed Duration OBjects for Constandt 3 months

          lv_duration_u = gc_timeunit_month.

          lv_duration   = 3.

          li_timeunit   = cl_timeunit_broker=>get_unit( lv_duration_u ).

          CREATE OBJECT li_dura

            EXPORTING

              name       = 'DURA'

              dura       = lv_duration

              timeunit   = li_timeunit

              timeobject = li_result_from->m_timeobject.

          CALL METHOD li_dura->set_dura

            EXPORTING

              dura     = lv_duration

              timeunit = li_timeunit.

          CALL METHOD cl_timecalc=>move

            EXPORTING

              time      = li_result_from

              dura      = li_dura

              direction = '-'

            RECEIVING

              result    = li_result_from.

          li_result     ?= li_eventset->get_by_name( 'RESULT' ).

          IF li_result IS NOT INITIAL.

            CALL METHOD li_eventset->remove_by_name

              EXPORTING

                name           = 'RESULT'

              EXCEPTIONS

                item_not_found = 1

                OTHERS         = 2.

          ENDIF.

          CLEAR li_result.

          li_result_to ?= li_result_from->clone( ).

          CREATE OBJECT li_result

            EXPORTING

              name      = 'RESULT'

              time_to   = li_result_to

              time_from = li_result_from.

          CALL METHOD li_eventset->insert

            EXPORTING

              item        = li_result

            EXCEPTIONS

              fatal_error = 1

              OTHERS      = 2.

      ENDCASE.

    CATCH cx_root.

  ENDTRY.

ENDFUNCTION.

Best Regards,

Dharmakasi.

0 Kudos

Thank You  Dharmakasi, It was very useful.

Answers (0)