Skip to Content
0
Former Member
Jan 11, 2005 at 06:13 PM

How to do the Calculation of Employeeu0092s Total Compensation

89 Views

Hi Im stuck coding with this codes hope you could help me. Please advice me a possible way to code this one. Thanx!!!

Step 4: Calculation of Employee’s Total Compensation

As mentioned in Step 3, wage types are scattered in different infotypes which needs to be summed up to come up with the final employee’s “Total Compensation”. In order to accumulate the total compensation of an employee that will be referenced by the Bill Code & Activity Type Assignments Table (Name: ZHBILLACTVTY), the following infotypes should be read:

- Infotype 0008 (Basic Pay)

- Infotype 0015 (Additional Payments)

- Infotype 0014 (Recurring Payments and Deductions)

Infotype 0008 – Basic Pay

Retrieve “Annual salary” on table PA0008, field ANSAL. This amount should be added to the “Total Compensation” counter. You can do this using the function module HR_READ_INFOTYPE or you can do a SELECT from table PA0008.

Infotype 0015 – Additional Payments

The wage type amount from infotype 0015 must be read in order to add any additional payments to the “Total Compensation” counter. The custom Compensation Components table (Name: ZHCOMPENSTN) defined in this extension indicates which wage types will be applicable for each country. Therefore, the following logic should be followed:

a) Loop through all of the employee’s records for Infotype 0015.

b) If the wage type (PA0015-LGART) is assigned to the employee's country (Based on the custom Compensation Component table ZHCOMPENSTN), then proceed to next step. Otherwise, skip the record since this will not be included or added in the “Total Compensation” counter.

c) If the payment date (PA0015-BEGDA) is between the start date of the fiscal year (Sept 01) and the end date of the fiscal year (Aug 31), then add the additional payment amount (PA0015-BETRG) to the Total Compensation counter.

d) Endloop. (Repeat process for the next record for Infotype 0015)

Infotype 0014 – Recur. Payments/Deds.

The last among the scope of the calculation for an employee’s Total Compensation will be recurring payments. The wage type amount from Infotype 0014 must be read in order to add any recurring payments to the Total Compensation counter. The custom “Compensation Components” table (ZHCOMPENSTN) indicates which wage types will be applicable for each country thus will be added to the Total Compensation package.

The following logic below will detail how to capture all payments for the fiscal year. Again, in order to get all the Infotype 0014 records of an employee you can use the function module “HR_READ_INFOTYPE” or execute a SELECT statement from table PA0014.

Basic logic flow will be as follows:

LOOP through all of the employee’s records for Infotype 0014.

IF wage type (PA0014-LGART) is assigned to the employee’s country (check on table ZHCOMPENSTN).

Proceed to detailed logic for Scenarios 1 – 4 below.

ELSE

Exit. (Skip the wage type since it is not applicable to the country’s calculation)

ENDLOOP

Detailed Scenarios 1 – 4

Scenario 1 – When the payment started before the beginning of the fiscal year AND is still being paid out.

IF payment end date (PA0014-ENDDA) = ’12.31.9999’ (Delimited) AND 1st payment date (PA0014-ZDATE) < Sept. 01 of the current fiscal year

Accumulate all payments occurring between Sept 01 and Aug 31 of the current fiscal year (Refer below for the logic determining and accumulating all payments for the fiscal year).

Scenario 2 – When the payment started within the fiscal year AND is still being paid out.

ELSEIF payment end date (PA0014-ENDDA) = ’12.31.9999’ (Delimited) AND 1st payment date (PA0014-ZDATE) > Aug 31 of the current fiscal year

Accumulate all payments occurring between the 1st payment date and Aug 31 of the current fiscal year (Refer below for the logic determining and accumulating all payments for the fiscal year).

Scenario 3 – When the payment started within the fiscal year BUT also ended within the fiscal year.

ELSEIF payment end date (PA0014-ENDDA) <> ’12.31.9999’ (Delimited) AND 1st payment

date > Aug 31 of the fiscal year.

Accumulate all payments occurring between the 1st payment date and the end date of the record (PA0014-ENDDA). (Refer below for the logic determining and accumulating all payments for the fiscal year).

Scenario 4 – When the payment started before the beginning of the fiscal year BUT also ended within/during the fiscal year.

ELSEIF (payment end date (PA0014-ENDDA) <> ’12.31.9999’ (Delimited) AND payment end date within current fiscal year) AND 1st payment date < Sept 01 of the fiscal year

Accumulate all payments occurring between the Sept 01 of the current fiscal year and the end date of the record (PA0014-ENDDA). (Refer below for the logic determining and accumulating all payments for the fiscal year).

ELSE

Exit (Skip the wage type since the full payment has accrued in previous fiscal years)

ENDIF

Logic for determining and accumulating all payments for the fiscal year

A variable (ex: [Payment date]) should be used to store each successive payment. The variable should be initialized as follows, depending on the scenario.

For Scenario 1, set [Payment date] = 1st payment date occuring after Aug 31 (current fiscal year)

For Scenario 2, set [Payment date] = 1st payment date (Screen field: P0014-ZDATE)

For Scenario 3, set [Payment date] = 1st payment date (Screen field: P0014-ZDATE)

For Scenario 4, set [Payment date] = 1st payment date occuring after Aug 31 (current fiscal year)

IF the [Payment date] is <= to the infotype 0014 record end date (PA0014-ENDDA), do

If the [Payment date] is in between the start and end date of the current Fiscal year

If the unit (PA0014-ZEINH) is “Days”,

[Payment date] = [Payment date] + (# of days)

Add recurring payment (PA0014-BETRG) to total compensation counter

Endif

If the unit (PA0014-ZEINH) is “Weeks”, then {

[Payment date] = [Payment date] + (# of weeks)

Add recurring payment (PA0014-BETRG) to total compensationcounter

Endif

If the unit (PA0014-ZEINH) is “Months”, then {

[Payment date] = [Payment date] + (# of months)

Add recurring payment (PA0014-BETRG) to total compensation counter

Endif

If the unit (PA0014-ZEINH) is “Years”, then {

[Payment date] = [Payment date] + (# of years)

Add recurring payment (PA0014-BETRG) to total compensation counter

Endif

Endif

Endif

Repeat for next payment

Repeat for the next infotype 0014 record (if it exists)

Once the above processing is complete, the “Total Compensation” counter should contain the employee's total compensation that should be used when referencing the Bill Code & Activity Type Assignment table ZHBILLACTVTY.