• No results found

If you use responsibilities, you can define the role container using any table fields or object types. The 'Responsibilities' title element enables you to define any

In document SAP workFlow handbooks (Page 53-64)

number of responsibilities. You can then assign agents to them. You can also define

criteria for each responsibility. The responsibility is then valid for the criteria.

EVALUATION PATHS -

OOAW

WF_ORGUN / WF_ORGUS / US_CHEF / SAP_HOLD.

PROCEDURE TO DO:

 Determine the evaluation path you want to use

 Create a rule as normal, setting the type to “Function to be executed” (i.e) this is a function module based rule.

Enter the function module RH_GET_STRUCTURE

 Automatically an additional field Evaluation path appears. Enter your evaluation path ID in this field.

 Create the following rule container elements

 OTYPE / OBJID / ORG_AGENT Table : T778A (for Evaluation Paths) FUNCTION RH_GET_STRUCTURE.

*"---

*"*"Lokale Schnittstelle:

*" IMPORTING

*" VALUE(ACT_WEGID) LIKE T778A-WEGID OPTIONAL

*" TABLES

*" ACTOR_TAB STRUCTURE SWHACTOR

*" AC_CONTAINER STRUCTURE SWCONT

*" EXCEPTIONS

*" NOBODY_FOUND

*" NO_ACTIVE_PLVAR ORGANIZATIONAL ATTRIBUTES RH_OM_ATTRIBUTE_ORGOBJ_FIND

(General Attribute Maintenance: Application Scenario) FUNCTION rh_om_attribute_orgobj_find .

*"---

*"*"Lokale Schnittstelle:

*" IMPORTING

*" VALUE(SCENARIO) TYPE OM_ATTRSCN OPTIONAL

*" VALUE(BUFFER_REFRESH) TYPE FLAG OPTIONAL

*" VALUE(PLVAR) TYPE PLVAR OPTIONAL

*" VALUE(SEARCH_DATE) TYPE DATS DEFAULT SY-DATUM

*" TABLES

*" AC_CONTAINER STRUCTURE SWCONT OPTIONAL

*" ACTOR_TAB STRUCTURE SWHACTOR OPTIONAL

*" EXCEPTIONS

*" NO_SCENARIO

*" NOTHING_FOUND

*"--- FUNCTION MODULES

You can execute any role resolutions using a function module. Some function modules are supplied by SAP.

To Know standard Roles Available

 Use Transaction PFAC

 Use function module (RH_ACTOR_STRUCTURE_GET

1) use Transaction PFAC

2) Use function module (RH_ACTOR_STRUCTURE_GET) to get the following screen. Then type the role number for more info. About role and testing it.

CALLING FUNCTION MODULE

* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

DATA: ORG_AGENT LIKE SWHACTOR.

REFRESH: ACTOR_TAB.

SWC_GET_ELEMENT AC_CONTAINER 'PLVAR' PLVAR.

SWC_GET_ELEMENT AC_CONTAINER 'ORG_AGENT' ORG_AGENT.

IF SY-SUBRC > 0 OR ORG_AGENT IS INITIAL.

SWC_GET_ELEMENT AC_CONTAINER 'OTYPE' OTYPE.

SWC_GET_ELEMENT AC_CONTAINER 'OBJID' OBJID.

ELSE.

OTYPE = ORG_AGENT-OTYPE.

OBJID = ORG_AGENT-OBJID.

ENDIF.

SWC_GET_ELEMENT AC_CONTAINER 'TDEPTH' TDEPTH.

IF SY-SUBRC > 0.

ACT_ENDDA = SY-DATUM ACT_TDEPTH = TDEPTH ACT_TFLAG = ' ' ACT_VFLAG = ' ' AUTHORITY_CHECK = $CROSS TABLES

RESULT_TAB = ACTOR_TAB EXCEPTIONS

NO_PLVAR_FOUND = 1 OTHERS = 2.

CASE SY-SUBRC.

WHEN 01.

MESSAGE E300(5W) RAISING NO_ACTIVE_PLVAR.

WHEN 02.

MESSAGE E170(5W) WITH PLVAR OTYPE OBJID ACT_WEGID RAISING NOBODY_FOUND.

ENDCASE.

ENDFUNCTION.

T

RIGGERING A WORKFLOW USING FUNCTION MODULES

SWW_WI_START_SIMPLE INCLUDE <CNTN01>

DATA: BEGIN OF WA_VBAK, VBELN TYPE VBAK-VBELN, AUART TYPE VBAK-AUART, AUGRU TYPE VBAK-AUGRU, NETWR TYPE VBAK-NETWR, VKORG TYPE VBAK-VKORG, END OF WA_VBAK.

DATA IT_VBAK LIKE TABLE OF WA_VBAK WITH HEADER LINE.

*************************************************************************

DATA : AGENTS LIKE TABLE OF SWHACTOR WITH HEADER LINE, CONTAINER LIKE TABLE OF SWCONT, "Assign initiator

SALESORDER TYPE SWC_OBJECT, "Assign Values to Workflow Container SALESNUMBER LIKE SWEINSTCOU-OBJKEY. "Create Object

*************************************************************************

PARAMETERS SALESNO TYPE VBAK-VBELN.

SALESNUMBER = SALESNO.

*************************************************************************

IF SY-UNAME = 'KAAV02'.

AGENTS-OTYPE = 'US'.

AGENTS-OBJID = 'KAAV02'.

APPEND AGENTS.

ENDIF.

*“Macro Commands to assign values to Container SWC_CONTAINER MY_CONTAINER.

SWC_CREATE_CONTAINER MY_CONTAINER.

SWC_CREATE_OBJECT SALESORDER 'BUS2032' SALESNUMBER.

SWC_SET_ELEMENT MY_CONTAINER ‘Salesorder' SALESORDER.

SWC_CONTAINER_TO_PERSISTENT MY_CONTAINER.

SELECT VBELN AUART AUGRU NETWR VKORG

INTO TABLE IT_VBAK FROM VBAK

WHERE VBELN = SALESNO.

READ TABLE IT_VBAK WITH KEY VBELN = SALESNO.

SWC_SET_ELEMENT MY_CONTAINER 'NETVALUE' IT_VBAK-NETWR.

CALL FUNCTION 'SWW_WI_START_SIMPLE' EXPORTING

TASK = 'WS80000786' TABLES

AGENTS = AGENTS

WI_CONTAINER = MY_CONTAINER.

E

XECUTING

W

ORKITEM FORM

U

SER

D

EFINED

S

CREEN Class : CL_WAPI_WF_TOOLBOX

Data : C_TOOLBOX TYPE REF TO CL_WAPI_WF_TOOLBOX, WORKITEMID TYPE SWW_WIID VALUE ‘700551’.

CREATE OBJECT C_TOOLBOX EXPORTING

I_CONTAINER = CONT “ Object of CL_GUI_CUSTOM_CONTAINER I_REPID = SY-REPID

I_DYNNR = ‘9000’

I_MODE = CL_WAPI_TOOLBOX=>C_MODE_INPLACE_WITH_INFO I_WI_ID = WORKITEMID.

I_MODE ( Additions )

C_MODE_INPLACE_WITH_INFO - Show Only Toolbar Embedded (0 / 1) C_MODE_INPLACE_BUTTON_ONLY - Show Only, Text, Links

C_MODE_MODELESS - Show Toolbar, Text, Links in Modular window

R

AISING A BUSINESS OBJECT EVENT WITH A CONTAINER

The following code raises the EVENTRAISED event linked to the sales order business object BUS2032 and passes in the variable WEATHEROUTSIDE with the value SUNNY.

INCLUDE <CNTN01>.

SWC_CONTAINER LT_EVENT_CONTAINER.

SWC_CREATE_CONTAINER LT_EVENT_CONTAINER.

SWC_SET_ELEMENT LT_EVENT_CONTAINER 'WeatherOutside' 'Sunny'.

CALL FUNCTION 'SWE_EVENT_CREATE' EXPORTING

OBJTYPE = 'BUS2032' "Sales order object OBJKEY = '0000014078' "Sales order number EVENT = 'EventRaised' "Event defined in SWO1 CREATOR = 'X'

START_RECFB_SYNCHRON = 'X' IMPORTING

EVENT_ID = EVENT_ID TABLES

EVENT_CONTAINER = LT_EVENT_CONTAINER.

ACTIVATING GENERIC BUSINESS OBJECT SERVICES

If you want to have the same functionality that is available when you push the Services for Object button located at the top of each SAP related document you can do the following:

1) Enable your functionality as an object in the BOR using SWO1 - Make sure it generates 2) Add this code to your EDIT dialog (in the PAI section after pushing a button) that you use against that object.

*** EXAMPLE CODE ***

data l_borident like borident.

CASE ok_code.

WHEN 'OBJSERV'.

l_borident-objkey = zcustomobj-id.

l_borident-objtype = 'ZCUSTOM'.

l_borident-logsys = 'DEVCLNT005'.

IF NOT l_borident-objtype IS INITIAL and not l_borident-objkey is initial.

CALL FUNCTION 'SWU_OBJECT_REFRESH'.

** activate generic system service

CALL FUNCTION 'SWU_OBJECT_PUBLISH' EXPORTING

objtype = l_borident-objtype objkey = l_borident-objkey EXCEPTIONS

objtype_not_found = 1 OTHERS = 2.

CALL FUNCTION 'SWU_OBJECT_DISPATCH_SERVICE' EXPORTING

service = 'HC1H'

called_by_system = space EXCEPTIONS

OTHERS = 0.

ENDIF.

ENDCASE.

Testing Role Resolution : PFAC

ORGANIZATIONAL DATA

If you select this option, role resolution is executed using 'business object types' related in the organizational model.

For example, you can relate organizational units to the 'country' object type. A value for the country must then be written to the role container at runtime. Role resolution then returns all of the organizational units assigned to this country.

SAP Organizational Objects

Allows to match codes entered in customizing tables against organizational objects in the organizational plan.

Eg:

 If you have code representing a particular laboratory, you can relate this to an organization unit representing all the people in the laboratory.

 If you have code representing an MRP controller, you can relate this a particular job (or) position in the organizational plan.

LOCK INDICATORS

The following lock indicators can be set for single step tasks:

Locked against instantiation

The system does not create a work item for the single step that is locked against instantiation

Locked against execution

The system does create a work item for the single step task that is locked against execution however it cannot be executed.

Business process models:

The process consultant analyzes the real-life business processes of a company and tries to map these processes into an optimized, workflow-compatible business process model.

To create the role:

For process consultant:

SAP_BC_SRV_USER

SAP_BC_BMT_WFM_PROCESS

Person within the system of workflow roles who analyses the existing business processes, identifies those that are suitable for SAP Business workflow and maps them onto a business model.

For work developer:

SAP_BC_BMT_WFM_DEVELOPER

Person within the system of workflow roles who implement the workflow based process model developed by the process consultant and using the SAP Business workflow definition tools.

For workflow system administrator:

SAP_BC_ENDUSER SAP_BC_SRV_USER

SAP_BC_BMT_WFM_ADMIN

Person within the system of workflow roles who is responsible for the technical maintenance of the development environment and the runtime behavior after automatic customizing.

For workflow agent:

SAP_BC_SRV_USER

Person within the system of workflow roles who appears as an end user in productive workflows.

The workflow agent starts workflows and processes work items. Their work area is the Business Workplace.

For process controllers:

SAP_BC_SRV_USER

SAP_BC_BMT_WFM_CONTROLLER

VERSIONS IN WORKFLOW Default Version 0000.

To Generate a new version.

Choose Workflow -> Generate Version.

Generates a version 0001 – Active Version.

Import & Export parameters are not subject to version change DISPLAYING VERSIONS

Choose Basic Data.

 Version Independent Basic Data

 Version Overview

When transported to another system, only the ACTIVE VERSION is transported with a new free version number.

TABLES AFFECTED

SWDSHEADER : WF DEFINITION BASIC DATA FIELDS

WFD_ID Workflow Definition VERSION Version

EXETYP Workflow Type WORKFLOW TYPES

S - Definition

E - Runtime

D - Ad Hoc Definition R - Ad Hoc Runtime

C - Configuration Definition A - Configuration Runtime CHANGE TO HRMASTER DATA

SWEHR1 Linkage Object Type to HR Infotype SWEHR2 Event Infotype Operation (SAP) SWEHR3 Event Infotype Operation (Customer) CHANGE DOCUMENTS

SCDO Overview

SWED Define Workflow Properties SWEC Linkage

BSVW Status Management NACE Message Control

AWUW Logistics Information System EVENT LINKAGE

SWETYPU Type Linkages

SWB_COND Workflow Start Conditions

SWUY Create Workflow Message Linkage SWFC Automatic Workflow Customizing SWF_AUTO

SUBSTITUTING BY USERS –(INFO. FROM EDIBOOK PG.NO.NO.185 -CHAP.9)

Substitution is the capability to designate another position as a backup to execute

In document SAP workFlow handbooks (Page 53-64)