Vous êtes sur la page 1sur 11

Creating Payroll Operation

By SaiKumar B,HCL Technologies

T.Code PE04 to create a Payroll function


Save and active the payroll Function.

In the Payroll driver program,


In the include PCBRZIN0 we can write our custom code in two ways

 By using Enhancements spots

 By using access key

Here we are seeing by using enhancements spots.


Select Show implements enhancement options
Place the cursor on the spot and select Create implementation (Edit->Enhancement operation->Create
Implementation).
Create Enhancement implementation.
A spot will be created to write our custom code.

Add Form here

*&---------------------------------------------------------------------*
*& Include PCBURZIN0 *
*&---------------------------------------------------------------------*
* Use this include to create customer specific functions and operations
* Attention: SAP Developers
* Never change or transport this include in SAP systems
"""""""""""""""""""""""""""""""""""$"$\SE:(1) Include PCBURZIN0, *$*$-Start: 9999--------------------------------
---------------------------$*$*
ENHANCEMENT 1 ZHR_PAY_ENCHANCEMENT. "inactive version
form OPZ_WAG.
CONSTANTS : c_l TYPE char1 VALUE 'L',
c_E TYPE char1 VALUE 'E',
c_y TYPE char1 VALUE 'Y',
c_n TYPE char1 VALUE 'N'.

DATA : wa_hrvar TYPE hrvar,


wa_it TYPE PC207,
wa_ot TYPE PC207,
wa_lrt TYPE pc26y,
wa_rt TYPE PC207.

case op-modif .
when space.
*Get records corresponding to wage type specified in the
*operation (OP-LGART) from Input Table (IT)
READ TABLE it INTO wa_it WITH KEY lgart = op-lgart.
if sy-subrc = 0.
VARGT = c_y.
else.
VARGT = c_n.
ENDIF.

when c_l.
*Get records corresponding to wage type specified in the
*operation (OP-LGART) from Last Results Table (LRT)
READ TABLE lrt INTO wa_lrt WITH KEY lgart = op-lgart.
if sy-subrc = 0.
VARGT = c_y.
else.
VARGT = c_n.
ENDIF.

when c_E.
*Get records corresponding to wage type specified in the
*operation (OP-LGART) from Results Table (RT)
READ TABLE rt INTO wa_rt WITH KEY lgart = op-lgart.
if sy-subrc = 0.
VARGT = c_y.
else.
VARGT = c_n.
ENDIF.

WHEN '&'.
*Get records corresponding to wage type specified in the
*operation (OP-LGART) from Variables Table (VAR)
READ TABLE var INTO wa_hrvar WITH KEY lgart = op-lgart.
if sy-subrc = 0.
VARGT = c_y.
else.
VARGT = c_n.
ENDIF.

WHEN 'O'.
*Get records corresponding to wage type specified in the
*operation (OP-LGART) from OT
READ TABLE ot INTO wa_ot WITH KEY lgart = op-lgart.
if sy-subrc = 0.
VARGT = c_y.
else.
VARGT = c_n.
ENDIF.
ENDCASE.
* Update Variable Key using Standard Sub-routine FILLVARGT.
PERFORM FILLVARGT.
ENDFORM.

ENDENHANCEMENT.
*$*$-End: 9999-------------------------------------------------$*$*

Here is the screen shot, inserted payroll function in a PCR.