Enterprise Resource Planning Blogs by Members
Gain new perspectives and knowledge about enterprise resource planning in blog posts from community members. Share your own comments and ERP insights today!
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member
781

Scenario:  Maternity Leave


Employee maternity leave should be evaluated based on her experience in the organization.

If employee is less than 1 year old then she should not be paid.

If employee is between 1 and 3 years then she should be paid 50%.

If employee is more than 3 years old then she should be paid.

Using standard schema, we cannot achieve this.

We will create a custom function to pick correct absence valuation rule and add that function to the payroll schema.

Step1:

Describe Absence Valuation Rule in V_T554L and set up counting classes in V_T554C for.

1. Paid Absence 

2. Unpaid Absence

3. 50% Paid

Step2:

Create Maternity Absence type(in V_T554S) and Assign Absence type to any of the above created rules.

step3:

Create a function in PE04.

Enter Function Name and Click on create Button.

Enter Description of the function and Assign Country Grouping.

Click on Source Text(Ctrl+F7).

Create a subroutine fu_zab in include PCBURZ990 and put the below code.

DATA: gv_date TYPE sy-datum,

        gv_year TYPE PEA_SCRYY.

* Get Hire Date

CALL FUNCTION 'RP_GET_HIRE_DATE'

EXPORTING

      persnr                = pernr-pernr

      check_infotypes       = '0041'

     datumsart             = '01'

     status2 = '3'

*   P0016_OPTIONEN        = ' '

IMPORTING

     hiredate              = gv_date.

LOOP AT ab.

*   Experience

CALL FUNCTION 'HR_HK_DIFF_BT_2_DATES'

      EXPORTING

        date1                         = ab-begda

        date2                         = gv_date

       output_format                 = '01'

     IMPORTING

       years                         = gv_year

*   MONTHS                        =

*   DAYS                          =

     EXCEPTIONS

       invalid_dates_specified       = 1

*   OTHERS                        = 2

              .

IF sy-subrc <> 0.

      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

              WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

*   Changing Absence Valuation rule based on experience

*   '01' is Paid Absence Valuation Rule

*   '14' is 50% Paid Absence Valuation Rule

*   '11' is Unpaid Absence Valuation Rule.

IF gv_year GE 3.

      ab-klbew = '01'.

ELSEIF gv_year GE 1.

      ab-klbew = '14'.

ELSE.

      ab-klbew = '11'.

ENDIF.

MODIFY ab.

ENDLOOP.

Insert the newly created function into Z schema Z003(It is copy of X000 Schema).







Labels in this area