Difference between revisions of "SAP HCM ABAP DRIVER SIMULATION"
From SapWiki
| (2 intermediate revisions by the same user not shown) | |||
| Line 3: | Line 3: | ||
# It is particularly useful for testing and debugging payroll scenarios. | # It is particularly useful for testing and debugging payroll scenarios. | ||
# To use this function module, follow these steps: | # To use this function module, follow these steps: | ||
| − | + | ## Define the necessary input parameters, such as payroll area, payroll period, and payroll year. | |
| − | + | ## Call the HR_PAYROLL_SIMULATION function module with the defined parameters. | |
| − | + | ## The function module will return the simulation results, which can be analyzed for any discrepancies or errors. | |
# Ensure that the personnel calculation rules are set up correctly to work irrespective of the payroll sequence. | # Ensure that the personnel calculation rules are set up correctly to work irrespective of the payroll sequence. | ||
| + | |||
| + | Básicamente ejecuta la función HR_PAYROLL en modo simulación, que a su vez hace un submit al driver: | ||
| + | <nowiki> | ||
| + | * HR_PAYROLL_SIMULATION | ||
| + | CALL FUNCTION 'HR_PAYROLL_SIMULATION' "Note: 2363022 | ||
| + | EXPORTING | ||
| + | payroll_area = i_abkrs | ||
| + | payroll_period = is_pn-pabrp | ||
| + | payroll_year = is_pn-pabrj | ||
| + | selection_variant = i_variant | ||
| + | log_mem_key = ls_log_mem_key | ||
| + | country_grp = i_molga | ||
| + | obj_iprel = lr_payroll_infotypes | ||
| + | imp_buff = l_imp_buff | ||
| + | prt_prot = i_payroll_protocol | ||
| + | costplanning = i_cost_plan "OHAN156285 | ||
| + | schema = i_schema "RSCN1372226 | ||
| + | rueck_ab = i_rueck_ab "RSCN1728497 "RSCN1778943 | ||
| + | TABLES | ||
| + | employee_numbers = lt_pernr | ||
| + | buffer = et_tbuff[] | ||
| + | buffer_directory = et_buffer_dir[] | ||
| + | EXCEPTIONS | ||
| + | program_not_exist = 1 | ||
| + | variant_not_exist = 2 | ||
| + | missing_parameter = 3 | ||
| + | wrong_parameter = 4 | ||
| + | wrong_country_group = 5 | ||
| + | OTHERS = 6. | ||
| + | . | ||
| + | . | ||
| + | . | ||
| + | CALL FUNCTION 'HR_PL_IMPORT_LOG_FROM_MEMORY' | ||
| + | EXPORTING | ||
| + | mem_key = ls_log_mem_key. | ||
| + | CALL FUNCTION 'HR_PL_DISPLAY_LOG' | ||
| + | EXPORTING | ||
| + | procl = 'C'. | ||
| + | . | ||
| + | . | ||
| + | . | ||
| + | * HR_PAYROLL | ||
| + | * Start the payroll driver. | ||
| + | IF NOT selection_variant IS INITIAL. | ||
| + | SUBMIT (lv_calcname) EXPORTING LIST TO MEMORY | ||
| + | AND RETURN | ||
| + | USING SELECTION-SET selection_variant | ||
| + | WITH SELECTION-TABLE lt_params | ||
| + | WITH pnpindex IN lt_lrange_db_index | ||
| + | WITH pnpxabkr EQ payroll_area | ||
| + | WITH pnppabrp EQ payroll_period | ||
| + | WITH pnppabrj EQ payroll_year | ||
| + | WITH pnpabkrs IN lt_lrange_pay_area | ||
| + | WITH pnppernr IN lt_empty_pnppernr "to overwrite variant values | ||
| + | WITH tst_on EQ tst_on | ||
| + | WITH pa03_off EQ pa03_off | ||
| + | WITH payty EQ payroll_type | ||
| + | WITH payid EQ payroll_id | ||
| + | WITH bondt EQ payroll_date | ||
| + | WITH ocrsn EQ payroll_ocrsn | ||
| + | WITH exp_buff EQ 'X' | ||
| + | WITH imp_buff EQ imp_buff | ||
| + | WITH set_nib EQ 'X' | ||
| + | WITH set_odc EQ off_cycle | ||
| + | WITH upd_ps EQ ' ' | ||
| + | WITH brk_on EQ ' ' | ||
| + | WITH brk_sc EQ ' ' | ||
| + | WITH brk_off EQ 'X' | ||
| + | WITH ecalled EQ 'X' | ||
| + | WITH costplan EQ costplanning | ||
| + | WITH plgmemky EQ log_mem_key | ||
| + | WITH advance = advance_periods[]. | ||
| + | ELSE. | ||
| + | SUBMIT (lv_calcname) EXPORTING LIST TO MEMORY | ||
| + | AND RETURN | ||
| + | WITH SELECTION-TABLE lt_params | ||
| + | WITH pnpindex IN lt_lrange_db_index | ||
| + | WITH pnpxabkr EQ payroll_area | ||
| + | WITH pnppabrp EQ payroll_period | ||
| + | WITH pnppabrj EQ payroll_year | ||
| + | WITH pnpabkrs IN lt_lrange_pay_area | ||
| + | WITH tst_on EQ tst_on "XAIAHRK038127 | ||
| + | WITH pa03_off EQ pa03_off | ||
| + | WITH payty EQ payroll_type | ||
| + | WITH payid EQ payroll_id | ||
| + | WITH bondt EQ payroll_date | ||
| + | WITH ocrsn EQ payroll_ocrsn "XAI | ||
| + | WITH exp_buff EQ 'X' "XUJAHRK002341 | ||
| + | WITH imp_buff EQ imp_buff | ||
| + | WITH set_nib EQ 'X' | ||
| + | WITH set_odc EQ off_cycle | ||
| + | WITH upd_ps EQ ' ' | ||
| + | WITH brk_on EQ ' ' | ||
| + | WITH brk_sc EQ ' ' | ||
| + | WITH brk_off EQ 'X' | ||
| + | WITH ecalled EQ 'X' | ||
| + | WITH costplan EQ costplanning "WOGL9CK040779 | ||
| + | WITH plgmemky EQ log_mem_key "XDOAHRK003361 | ||
| + | WITH advance = advance_periods[]."XAIAHRK011846 | ||
| + | ENDIF. | ||
| + | </nowiki> | ||
==Ejemplo 1 (ojo con la clase cl_hrpay99_fill_infotypes)== | ==Ejemplo 1 (ojo con la clase cl_hrpay99_fill_infotypes)== | ||
Latest revision as of 21:12, 28 June 2026
FM Hr_Payroll_Simulation
- The HR_PAYROLL_SIMULATION function module is used to simulate payroll processing without actually running the payroll.
- It is particularly useful for testing and debugging payroll scenarios.
- To use this function module, follow these steps:
- Define the necessary input parameters, such as payroll area, payroll period, and payroll year.
- Call the HR_PAYROLL_SIMULATION function module with the defined parameters.
- The function module will return the simulation results, which can be analyzed for any discrepancies or errors.
- Ensure that the personnel calculation rules are set up correctly to work irrespective of the payroll sequence.
Básicamente ejecuta la función HR_PAYROLL en modo simulación, que a su vez hace un submit al driver:
* HR_PAYROLL_SIMULATION
CALL FUNCTION 'HR_PAYROLL_SIMULATION' "Note: 2363022
EXPORTING
payroll_area = i_abkrs
payroll_period = is_pn-pabrp
payroll_year = is_pn-pabrj
selection_variant = i_variant
log_mem_key = ls_log_mem_key
country_grp = i_molga
obj_iprel = lr_payroll_infotypes
imp_buff = l_imp_buff
prt_prot = i_payroll_protocol
costplanning = i_cost_plan "OHAN156285
schema = i_schema "RSCN1372226
rueck_ab = i_rueck_ab "RSCN1728497 "RSCN1778943
TABLES
employee_numbers = lt_pernr
buffer = et_tbuff[]
buffer_directory = et_buffer_dir[]
EXCEPTIONS
program_not_exist = 1
variant_not_exist = 2
missing_parameter = 3
wrong_parameter = 4
wrong_country_group = 5
OTHERS = 6.
.
.
.
CALL FUNCTION 'HR_PL_IMPORT_LOG_FROM_MEMORY'
EXPORTING
mem_key = ls_log_mem_key.
CALL FUNCTION 'HR_PL_DISPLAY_LOG'
EXPORTING
procl = 'C'.
.
.
.
* HR_PAYROLL
* Start the payroll driver.
IF NOT selection_variant IS INITIAL.
SUBMIT (lv_calcname) EXPORTING LIST TO MEMORY
AND RETURN
USING SELECTION-SET selection_variant
WITH SELECTION-TABLE lt_params
WITH pnpindex IN lt_lrange_db_index
WITH pnpxabkr EQ payroll_area
WITH pnppabrp EQ payroll_period
WITH pnppabrj EQ payroll_year
WITH pnpabkrs IN lt_lrange_pay_area
WITH pnppernr IN lt_empty_pnppernr "to overwrite variant values
WITH tst_on EQ tst_on
WITH pa03_off EQ pa03_off
WITH payty EQ payroll_type
WITH payid EQ payroll_id
WITH bondt EQ payroll_date
WITH ocrsn EQ payroll_ocrsn
WITH exp_buff EQ 'X'
WITH imp_buff EQ imp_buff
WITH set_nib EQ 'X'
WITH set_odc EQ off_cycle
WITH upd_ps EQ ' '
WITH brk_on EQ ' '
WITH brk_sc EQ ' '
WITH brk_off EQ 'X'
WITH ecalled EQ 'X'
WITH costplan EQ costplanning
WITH plgmemky EQ log_mem_key
WITH advance = advance_periods[].
ELSE.
SUBMIT (lv_calcname) EXPORTING LIST TO MEMORY
AND RETURN
WITH SELECTION-TABLE lt_params
WITH pnpindex IN lt_lrange_db_index
WITH pnpxabkr EQ payroll_area
WITH pnppabrp EQ payroll_period
WITH pnppabrj EQ payroll_year
WITH pnpabkrs IN lt_lrange_pay_area
WITH tst_on EQ tst_on "XAIAHRK038127
WITH pa03_off EQ pa03_off
WITH payty EQ payroll_type
WITH payid EQ payroll_id
WITH bondt EQ payroll_date
WITH ocrsn EQ payroll_ocrsn "XAI
WITH exp_buff EQ 'X' "XUJAHRK002341
WITH imp_buff EQ imp_buff
WITH set_nib EQ 'X'
WITH set_odc EQ off_cycle
WITH upd_ps EQ ' '
WITH brk_on EQ ' '
WITH brk_sc EQ ' '
WITH brk_off EQ 'X'
WITH ecalled EQ 'X'
WITH costplan EQ costplanning "WOGL9CK040779
WITH plgmemky EQ log_mem_key "XDOAHRK003361
WITH advance = advance_periods[]."XAIAHRK011846
ENDIF.
Ejemplo 1 (ojo con la clase cl_hrpay99_fill_infotypes)
Simular existencia de Infotipos en driver nomina RPCALCX0
*Tables for intermediate memory mngmt.
types: begin of hroct_iprel,
pernr like p0001-pernr,
infty like p0001-infty,
idata like prelp occurs 0,
end of hroct iprel.
data: begin of mem id_iprel,
pernr like p0001-pernr,
value (5) value 'IPREL',
end of mem_id_iprel.
"Memory ID for infotypes
data: obj_iprel type ref to cl_hrpay99_fill_infotypes.
*objects for infotype simulation
data: send_it type ref to cl_hrpay99_send_infotypes,
iprel type hrpay99_iprel_table.
IF obj_iprel IS INITIAL.
CREATE OBJECT obj_iprel.
ENDIF.
if p_flag ='X'.
*read & send infotype 0014 to memory for the process of simulation
*of the payroll driver RPCALCX0
perform fill_iperl_i0014.
else.
clear retro date.
endif.
if not obj_iprel is initial.
* create object for infotype simulation
create object send_it.
* fill iprel from importing parameter
iprel = obj_iprel->get_iprel( ).
* fill send_it from table iprel
call method send_it->set_iprel( iprel ).
* send infotype object to memory
call method send_it->send_all.
endif.
submit rpcalcx0
using selection-set variant_calc
**** using selection-sets of program 'HARCALC0'
using selection-sets of program 'RPCALCX0'
with pnppernr eq fired_employees_line-pernr
with pnpxabkr eq fired_employees_line-abkrs
with pnpabkrs eq fired_employees_line-abkrs
with pnptimr9 eq space
with pnptimra eq 'X'
* WITH pnppabrp EQ fired_employees_line-pabrp "M29
* WITH pnppabrj EQ fired_employees_line-pabrj "M29
with pnppabrp eq gd_pabrp "M29
with pnppabrj eq gd_pabrj "M29
with payty eq fired_employees_line-payty
* WITH bondt EQ fired_employees_line-bondt "M29
* WITH ocrsn EQ fired_employees_line-ocrsn "M29
with bondt eq gd_bondt "M29
with ocrsn eq gd_ocrsn "M29
* with test_on eq ' '
with tst_on eq 'X'
with prt_prot eq 'X'
with sw_spool eq space " Print to spool
* with edt_vari eq variant_cedt " Show payslip
with edt_vari eq variant_cedt " Show payslip
with ecalled eq 'X'
with set_nib eq 'X'
with set_odc eq 'X'
with upd_ps eq space
with exp_buff eq 'X'
with imp_buff eq space
* with brk_on eq ' '
* with brk_sc eq ' '
* with brk_off eq 'X'
with plgmemky eq memo_key
with rueck-ab = retro_date "M19
exporting list to memory
and return.
form fill_iperl_10014.
data: begin of help i0014 occurs 5.
include structure p0014.
data: end of help i0014.
*fill iprel with all infotypes
clear iprel.
*refresh iprel.
if p9902-zzbasetri > 0.
****************************************
* RP-READ-INFOTYPE *
****************************************
* PARAMETERS: *
* PERNR REQUESTED PERSONALNUMBER*
* INFTY REQUESTED INFOTYPNUMBER *
* INFTY-TABLE OUTPUT-TABLE LIKE PNNNN*
* BEGDA REQUESTED INTERVAL-BEGIN*
* ENDDA REQUESTED INTERVAL-END *
****************************************
*read all the 0014 records for put in memory
perform read-infotype(sapdbpnp)
tables help_10014
using p9902-pernr '0014' '18000101' '99991231'.
*distribution of the p9902-zzbasetri ammount in IT0014 records
perform create_10014 tables help_10014
using p9902
p9902-zzbasetri
p9902-waers.
*Put the IT0014 records in internal object for send it
*to memory
call method obj_iprel->insert(help_10014[] ).
endif.
endform. "fill_iperl_10014
Ojo en driver RPCALCX0 los infotipos simulados se procesan en include RPCHRT09
get pernr.
if ecalled = 'X'. "XAIAHRK001447
* read infotypes from memory (for infotype simulation)
perform get_iprel using pernr-pernr. "XAIAHRK001447