Concept of Re-evaluate agents for active work items in SAP Workflow

...Previous

Logic of TRIGGER_WF method.  

The method will populate the required parameters for event and start the workflow.  

METHOD trigger_wf.
*Locals
  
DATA:lv_objkey            TYPE sibfinstid,
       lif_event_parameters 
TYPE REF TO if_swf_ifs_parameter_container,
       lif_event            
TYPE REF TO if_swf_evt_event,
       lcl_event            
TYPE REF TO cl_swf_evt_event,
       lv_evt_id            
TYPE swe_evtid.
  
CONSTANTS: lc_event       TYPE sibfevent  VALUE 'START_WORKFLOW'.
*Get event container
  
CALL METHOD cl_swf_evt_event=>get_event_container
    
EXPORTING
      im_objcateg  = gv_catid
      im_objtype   = gv_typeid
      im_event     = lc_event
    RECEIVING
      re_reference = lif_event_parameters.
*Set elements
  
TRY.
      
CALL METHOD lif_event_parameters->set
        
EXPORTING
          name  = 
'START_DATE'
          
value = im_start_date.
    
CATCH cx_swf_cnt_cont_access_denied .
    
CATCH cx_swf_cnt_elem_access_denied .
    
CATCH cx_swf_cnt_elem_not_found .
    
CATCH cx_swf_cnt_elem_type_conflict .
    
CATCH cx_swf_cnt_unit_type_conflict .
    
CATCH cx_swf_cnt_elem_def_invalid .
    
CATCH cx_swf_cnt_container .
  
ENDTRY.

  
TRY.
      
CALL METHOD lif_event_parameters->set
        
EXPORTING
          name  = 
'START_TIME'
          
value = im_start_time.
    
CATCH cx_swf_cnt_cont_access_denied .
    
CATCH cx_swf_cnt_elem_access_denied .
    
CATCH cx_swf_cnt_elem_not_found .
    
CATCH cx_swf_cnt_elem_type_conflict .
    
CATCH cx_swf_cnt_unit_type_conflict .
    
CATCH cx_swf_cnt_elem_def_invalid .
    
CATCH cx_swf_cnt_container .
  
ENDTRY.


  
CALL METHOD cl_swf_evt_event=>get_instance
    
EXPORTING
      im_objcateg        = gv_catid
      im_objtype         = gv_typeid
      im_event           = lc_event
      im_objkey          = gv_user
      im_event_container = lif_event_parameters
    RECEIVING
      re_event           = lif_event.

  
TRY.
      
CALL METHOD lif_event->raise
        .
    
CATCH cx_swf_evt_invalid_objtype .
    
CATCH cx_swf_evt_invalid_event .
  
ENDTRY.

  
COMMIT WORK.

    lcl_event ?= lif_event.

    
CALL METHOD lcl_event->get_event_id
      RECEIVING
        re_event_id = ev_event_id.

ENDMETHOD.  

Signature of GET_DEADLINE_DATE_TIME method

Logic of GET_DEADLINE_DATE_TIME method

Usually for determining dead line date, time we use factory calendar id, as my intension is only to show the Re-evaluate agent's concept hence ignored the complex logic of determining dead line date and time. I have hard coded the dead line time = start time + 1 hour.

Events of the ZCL_WORKFLOW_DEMO class

START_WORKFLOW event parameters

NEW_APPROVER event will be assigned towards Receiver type "Re-evaluate rules of active work items". This event does not have any parameters.  

Design a screen in SE80 as shown below and assign a t-code. ZTRAVEL.

 

Write the below code inside PAI module

Create a new workflow template in PFTC with the start event START_WORKFLOW of the business class ZCL_WORKFLOW_DEMO. Assign start events as shown below.

Create the WF container elements compatible to the event parameters and bind and shown.

Create workflow container element WF_ZCL_WOKFLOW_DEMO selecting object type class and value as ZCL_WOKFLOW_DEMO.

   

As the workflow container element  WF_ZCL_WOKFLOW_DEMO need to be populated from Event binding set the properties as Import as shown below.

Create workflow container element WF_START_DATE selecting SYST  for structure and DATUM for field as shown below.

Click here to continue..

Please send us your feedback/suggestions at webmaster@SAPTechnical.COM 

HomeContribute About Us Privacy Terms Of Use • Disclaimer • SafeCompanies: Advertise on SAPTechnical.COM | Post JobContact Us  

Graphic Design by Round the Bend Wizards

footer image footer image