cancel
Showing results for 
Search instead for 
Did you mean: 

How can I get WorkItemCreationTime to BOR?

Former Member
0 Kudos

hi all,

i searched the forum and haven't got a proper solution for this.

i have a scenario where the task needs to be escalated to the next approver. the problem here is that i am storing the escalation periods in a customising table and this is configurable by the end user.

so, i thought of a solution of passing this as an expression and i have tried it by passing the <b>workitemcreationtime</b> and <b>date</b> through the <b>bor</b> to the function module. i tried to pass these values but i am unable to do it.

could you suggest a way to do this? or if you have any other suggestion than passing through bor, please advice me.

thanks and regards,

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Jubi,

In addition to these try also using <b>Program Exit</b> for the workitem. Using which you can execute a piece of code when Workitem is just created.

1. Double click on Activity and choose the tab Program exit

2. Create a new class which includes an interface 'IF_SWF_IFS_WORKITEM_EXIT '

3. Implement method: IF_SWF_IFS_WORKITEM_EXIT~EVENT_RAISED and look for IM_EVENT_NAME = 'CREATED' and get the Workitem date and time using IM_WORKITEM_CONTEXT.

4. You can set container elements as well

Hope this Helps

Former Member
0 Kudos

Hai...

Thank you for the help.

I have seen Program Exits Tab in Activity.

I have selected the class CL_SRM_WF_PATH_WI_EXIT which uses if_swf_ifs_workitem_exit~event_raised .

In my function module, that calls the approval screen, i tried getting im_workitem_context, which you were saying, holds the current date of the work item.

-


im_context TYPE REF TO if_wapi_workitem_context,

cl_obj TYPE REF TO cl_srm_wf_path_wi_exit.

IF cl_obj IS INITIAL.

CREATE OBJECT cl_obj.

IF im_context IS INITIAL.

CALL METHOD cl_obj->if_swf_ifs_workitem_exit~event_raised

EXPORTING

im_event_name = 'CREATED'

im_workitem_context = im_context.

.

ENDIF.

ENDIF.

-


    • Shows an illegal reference at im_context.

Could you please elaborate on how get the date from im_workitem_context.

I don't know how to go further.

Please do help me. If you could elaborate this step by step, I would be much more thankful.

Thanks & Regards,

jubi jk

Former Member
0 Kudos

Hi Jubi,

I understand your requirement as below:

You have step 'A' in your workflow, which uses a standard task 'B'. B is linked with BOR 'C' and method 'D'. Now your requirement is to get date and time of WI of 'A' in 'D' . Is my understanding correct ??

For the above scenario: I have a different but tested solution for you. In your BOR method have the following piece of code, which would fetch the date and time of the current workitem, which you can pass to your Function Module. Please award bonus points if it was useful..

Data:
    wi   type swc_object,
    wi_date like sy-datum,                                   
    wi_time like sy-UZEIT.

 swc_get_element container '_WORKITEM' wi.                    
 swc_get_property wi 'WorkitemCreationDate' wi_date.          
 swc_get_property wi 'WorkitemCreationTime' wi_time.  

Former Member
0 Kudos

Was trying to find a solution with your suggestion.

I have a small problem.

The task i have created is dead line monitored.

I have 3 tasks - (meaning, 3 approval levels)

Each deadline monitored.

If task 1 starts with current time...The task should complete at current time + a period (say, 10 secs, given in z table)

The second task should start in continuation. The end time should be end_time of task 1 + the period.. and hence forth.....

The suggestion made by you was to get the time from the _WORKITEM and set the container.

I have written the code in my BOR, in the approve method. But the value will be set only if the Approve action is carried out....

In the case where a task is deadline monitored, where the approver does not do anything (approve) How do I set the date?

Is there some other place, where i can write my code?

Please give me your valuable suggestions....!!!

Thanks and Regards,

jubi jk

martin_nooteboom
Active Contributor
0 Kudos

Create a method which calculates the deadline. You can call this method in a task before each step and pass the deadline in container elements and use these in the approval steps.

Regards,

Martin

Former Member
0 Kudos

Hai,

Sorry but, I am passing many values to containers through the BOR. If I Accept or Decline, the BOR is called and the containers will be populated accordingly. But if I don't do any action and the task is timed out, the task goes to the Next Approver and the Workflow Containers are not populated accordingly.

I put a breakpoint in BOR but the control didn't stop there on time out. Is it that BOR is not called in case of time-out? or else, what could be the reason that the control didn't stop there and the containers are not getting populated?

Thanks & Regards,

martin_nooteboom
Active Contributor
0 Kudos

Are you using deadlines of minutes? Otherwise you can use the sy-date and sy-uzeit to calculate. The time passed between the end of task 1 and the start of the next is normally in milliseconds.

Also you don't have to store it in the BOR, you can also store it in the container.

Regards,

Martin

Gave some extra info

Message was edited by:

Martin Nooteboom

KjetilKilhavn
Active Contributor
0 Kudos

Not sure why you are doing this through the BOR. Are you using a BOR method to find the agent, instead of a rule? Anyway.... You haven't said what the problem is, but I assume it is that your date and time container elements in the BOR object method don't have any values (are initial).

Are you trying to pass the creation date and time of the current work item? If it is the current, why not simply use the current date and time instead? If you don't want to do that, e.g. if you want to use the creation date and time of a previous work item, bind the creation date and time to container elements in the return binding of the actual work item.

A final tip: the date and time are probably not the most critical information here. Why not let the function module check if they are initial, and use the current date and time if they are?

Former Member
0 Kudos

Hi,

i am using a rule to find the agent. but why i am querying about the bor is that else how can we pass deadline values stored in our customising table?

i have a customising table where i maintain the approvers for different levels. along with the approvers there is an option to give the maximum retention period as well. so, to get these retention period for each approver, i have to do something in the bor right? that's why i am concerned with the bor.

by the way, i am not usingany events for triggering the workflow. i am using a custom method to trigger it.

thanks & regards,

Former Member
0 Kudos

hi,

you can directly pass your deadline elements from the table to the container of the workflow. and i hope for finding second level approver also you are using ruls so your agent is not dependent on the table, as you are not using any event for trigerring your workflow so i am hoping that you might be calling a FM for trigerring it as in that case passing the container values will become much easy.

Regards,

Saurabh

KjetilKilhavn
Active Contributor
0 Kudos

I see... No I can't think of any way getting around that. That means you retrieve the deadline (number of days I suppose) into a container element and use this container element in your deadline specification of the (next?) step?

Message was edited by Kjetil Kilhavn:

I am not sure I quite understand your step setup here, but I am afraid you could run into trouble if you try to use information about the current step.

former_member184112
Active Contributor
0 Kudos

Hi,

Attributes can be used to formulate conditions in the workflow definition. The system reads or establishes the attribute values at runtime and controls the workflow with them.

Ok, now tell me did you call this FM in your Method.If you done this create a single step task and use this step in your template.And bind with container Elements of time and date.You have to use EVENT for this better way.

Thanks and Regards,

Prabhakar Dharmala

Former Member
0 Kudos

Hi Jubi,

What you can do is enhances your business object and add few levels in Attribute where you write code and get the time frame and depending on that move wf to next approve.

Atul