Skip to Content

Overview:

In Leave request application, leave types field will show all the leave types for employee which ever is applicable. It will show the leave types which contains leave quota 0. This document explains how to restrict these 0 balance leave types from leave type drop down list.

Requirement:

In Leave request creation, for leave type selection list should display only available quota leave types. It should not 0 balance leave types in list.

Solution Steps:

Step 1: Create enhancement to standard class CL_HRESS_PTARQ_LEAVREQ_GUIBBF in method SET_VALUE_HELP

ESS LR.PNG

Step 2: Write code before selecting the leave type

ESS LR1.png

Step 3: Add below code to avoid 0 balance leave types display in Leave Type drop down list.


DATA : lt_accounts TYPE PTARQ_TIME_ACCOUNTS_TAB,
        ls_accounts TYPE LINE OF ptarq_time_accounts_tab,
        lt_attabs_customizing TYPE PTARQ_UIA_ATTABS_TAB,
        ls_attabs_customizing TYPE LINE OF PTARQ_UIA_ATTABS_TAB.
 DATA : account     TYPE REF TO cl_pt_arq_timeaccounts.
 CALL METHOD cl_pt_arq_timeaccounts=>get_instance
     RECEIVING
       result = account.
 CALL METHOD account->get_time_accounts
   EXPORTING
     im_pernr        = MV_PERNR_EMP
     im_begda        = SY-DATUM
 *    im_endda        = '99991231'
 *    im_sel_begda    = '18000101'
 *    im_sel_endda    = '99991231'
   IMPORTING
     ex_timeaccounts = lt_accounts.
 DELETE lt_accounts WHERE REST_POSTED&REQUESTED IS INITIAL.
 LOOP AT lt_accounts INTO ls_accounts.
 IF LS_ACCOUNTS-REST_POSTED&REQUESTED IS NOT INITIAL.
    LOOP AT mt_attabs_customizing ASSIGNING <ls_attabs_customizing> WHERE SUBTYTEXT = LS_ACCOUNTS-QUOTATEXT.
         append <ls_attabs_customizing> TO lt_attabs_customizing.
    ENDLOOP.
 ENDIF.
 ENDLOOP.
 mt_attabs_customizing[] = lt_attabs_customizing[].
SORT mt_attabs_customizing ASCENDING BY subty.

OutPut: In Leave request, employee will able to see only quota available leave types in leave type drop down list for selection.

Note: This is done in EHP5 and above verions.

To report this post you need to login first.

1 Comment

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

Leave a Reply