cancel
Showing results for 
Search instead for 
Did you mean: 

3 levels of approval Process on ess system

Former Member
0 Kudos

Hey Workflow experts,

We have a scenario where a user will aplly for leave encashment from portal and for this I have configured the standard workflow 18900044 in the system.

I have also put in some validations in the implementation of BADI HRPBSIN_GET_LE_APPRV. In my scenario there are supposed to be 3 levels of approvals i.e. from employee to his superior and then to HR and then directer.

We need request should be sent to multiple approvers and should be approved even if one of them approves request.

I checked method in BADI IF_HRPBSIN_GET_LE_APPRV~GET_LE_APPROVER.

It r does not  recieve returns only  value in export parameter APPRVR and self approver.

Has anyone faced similar requirement?

How can this be achieved?

Regards

MSR

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Approval by one of the approver will result in completion of approval step if it is not parallel approval. Can you elaborate on your scenario?

Do you want parallel approval in each level?

Or is it that the approval is sequential based on level.

Thanks

Arghadip

Former Member
0 Kudos

Hi Arghadip,

i want 3 levels sequential approval.  see the below code using the approval process.

method IF_HRPBSIN_GET_LE_APPRV~GET_LE_APPROVER.

*TABLES: t7inleave_en_tr ,pinleave_en_overview,t556u.

DATA:   l_effapprv TYPE REF TO hrpbsin_get_le_apprv,

        EVENTS   TYPE TIM_REQ_XFER_EVENT VALUE CL_PT_REQ_const=>C_REQSTAT_new.

DATA:   WS_T7INLEAVE_EN_TR TYPE T7INLEAVE_EN_TR,

         IT_T7INLEAVE_EN_TR TYPE TABLE OF T7INLEAVE_EN_TR.

DATA: REQUEST_STATUS type T7INLEAVE_EN_TR.

CLEAR:  IT_T7INLEAVE_EN_TR,IT_T7INLEAVE_EN_TR[],WS_T7INLEAVE_EN_TR.

DATA:   ps_leave_en_overview TYPE pinleave_en_overview.

DATA:   WS_t7intrns_metadat TYPE t7intrns_metadat,

         IT_t7intrns_metadat TYPE TABLE OF t7intrns_metadat.

TYPES: BEGIN OF gt_apprv_name_typ,

          req_usrid TYPE t7intrns_metadat-req_usrid,

          pernr TYPE persno,

          name  TYPE char40,

        END OF gt_apprv_name_typ.

TYPES: BEGIN OF gt_apprid_typ,

          row_id  TYPE lvc_s_roid-row_id,

          apprvid TYPE uname,

        END OF gt_apprid_typ.

TYPES:  BEGIN OF gt_output_list_typ,                  

        pernr           TYPE persno,

        empname         TYPE pa0001-ename,

        bukrs           TYPE pa0001-bukrs,

        leave_type      TYPE t7inleave_en_tr-leave_type,

        leave_enca_meth TYPE t7inleave_en_tr-leave_enca_meth,

        request_begda   TYPE t7inleave_en_tr-request_begda,

        request_status  TYPE t7inleave_en_tr-request_status,

        statustxt       TYPE dd07v-ddtext,

        req_usrid       TYPE t7intrns_metadat-req_usrid,

        apprvname       TYPE pa0001-ename,

        req_chdate      TYPE t7intrns_metadat-req_chdate,

        apprvl_status   TYPE t7intrns_metadat-apprvl_status,

        offcycle        TYPE t7inleave_en_tr-offcycle_f,

        reference       TYPE t7inleave_en_tr-reference,

        workit_id       TYPE t7intrns_metadat-workit_id,

        error_f         TYPE t7inleave_en_tr-error_f,

        dropdown        TYPE int4.

TYPES:  END OF gt_output_list_typ.

TYPES: BEGIN OF gt_leave_req_typ,

         pernr           TYPE persno,

         reference       TYPE t7inleave_en_tr-reference,

         reimb_typ       TYPE t7inleave_en_tr-reimb_typ,

         request_status  TYPE t7inleave_en_tr-request_status,

         request_begda   TYPE t7inleave_en_tr-request_begda,

         leave_type      TYPE t7inleave_en_tr-leave_type,

         leave_enca_meth TYPE t7inleave_en_tr-leave_enca_meth,

         encashed_days   TYPE t7inleave_en_tr-encashed_days,

         offcycle_f      TYPE t7inleave_en_tr-offcycle_f,

         req_chdate      TYPE t7intrns_metadat-req_chdate,

         apprvl_status   TYPE t7intrns_metadat-apprvl_status,

         req_usrid       TYPE t7intrns_metadat-req_usrid,

         workit_id       TYPE t7intrns_metadat-workit_id,

         error_f         TYPE  t7inleave_en_tr-error_f,

       END OF gt_leave_req_typ.

*Internal tables and workareas declaration

DATA: gt_apprid TYPE STANDARD TABLE OF gt_apprid_typ,

       gs_apprid TYPE gt_apprid_typ.

DATA: gt_apprv_name TYPE TABLE OF gt_apprv_name_typ,            

     gs_apprv_name TYPE gt_apprv_name_typ.

DATA: gt_emp_name TYPE TABLE OF GT_APPRV_NAME_TYP,

       gs_emp_name TYPE GT_APPRV_NAME_TYP.

DATA: gt_output_list TYPE STANDARD TABLE OF gt_output_list_typ,

      gs_output_list TYPE gt_output_list_typ,

      gt_temp TYPE STANDARD TABLE OF gt_output_list_typ.

DATA:

    lv_objtype    TYPE sibftypeid,

    lv_event      TYPE sibfevent,

    lv_objkey     TYPE sibfinstid,

    l_workitemid  TYPE sww_wiid,

    l_status      TYPE swr_wistat,

    ls_input_cont TYPE STANDARD TABLE OF swr_cont,

*   LV_AGENT type lv_agent,

    lv_is_self_appr TYPE flag,

    lv_agent TYPE wfsyst-agent,

    lv_approver_pernr TYPE persno,

*   lV_appgrp TYPE approver_grp,

* ls_output_list   TYPE gt_output_list_typ,

    lv_approver_sysid TYPE p0105-usrid.

CALL FUNCTION 'SAP_WAPI_START_WORKFLOW'

   EXPORTING

       task          = 'WS99900016'

       language      = sy-langu

       do_commit     = 'X'

       USER          = SY-UNAME

   IMPORTING

*     return_code    = lv_return_code

      workitem_id    = l_workitemid

      new_status     = l_status

   TABLES

    input_container  = LS_INPUT_CONT.

    LV_AGENT         = 'wfsyst-AGENT'.

   L_WORKITEMID        = l_workitemid.

SELECT SINGLE workit_id FROM t7intrns_metadat INTO L_WORKITEMID

             WHERE pernr = GS_OUTPUT_LIST-PERNR

             AND   reimb_typ = 'SLEA'

             AND   reference = GS_OUTPUT_LIST-REFERENCE

             AND   req_cstatus = GS_OUTPUT_LIST-REQUEST_STATUS.

APPEND gs_output_list TO gt_output_list.

READ TABLE gt_output_list INTO gs_output_list WITH KEY pernr   = GS_OUTPUT_LIST-PERNR

                                                     reference = GS_OUTPUT_LIST-REFERENCE.

SELECT * FROM  t7intrns_metadat

               INTO  TABLE IT_T7INTRNS_METADAT

               WHERE pernr     = GS_OUTPUT_LIST-PERNR

               AND   reimb_typ = 'SLEA'

               AND   reference = GS_OUTPUT_LIST-REFERENCE.

DATA:  app type xubname,

       emp type xubname.

select single PERNR

              from zagent

              into emp

              where pernr = APPRVR or emp = app.

CONCATENATE 'US' app INTO LV_AGENT.

endmethod.

and how to link the badi to workflow builder and how to check check agent determination in code.

Regards

MSR

suresh_subramanian2
Active Contributor
0 Kudos

Hello Srinivas !

             In the method, just maintain the logic for agent determination.

             Don't maintain any logic in this method to start the workflow. Because, the include program LHRPBSINLEAVE_ENCASH_RFC01 already is incorporated with the function module SAP_WAPI_START_WORKFLOW.

             Don't be be concerned about how to link the BAdI with the workflow WS18900044. It is already integrated with the above include program.

Regards,

S.Suresh.

Former Member
0 Kudos

Hi Suresh,

which table are using with me for agent determination. u r asking about above include program have already exit and not asking about link to BADI and workflow template.

Actually am copy Standard template. that why i can maintain the FM SAP_WAPI_START_WORKFLOW using my template.

please any sample code send to me for agent determination.

Regards

MSR