on 04-04-2014 12:34 PM
Hi All,
I am working on a rule and need your help.
Let me brief about my requirement
Id | Type | Status | Start date |
1001 | T1 | Informed | 04/04/2014 9:47 AM |
1002 | T2 | Informed | 05/04/2014 9:47 AM |
1003 | T3 | Informed | 03/04/2014 9:47 AM |
1004 | T4 | Informed | 01/04/2014 9:47 AM |
Since all are in informed status, I can start any Service Order which I want. Now I want to restrict this process
For example: 1004 has the start date 01/04/2014 which was scheduled earlier than the rest of the service orders.
Thus I want to compare the start time of all the service orders and the one which was scheduled first should be started first.
Please help how can I achieve this.
Thanks and Regards
Neha Mahanty
One idea is going to be the usage of the Date function or Date rule.
This function will return a date value that is either the current date or if an argument is provided the date value of that argument. The argument can be a data type of either Date or an integral number representing the number of days since epoch, which is January 1st, 2001. Negative values represents dates prior to epoch. This argument may also be a string value containing a date, such as 10/19/2000, which will also be converted to a date by the function.
More about this in the link below.
In this Enterprise Support Academy link tutorial on how to subtract two dates in Agentry.
https://service.sap.com/sap/bc/bsp/spn/esa_redirect/index.htm?gotocourse=X&courseid=70248548
If you don't have access to the link above then probably your SAP license does not give you the rights to watch Enterprise Academy tutorials. Certain people or companies do have access on it (all tied to their support contract).
The goal of the course above will tell you how to subtract dates so you can configure this in your rules to help determine the difference between two dates. I think it may help you in your overall goal when you are trying to find which one to do first. From what I know you may have to create a temporary dummy property (under MainObject >dummyTemp) that will hold the value and you just update that property to be the current when doing the rule analysis. It is like in programming you need to setup a variable x and keep on updating it to be the final x before doing the processing. May need to create subactions to run if the rule is true or a combination of those logic.
Hope this helps,
Mark Pe
SAP Senior Support Engineer
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Neha,
Here is one way to do it. Maybe not the most efficient but should be fine considering the relatively small size of the Service Order collection on a device:
Create a transaction that starts a service order.
Create an action that has a sub-action that calls this transaction, to find the correct target:
Main Object -> Service Orders Collection -> First ServiceOrder Where Rule "FindEarliestSchedule" Is True. Set this by using the object browser.
FindEarliestSchedule rule looks like this:
EQNUM
COLLECTION_MIN
ServiceOrders Collection
ScheduledDate Property
ServiceOrder Object -> ScheduledDate Property
The above will loop over all ServiceOrders, will find the earliest scheduled order using COLLECTION_MIN, and compare it to the ScheduledDate property of the current ServiceOrder in the loop. It will stop when it finds the first row that matches and use that as the target for your action.
The ineffieciency comes from COLLECTION_MIN recalculating every iteration through the loop. You could also calculate this once in another transaction and save the minimum scheduled date property value to the main object in a temp variable, then compare that temp value in FindEarliestScheduled instead of doing the COLLECTION_MIN there. More programming work that way but faster execution.
Don't forget to add an Apply step to the bottom of your action.
Jason Latko - Senior Product Developer at SAP
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.