cancel
Showing results for 
Search instead for 
Did you mean: 

Date rule to exclude weekend

Former Member
0 Kudos

Hi,

I have configure date rule ZSRV00021 (start + 10 days) and attached it to date profile SLFN001 in service desk.

This date rule will be trigger if user want to change the end of requirement that is estimate up to 10 days.

When i used the date rule when doing the assigment, the date was calculated ten days including weekend. That was not what user want.

What user want is that the calculation should exclude weekend.

Is there any way to do that.

Kindly assist.

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

Hi Biah,

Once you get in to the coding screen,not to change the code.In the status bar you find the Test rule button click the button one window will pop up it will ask for the date profile.Specify your date profile over there & press ok,another window pop up will open that is reference object,where it shows automatically data type,shows time from to also then press ok,then it will open other pop up shows the time zone & factory calender,specify the time zone & factory calender here.

Here in this if you drill down time zone it will possible entry,select it,but when drill down it wont show any entries,type your factory calender id here.Press ok,the system will show the information mentioning the time zone & calender.

Try this.

Regards,

Raj

Former Member
0 Kudos

Hi Raj,

I've using the test rule for my date rule.

I've got the information on reference as follow.

Reference Objects

SYSTEM UTC+8 CL_TIMECALENDAR_GENERIC CALENDAR MY MY

But i don't know how to use this information in order for me to calculate the days.

Appreciate if you could guide me?

regards,

Biah

Former Member
0 Kudos

HI,

I am facing the same problem. how did u achieve this?

Please help.

Regards,

Ankush

Former Member
0 Kudos

If anyone is still monitoring this thread, I share what I have done.

I am using service requests and the requirement was that I calculate due date based on the SLA and also to take the service profile into account. In summary, service profile holds my factory calendar and working hours, so if I have a request created 3pm on Friday with 8 hour SLA, due date should be 2pm on Monday assuming 8 working hours and that weekends are off.

If you don't want to use service profile you can still create your own reference object that uses a specific factory calendar. This is described in note 675647.

So in my case, I have a date type which is when the request was created and a duration type which is the SLA. Also I have another date type which is the due date. When these date types and SLAs are assigned to the date profile, set the reference object to your customer reference object, or in my case to SERWI which is the service profile. So again this on the assignment of date type and duration to the profile.

Finally I have created a simple date rule which takes the creation date adds the SLA duration. I also added SERWI reference object to the date rule as per the following:

<?xml version="1.0"?>

<TimeRule>

<TimeRuleSource>

<ruleline>

<AssignTimeExp>

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

<MoveTimeExp direction="+">

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

<VarDuraExp name="ZFI_TOTAL_FC"/>

<VarObjectExp displaytype="VarObject"

name="SERWI"/>

</MoveTimeExp>

</AssignTimeExp>

</ruleline>

</TimeRuleSource>

</TimeRule>

I am not sure if setting the reference object in all these places are required, but it is working like this.

Important: I noticed that if I specify the duration as 2 days, that is taken as exactly 2 days and does not seem to take the calendar into account. But if I change the date rule to 8 hours, or 24 hours the calendar comes into play. I am not sure why it works this way, but I am happy to set my SLA in hours rather than days.

Cheers,

Csongor

Former Member
0 Kudos

Hi Raj,

Thank for guiding me.

I've follow your step so far it's help.

Question, do we need to do the coding? (refer to the coding below).

Below is the coding but i can't find where link the calendar and reference object.

Appreciate your help on where is the correct place to put the coding.

<?xml version="1.0"?>

<SAPTimeRule>

<TimeRuleTree>

<!-- Begin of Rule Tree -->

<ruleline>

<!-- Begin of new LINE -->

<AssignTimeExp displaytype="AssignTime">

<!-- Assign time -->

<VarTimeExp displayType="VarTime"

name="RESULT"

position='B'>

<!-- Variable: Time -->

</VarTimeExp>

<MoveTimeExp displaytype="MoveTime" direction="+">

<!-- Move -->

<VarTimeExp displayType="VarTime"

name="SRV_CUST_BEG"

position='B'>

<!-- Variable: Time -->

</VarTimeExp>

<ConstDuraExp displaytype="ConstDura"

duration="10" timeunit="DAY">

<!-- Constant Duration -->

<VarObjectExp displaytype="VarObject"

name="SYSTEM"/>

<!-- Variable: Timeobject -->

</ConstDuraExp>

</MoveTimeExp>

</AssignTimeExp>

</ruleline>

</TimeRuleTree>

</SAPTimeRule>

kindly assist.

regards,

Biah

Former Member
0 Kudos

Hi Biah,

Define the factory calendar & holiday details in the transaction SCAL.

Then after that go to date rule definition as you defined start + 10days screen in spro & double click that i will date to the display screen of your asignment then double click that it will open one abap coding of that date rule,there it will ask for the date profile,specify your profile & specify the reference object type time zone & factory calender there.the system will accept that factory calender.

Regards,

Raj

Former Member
0 Kudos

Hi Raj,

I've configured the setting based on your recommendation. But the problem still did'nt solve. the calculation still including weekeend.

how can i defined which day is to be weekday and which day is to be weekend.

Please help.

regards,

Biah

Former Member
0 Kudos

Hi,

To avoid the weekend day check the time zone & factory calender assigned to your service desk.

Reference object

You can use the reference object to control which time zone and which factory calendar the dates and durations refer to. Instead of automatically using the time zone and calendar of the user or of the system, you can set the system to use another time zone when calculating the dates, namely that of the reference object.

You can allow one or several reference objects for one date profile. You must assign one of the allowed reference objects for each date type or duration type. You cannot create any new reference objects.

check in the configuartion node.

SAP Solution Manager---Configuration-Scenario-Specific Settings-Service DeskNode text not foundDate Profile--Define Date Profile.

Here select the date profile & click the reference object it will show the system & user,dont follow system,click on user & Then click on the Date rules it will show your start + 10 days screen ,now select the rule & click the date type it shows the Start customer requirement &End customer requirement here touble click on it it will show all the entry weekend date,date etc.

Regards,

RAj