Evaluate Indirect Wage amounts using FM RP_EVALUATE_INDIRECTLY_P0008

Indirect Evaluation is a method to calculate the eligible amounts for some of the wage types. INVAL is the Indirect Evaluation Module used to meet the Indian specific business requirements. INVAL calculates the eligible amounts for certain wage types that are defaulted into the Basic Pay infotype (0008) or entered in the Recur. Payments/Deductions infotype (0014) and the Additional Payments infotype (0015)

Instead of, computing the eligibility as a currency value amount, INVAL can also calculate the eligibility in terms of numbers, if the wage type has been configured accordingly. For example, an employee can be eligible for 70 liters of petrol.

Following ABAP Code is purpose to get Indirect Wage Amount. 

REPORT zevaluate_indirectly.
*———————————————————————-*
* Data declarations
*———————————————————————-*
DATA: BEGIN OF tbindbw OCCURS 0,
seqnr(3) TYPE c.
INCLUDE STRUCTURE ptbindbw.
DATA: END OF tbindbw.
DATA: BEGIN OF wage,
lgart TYPE p0008-lga01,
betrg TYPE p0008-bet01,
END OF wage,
BEGIN OF indbw,
indbw TYPE p0008-ind01,
END OF indbw.
DATA: p0001 TYPE TABLE OF p0001 WITH HEADER LINE,
p0007 TYPE TABLE OF p0007 WITH HEADER LINE,
p0008 TYPE TABLE OF p0008 WITH HEADER LINE,
v_infty TYPE p0001-infty,
v_number(2) TYPE p ,
v_seqnr(3) TYPE c,
v_endda TYPE p0000-endda,
v_molga TYPE t001p-molga.

*–Selection screen
PARAMETERS : p_pernr LIKE pa0001-pernr.
*———————————————————————-*
* START OF SELECTION
*———————————————————————-*
START-OF-SELECTION.
*– Get data
PERFORM get_data.
*– Get Indirect wage type amounts
PERFORM get_indirect.
*———————————————————————-*
* END OF SELECTION
*———————————————————————-*
END-OF-SELECTION.
*– Write data
PERFORM write_data.
*———————————————————————-*
* FORMS
*———————————————————————-*
*&———————————————————————*
*& Form GET_DATA
*&———————————————————————*
* Get data from PA0001 , PA0007 , PA0008
*———————————————————————-*
FORM get_data .
v_infty = ‘0001’.
CALL FUNCTION ‘HR_READ_INFOTYPE’
EXPORTING
pernr = p_pernr
infty = v_infty
begda = ‘18000101’
endda = ‘99991231’
TABLES
infty_tab = p0001.
v_infty = ‘0007’.
CALL FUNCTION ‘HR_READ_INFOTYPE’
EXPORTING
pernr = p_pernr
infty = v_infty
begda = ‘18000101’
endda = ‘99991231’
TABLES
infty_tab = p0007.
v_infty = ‘0008’.
CALL FUNCTION ‘HR_READ_INFOTYPE’
EXPORTING
pernr = p_pernr
infty = v_infty
begda = ‘18000101’
endda = ‘99991231’
TABLES
infty_tab = p0008.
ENDFORM. ” GET_DATA
*&———————————————————————*
*& Form GET_INDIRECT
*&———————————————————————*
* Get Indirect wage type amounts
*———————————————————————-*
FORM get_indirect .
CLEAR tbindbw.
REFRESH tbindbw.
v_seqnr = 1.
CALL FUNCTION ‘RP_NUMBER_OF_WAGETYPES_0008’
IMPORTING
wt_count = v_number.
DO v_number TIMES VARYING wage-lgart FROM p0008-lga01
NEXT p0008-lga02
VARYING indbw-indbw FROM p0008-ind01
NEXT p0008-ind02.
IF wage-lgart NE space.
MOVE v_seqnr TO tbindbw-seqnr.
MOVE-CORRESPONDING wage TO tbindbw.
MOVE-CORRESPONDING indbw TO tbindbw.
APPEND tbindbw.
v_seqnr = v_seqnr + 1.
ELSE.
EXIT.
ENDIF.
ENDDO.
READ TABLE p0001 WITH KEY pernr = p_pernr.
READ TABLE p0007 WITH KEY pernr = p_pernr.
READ TABLE p0008 WITH KEY pernr = p_pernr.
*– Get Molga
SELECT SINGLE molga FROM t001p INTO v_molga
WHERE werks = p0001-werks
AND btrtl = p0001-btrtl.
CALL FUNCTION ‘RP_EVALUATE_INDIRECTLY_P0008’
EXPORTING
ppernr = p_pernr
pmolga = v_molga
pbegda = p0008-begda
pp0001 = p0001
pp0007 = p0007
pp0008 = p0008
IMPORTING
pendda = v_endda
TABLES
ptbindbw = tbindbw
EXCEPTIONS
error_at_indirect_evaluation = 1.
ENDFORM. ” GET_INDIRECT
*&———————————————————————*
*& Form WRITE_DATA
*&———————————————————————*
* Write data
*———————————————————————-*
FORM write_data .
WRITE :/1 ‘Wage type’ ,
36 ‘Amount’.
LOOP AT tbindbw WHERE indbw <> ”.
WRITE :/1 tbindbw-lgart ,
20 tbindbw-betrg .
ENDLOOP.
ENDFORM. ” WRITE_DATA

Was this article helpful?

Related Articles

Leave A Comment?

You must be logged in to post a comment.