Steps to create Z Operation:-
Step1:- Go to Transaction PE04 and create an operation "ZOPRT", as follows:-
Here the VkeyT is a variable type of return parameter and VkeyLngth is the length of this variable , it could be 2 or 3 or 4 or any value.
Step2:- Now create the subroutine in customer program of respective payroll driver.
The include which contains all Operations is PCASFXX0 where XX is a country key for INDIA its IN, for International its TH
Step3:- Once the subroutine is created paste this code into the OPERATIONS.
DATA : w_p0015 type P0015, --> mention all the structures you wanted to use
w_p0014 type P0014,
w_p0040 type P0040,
w_it TYPE pc207,
v_LEIHG type LEIHG.
"Suppose we wanted to query IT40 for Objects on loan and accordingly wanted to returnt values in filed "VARGT" so that a decision can be taken in PCR
<<Write the logic or query an field to get its value and accordingly return>>
<<Suppose if LEIGH = 0001 then VARGT = 1 >>
IF v_LEIGH = 'COMP'.
VARGT = 1. --> standard return parameter
PERFORM fillvargt. --> this is a standard perform to fill the return parameter.
ENDIF.
IF v_LEIGH = 'MOBI'.
VARGT = 2. --> standard return parameter
PERFORM fillvargt. --> this is a standard perform to fill the return parameter.
ENDIF.
<<Similarly other such conditions can be written>>
<<In case you wanted to update any numeric value in IT table then use "OT-betpe" it will update the amount filed of current wage type>>
Step 4:- And finally this operation can be called in any PCR was follows:-
Thanks,
Rohit
Do let me know if anyone needs more clarification related to this .