Overview:

This document explains how to display approver’s details of HCM Process and Forms in required format.

I have tried in different ways and find this solution finally and thought it may useful for others too .

Identification/Issues in standard:

In process of finding solution i observed below points

  • In Process and Forms, Code initialization logic will not execute during Approve/Reject/Display of process and forms. It will trigger only first time of initialization.
  • In standard Process and Forms the approval remarks will not display full details if it’s having more than 3 approver’s remarks you need to scroll down and check.
  • If you want take print out the approver full details will not print in form.
  • And the approver details display format is not niche.

Requirement:

  • In Process and forms should display all approvers details during display and print.
  • Format of display of approvers details
Name Position Date Time Status

Solution Steps:

  • Created a custom table to capture all approvers details for corresponding process
  • Enhanced the standard class CL_QISR_UI_PROCESS_EVENT_MODEL to display the approver’s details in required format
  • Update custom table from workflow task
  • Design Form to display approver details

Step 1: Create Custom Table

I have created a custom generic table to capture all processes and forms approval details

HCM PFDT.png

Step2 : Enhance standard class

After debugging the standard application find it’s triggering the class CL_QISR_UI_PROCESS_EVENT_MODEL at different even triggers.

Did enhancement to this standard class CL_QISR_UI_PROCESS_EVENT_MODEL in method EXECUTE

HCM PFCL.png

In method write the logic based on requirement, here i have coded based on events trigger at each level.


CLASS LCL_ZHR_FORMS_APPROVALS1 DEFINITION DEFERRED.
CLASS CL_QISR_UI_PROCESS_EVENT_MODEL DEFINITION LOCAL FRIENDS LCL_ZHR_FORMS_APPROVALS1.
*----------------------------------------------------------------------*
*       CLASS LCL_ZHR_FORMS_APPROVALS1 DEFINITION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS LCL_ZHR_FORMS_APPROVALS1 DEFINITION.
   PUBLIC SECTION.
     CLASS-DATA OBJ TYPE REF TO LCL_ZHR_FORMS_APPROVALS1.    "#EC NEEDED
     DATA CORE_OBJECT TYPE REF TO CL_QISR_UI_PROCESS_EVENT_MODEL . "#EC NEEDED
  INTERFACES  IOW_ZHR_FORMS_APPROVALS1.
     METHODS:
      CONSTRUCTOR IMPORTING CORE_OBJECT
        TYPE REF TO CL_QISR_UI_PROCESS_EVENT_MODEL OPTIONAL.
ENDCLASS.                    "LCL_ZHR_FORMS_APPROVALS1 DEFINITION
*----------------------------------------------------------------------*
*       CLASS LCL_ZHR_FORMS_APPROVALS1 IMPLEMENTATION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS LCL_ZHR_FORMS_APPROVALS1 IMPLEMENTATION.
   METHOD CONSTRUCTOR.
     ME->CORE_OBJECT = CORE_OBJECT.
   ENDMETHOD.                    "CONSTRUCTOR
   METHOD IOW_ZHR_FORMS_APPROVALS1~EXECUTE.
*"------------------------------------------------------------------------*
*" Declaration of Overwrite-method, do not insert any comments here please!
*"
*"methods EXECUTE .
*"------------------------------------------------------------------------*
     DATA LS_MESSAGE TYPE LINE OF QISRTRETURN.
     DATA: LS_DATA TYPE LINE OF QISRTREQUEST_DATA.
     DATA: LT_APPROVERS TYPE TABLE OF ZHR_FORM_APPRDTL,
           LS_APPROVERS TYPE ZHR_FORM_APPRDTL,
           LV_INDEX TYPE I.
     LOG-POINT ID QISR_UI SUBKEY SY-UZEIT FIELDS CORE_OBJECT->NOTIF_NO_OUT CORE_OBJECT->RETURN CORE_OBJECT->ISR_FORM_VIEW
       CORE_OBJECT->ISR_PAGE_OUT CORE_OBJECT->GENERAL_DATA_OUT CORE_OBJECT->DATA CORE_OBJECT->ADDITIONAL_DATA CORE_OBJECT->EXTERNAL_DATA
       CORE_OBJECT->MESSAGE_LIST CORE_OBJECT->UI_ATTRIBUTES_DATA.
     IF CORE_OBJECT->MODE EQ 'CREATE'.
       CALL FUNCTION 'ISR_PROCESS_EVENT_WD'
         EXPORTING
           SCENARIO              = CORE_OBJECT->SCENARIO
           MODE                  = CORE_OBJECT->MODE
           NOTIF_NO              = CORE_OBJECT->NOTIF_NO
           EVENT                 = CORE_OBJECT->EVENT
           FLAG_INOUT_CONVERSION = CORE_OBJECT->FLAG_INOUT_CONVERSION
           FLAG_RESET            = CORE_OBJECT->FLAG_RESET
           ISR_PAGE_IN           = CORE_OBJECT->ISR_PAGE_IN
           GENERAL_DATA          = CORE_OBJECT->GENERAL_DATA
         IMPORTING
           NOTIF_NO_OUT          = CORE_OBJECT->NOTIF_NO_OUT
           RETURN                = CORE_OBJECT->RETURN
           ISR_FORM_VIEW         = CORE_OBJECT->ISR_FORM_VIEW
           ISR_PAGE_OUT          = CORE_OBJECT->ISR_PAGE_OUT
           GENERAL_DATA          = CORE_OBJECT->GENERAL_DATA_OUT
         TABLES
           DATA                  = CORE_OBJECT->DATA
           ADDITIONAL_DATA       = CORE_OBJECT->ADDITIONAL_DATA
           EXTERNAL_DATA         = CORE_OBJECT->EXTERNAL_DATA
           MESSAGE_LIST          = CORE_OBJECT->MESSAGE_LIST
           UI_ATTRIBUTES         = CORE_OBJECT->UI_ATTRIBUTES_DATA.
     ELSEIF CORE_OBJECT->EVENT EQ 'REJECT' OR CORE_OBJECT->EVENT EQ 'BACKTO'.
       READ TABLE CORE_OBJECT->DATA INTO LS_DATA WITH KEY FIELDNAME = 'HRASR_CURRENT_NOTE'.
       IF LS_DATA-FIELDVALUE IS INITIAL.
         MOVE 'E' TO LS_MESSAGE-TYPE.
         MOVE 'ZHR_ESSMSS_MSG_CLASS' TO LS_MESSAGE-ID.
         MOVE '041' TO LS_MESSAGE-NUMBER.
         APPEND LS_MESSAGE TO CORE_OBJECT->MESSAGE_LIST.
         MOVE LS_MESSAGE TO CORE_OBJECT->RETURN.
       ELSEIF LS_DATA-FIELDVALUE IS NOT INITIAL.
         CALL FUNCTION 'ISR_PROCESS_EVENT_WD'
           EXPORTING
             SCENARIO              = CORE_OBJECT->SCENARIO
             MODE                  = CORE_OBJECT->MODE
             NOTIF_NO              = CORE_OBJECT->NOTIF_NO
             EVENT                 = CORE_OBJECT->EVENT
             FLAG_INOUT_CONVERSION = CORE_OBJECT->FLAG_INOUT_CONVERSION
             FLAG_RESET            = CORE_OBJECT->FLAG_RESET
             ISR_PAGE_IN           = CORE_OBJECT->ISR_PAGE_IN
             GENERAL_DATA          = CORE_OBJECT->GENERAL_DATA
           IMPORTING
             NOTIF_NO_OUT          = CORE_OBJECT->NOTIF_NO_OUT
             RETURN                = CORE_OBJECT->RETURN
             ISR_FORM_VIEW         = CORE_OBJECT->ISR_FORM_VIEW
             ISR_PAGE_OUT          = CORE_OBJECT->ISR_PAGE_OUT
             GENERAL_DATA          = CORE_OBJECT->GENERAL_DATA_OUT
           TABLES
             DATA                  = CORE_OBJECT->DATA
             ADDITIONAL_DATA       = CORE_OBJECT->ADDITIONAL_DATA
             EXTERNAL_DATA         = CORE_OBJECT->EXTERNAL_DATA
             MESSAGE_LIST          = CORE_OBJECT->MESSAGE_LIST
             UI_ATTRIBUTES         = CORE_OBJECT->UI_ATTRIBUTES_DATA.
       ENDIF.
     ELSEIF CORE_OBJECT->MODE EQ 'DISPLAY' OR CORE_OBJECT->EVENT EQ 'APPROVE' OR
            CORE_OBJECT->MODE EQ 'CHANGE' OR CORE_OBJECT->EVENT EQ 'DISPLAY'.
       CALL FUNCTION 'ISR_PROCESS_EVENT_WD'
         EXPORTING
           SCENARIO              = CORE_OBJECT->SCENARIO
           MODE                  = CORE_OBJECT->MODE
           NOTIF_NO              = CORE_OBJECT->NOTIF_NO
           EVENT                 = CORE_OBJECT->EVENT
           FLAG_INOUT_CONVERSION = CORE_OBJECT->FLAG_INOUT_CONVERSION
           FLAG_RESET            = CORE_OBJECT->FLAG_RESET
           ISR_PAGE_IN           = CORE_OBJECT->ISR_PAGE_IN
           GENERAL_DATA          = CORE_OBJECT->GENERAL_DATA
         IMPORTING
           NOTIF_NO_OUT          = CORE_OBJECT->NOTIF_NO_OUT
           RETURN                = CORE_OBJECT->RETURN
           ISR_FORM_VIEW         = CORE_OBJECT->ISR_FORM_VIEW
           ISR_PAGE_OUT          = CORE_OBJECT->ISR_PAGE_OUT
           GENERAL_DATA          = CORE_OBJECT->GENERAL_DATA_OUT
         TABLES
           DATA                  = CORE_OBJECT->DATA
           ADDITIONAL_DATA       = CORE_OBJECT->ADDITIONAL_DATA
           EXTERNAL_DATA         = CORE_OBJECT->EXTERNAL_DATA
           MESSAGE_LIST          = CORE_OBJECT->MESSAGE_LIST
           UI_ATTRIBUTES         = CORE_OBJECT->UI_ATTRIBUTES_DATA.
       READ TABLE CORE_OBJECT->DATA INTO LS_DATA WITH KEY FIELDNAME = 'PROCESS_REFERENCE_NUMBER'.
       IF LS_DATA IS NOT INITIAL.
         SELECT * FROM ZHR_FORM_APPRDTL INTO TABLE LT_APPROVERS WHERE PROCESSREFNO EQ LS_DATA-FIELDVALUE.
         IF LT_APPROVERS[] IS NOT INITIAL.
           LOOP AT LT_APPROVERS INTO LS_APPROVERS.
             MOVE SY-TABIX TO LV_INDEX.
             CLEAR LS_DATA.
             MOVE LV_INDEX TO LS_DATA-FIELDINDEX.
             MOVE 'HRASR_APPRPOS' TO LS_DATA-FIELDNAME.
             MOVE LS_APPROVERS-LAPPRPOS TO LS_DATA-FIELDVALUE.
             MOVE 'X' TO LS_DATA-FIELDDISABLED.
             MOVE 'Approver Position' TO LS_DATA-FIELDLABEL_M.
             MOVE 'Approver Position' TO LS_DATA-FIELDLABEL_L.
             APPEND LS_DATA TO CORE_OBJECT->DATA.
             CLEAR LS_DATA.
             MOVE LV_INDEX TO LS_DATA-FIELDINDEX.
             MOVE 'HRASR_APPRNAME' TO LS_DATA-FIELDNAME.
             MOVE LS_APPROVERS-LAPPRNAME TO LS_DATA-FIELDVALUE.
             MOVE 'X' TO LS_DATA-FIELDDISABLED.
             MOVE 'Approver Name' TO LS_DATA-FIELDLABEL_M.
             MOVE 'Approver Name' TO LS_DATA-FIELDLABEL_L.
             APPEND LS_DATA TO CORE_OBJECT->DATA.
             CLEAR LS_DATA.
             MOVE LV_INDEX TO LS_DATA-FIELDINDEX.
             MOVE 'HRASR_APPRDATE' TO LS_DATA-FIELDNAME.
             MOVE LS_APPROVERS-LAPPRDATE TO LS_DATA-FIELDVALUE.
             MOVE 'X' TO LS_DATA-FIELDDISABLED.
             MOVE 'Approver Date' TO LS_DATA-FIELDLABEL_M.
             MOVE 'Approver Date' TO LS_DATA-FIELDLABEL_L.
             APPEND LS_DATA TO CORE_OBJECT->DATA.
             CLEAR LS_DATA.
             MOVE LV_INDEX TO LS_DATA-FIELDINDEX.
             MOVE 'HRASR_APPRTIME' TO LS_DATA-FIELDNAME.
             MOVE LS_APPROVERS-LAPPRTIME TO LS_DATA-FIELDVALUE.
             MOVE 'X' TO LS_DATA-FIELDDISABLED.
             MOVE 'Approver Time' TO LS_DATA-FIELDLABEL_M.
             MOVE 'Approver Time' TO LS_DATA-FIELDLABEL_L.
             APPEND LS_DATA TO CORE_OBJECT->DATA.
             CLEAR LS_DATA.
             MOVE LV_INDEX TO LS_DATA-FIELDINDEX.
             MOVE 'HRASR_APPRSTATUS' TO LS_DATA-FIELDNAME.
             MOVE LS_APPROVERS-STATUS TO LS_DATA-FIELDVALUE.
             MOVE 'X' TO LS_DATA-FIELDDISABLED.
             MOVE 'Approver Status' TO LS_DATA-FIELDLABEL_M.
             MOVE 'Approver Status' TO LS_DATA-FIELDLABEL_L.
             APPEND LS_DATA TO CORE_OBJECT->DATA.
             CLEAR LV_INDEX.
           ENDLOOP.
         ENDIF.
       ENDIF.
     ENDIF.
     LOG-POINT ID QISR_UI SUBKEY SY-UZEIT FIELDS CORE_OBJECT->NOTIF_NO_OUT CORE_OBJECT->RETURN CORE_OBJECT->ISR_FORM_VIEW
       CORE_OBJECT->ISR_PAGE_OUT CORE_OBJECT->GENERAL_DATA_OUT CORE_OBJECT->DATA CORE_OBJECT->ADDITIONAL_DATA CORE_OBJECT->EXTERNAL_DATA CORE_OBJECT->MESSAGE_LIST CORE_OBJECT->UI_ATTRIBUTES_DATA.
   ENDMETHOD.                    "IOW_ZHR_FORMS_APPROVALS1~EXECUTE
ENDCLASS.



Step 3: Design Form fields

In form interface add below fields

HRASR_APPRNAME        TYPE      QISR_TAB_TYPE_STRING

HRASR_APPRDATE          TYPE      QISR_TAB_TYPE_STRING

HRASR_APPRSTATUS     TYPE      QISR_TAB_TYPE_STRING

HRASR_APPRTIME          TYPE      QISR_TAB_TYPE_STRING

HRASR_APPRPOS            TYPE      QISR_TAB_TYPE_STRING

HCM PFIF.png

In Form, import these parameters into form design.

HCM PFFD.png

In Form design add all these fields with required table properties as shown below

HCM PFFD1.png

Step 4: Custom class for updating the approvers

Create a custom class as shown below

HCM PFUCL.PNG

Define parameters for UPDFORM_APPRDTLS method.

HCM PFUCLM.png

Write below logic in method.


METHOD UPDFORM_APPRDTLS.
   DATA : LS_FORMAPPR TYPE ZHR_FORM_APPRDTL,
          LS_FORMAPPR1 TYPE ZHR_FORM_APPRDTL.
   IF WRKID IS NOT INITIAL.
     MOVE WRKID TO LS_FORMAPPR-WRKID.
     MOVE PROCESSREFNO TO LS_FORMAPPR-PROCESSREFNO.
     MOVE PROCESSNAME TO LS_FORMAPPR-PROCESSNAME.
     MOVE FORMSCENARIO TO LS_FORMAPPR-FORMSCENARIO.
     MOVE PROCESSGUID TO LS_FORMAPPR-PROCESSGUID.
     MOVE PROCESSPGUID TO LS_FORMAPPR-PROCESSPGUID.
     MOVE INITIATOR TO LS_FORMAPPR-INITIATOR.
     MOVE ROLEOFINITIATOR TO LS_FORMAPPR-ROLEOFINITIATOR.
     MOVE EMPPERNR TO LS_FORMAPPR-EMPPERNR.
     MOVE LAPPRDATE TO LS_FORMAPPR-LAPPRDATE.
     MOVE LAPPRTIME TO LS_FORMAPPR-LAPPRTIME.
     MOVE LAPPRID TO LS_FORMAPPR-LAPPRID.
     MOVE LAPPRNAME TO LS_FORMAPPR-LAPPRNAME.
     MOVE LAPPRPOS TO LS_FORMAPPR-LAPPRPOS.
     MOVE LAPPRLVL TO LS_FORMAPPR-LAPPRLVL.
     MOVE STATUS TO LS_FORMAPPR-STATUS.
     MOVE LAPPRCOMENTS TO LS_FORMAPPR-LAPPRCOMENTS.
     SELECT SINGLE * FROM ZHR_FORM_APPRDTL INTO LS_FORMAPPR1 WHERE WRKID EQ WRKID.
     IF SY-SUBRC EQ 0.
       UPDATE ZHR_FORM_APPRDTL FROM LS_FORMAPPR.
     ELSE.
       INSERT ZHR_FORM_APPRDTL FROM LS_FORMAPPR.
     ENDIF.
   ENDIF.
   CLEAR: LS_FORMAPPR, LS_FORMAPPR1.
ENDMETHOD.



Step 5: Create a Custom task

Create one custom task to use in all processes and forms workflow’s

HCM PFTS.PNG

Step 6: Workflow Design

In workflow put a task step after approval step and update the approver details.

HCM PFWF.PNG

Output in Portal HCM Process and Forms:

MSS PFA.png

Note: This is done in EHP5/6. If you have any better solution please do update.

To report this post you need to login first.

3 Comments

You must be Logged on to comment or reply to a post.

  1. Christopher Solomon

    Interesting requirement and solution. Curious why you used the Z-table and not just read the CASE Mgmt info (much like the Process Browser does). Thanks for blogging!

    (0) 
  2. Vamsi Nagabairu

    Great.

     

    We had a similar requirement to display all the log for Audit purpose. they needed on the form only.

    so what I did was ,defined a field in Config of type PAD_LONG_TEXT in custom back-end service and written logic (Taking data form those T5ASR* TABLES) in DO_OPERATIONS method. So every time form gets opened by the people involved in the process this method gets executed and updates data in that field (Last step details will get appended like reject or approve or whatever it is ).

    but the limitation here is that , this doesn’t work in case of multiple scenario steps are used in form. To my knowledge whats happening is , at the time of change in scenario step like from one approver to the next approver , DO_OPERATIONS method will get executed but updated data in the fields wont be taken back to the form meaning form will not display the last approver details..

    (0) 

Leave a Reply