I just thought to share the importance of _WORKITEM standard container element in any SAP workflow.
This blog might be a smallest on SDN but it could save lots of time for a workflow developer if he knows the usage and importamce of _WORKITEM container.
SAP standard container _WORKITEM is of business object type FLOWITEM. It has got plenty of attributes which can be used in workflow developement instead of using the Class/Business object method and fetching the same values again which are there in _WORKITEM.
Whenever any workflow starts, this container element get filled automatically by SAP.
Below are some of the important attrbiutes of _WORKITEM which can be used in workflow developement.
- CreatedByUser: This attribute is of type USR01 business object.At the start of workflow, it gets filled with initiator’s details. This can be very useful in other workflow steps. It has attribute such as Name (from user master reecord i.e.SU01D), Employee which is of type EMPOYEET business object. EMPLOYEE attrbiute of CreatedByUser containes information about various infotypes from HR master data e.g. HR infotype 0002 for employee personnel data (first name, last name, title etc.), infotype 0006 (for employee addres information). It has also got an attribute for INTERNET ADDRESS from infotype 0105 sub type 0010. This internet address can be used for sending an email notification to workflow CREATOR depending upon certain business condition. Hence instead of writing a dedicated method for determining these informations about workflow CREATOR, we can make use of these statndard workflow containers and bind them to our task containers as the requirements.
- ExecutedByUser: This attribute is also of type of business object USR01. It stores information of user by whose USER ID particular workflow step was executed.Hence the the HR infotype will also get populated for the user executing the user decision work item, which can be then used in other workflow steps and email notifications. sometimes there is a requirement to send an email notification to workflow initiator with the details of agent/manager who executed the work item. In this case we can bind ExecutedByUser.Name attribute from user decision task back to workflow container. The corresponding workflow container will then store the agent name who executed the work item.
- Adminitrator: It stores details of workflow admin in the system. Hence it can be used in other workflow steps for further operations for example for sending email when some unwanted situation arises.
- Similary there are other very useful attributes such as WorkitemCreationDate, Workitemcreationtime, different types of deadline dates.
All these attributes can be directly binded to some workflow container elements as per the need and used in other workflow steps. This will considerably reduce the time involved in creating separate methods and fetching these already populated values.