Tip 1: As part of conversions load, if you had migrated historical infotype records from legacy on-premise HCM system into EC Payroll using an HR Data Cloning Utility (such as, NEXUS Suite by TIK as was done in my project), you would have to also load the key mapping table for all of these legacy PERNRs before you switch on the replications. If you don't, employee replication will result in these errors: Person already hired (PG 002) or External PERNR &1 is already hired. Please check longtext. (HRSFEC_SERVICES 285).
Tip 2: You may request your EC team to build a report in EC, or have CPI team build an integration iFlow to query EC and generate the above data as a file, with an additional Payroll Area column. Payroll Area addition would come handy, as ECP shall go live by pay area and you would want to limit your PERNR Mapping Table uploads to only the go-live population. You may enter any date for Work Agreement ID for your initial load (e.g., 19000101) without having to determine the true hire or termination date.
* LOGIC:
* 1. Processing is only for rehire scenario.
* 2. Confirm that the employee is first time rehire of a converted term.
* 3. Set the PERNR's FTSD as the job information start date.
DATA: ls_ptp_config TYPE zcl_hrsfec_ce_itmap_helper=>ts_ptp_config.
DATA: lv_endda TYPE sy-datum.
DATA: lt_pnnnn TYPE hrpay99_prelp_table,
lt_prelp TYPE prelp_tab.
DATA: lt_p0000 TYPE STANDARD TABLE OF p0000 WITH DEFAULT KEY.
DATA: lx_root TYPE REF TO cx_hrsfec_root,
lv_dummy TYPE string,
ls_msg TYPE symsg.
DATA: lv_person_id_external TYPE pad_sfec_employment_id_v2.
DATA: lv_pernr TYPE pernr-pernr.
DATA: ls_pn_ftsd TYPE hrsfec_pn_ftsd.
DATA: lt_job_info TYPE pad_sfec_ce_job_info_tab.
"Confirm it's not a new hire.
IF NOT cv_new_hire IS INITIAL.
RETURN.
ENDIF.
ls_ptp_config = mo_itmap_helper->get_ptp_config( ).
LOOP AT is_person-employment_information ASSIGNING FIELD-SYMBOL(<ls_emp_info>)
WHERE employment_id = iv_employment_id.
"Fetch PERNR from User ID field
lv_pernr = <ls_emp_info>-user_id.
IF lv_pernr IS INITIAL.
RETURN. "Pernr not found
ENDIF.
"Check if the employee's PERNR already has a FTSD override.
SELECT SINGLE * INTO ls_pn_ftsd
FROM hrsfec_pn_ftsd WHERE pernr = lv_pernr.
IF sy-subrc EQ 0.
RETURN. "No need to proceed further
ENDIF.
"Sort Job Info
CLEAR lt_job_info.
lt_job_info = <ls_emp_info>-job_information.
SORT lt_job_info BY start_date end_date. "Sort chronologically.
"Ensure we have the employment information which contains the job info we are processing.
READ TABLE lt_job_info TRANSPORTING NO FIELDS
WITH KEY end_date = is_job_information-end_date
start_date = is_job_information-start_date
company = is_job_information-company.
IF sy-subrc NE 0.
CONTINUE.
ENDIF.
"Process in chronological sequence of the Job Info portlet records.
LOOP AT lt_job_info ASSIGNING FIELD-SYMBOL(<ls_job_info>).
"Skip if record is prior to or on FTSD date
"NOTE: If the Rehire happens on the FTSD date, there is no need to override.
IF <ls_job_info>-start_date LE ls_ptp_config-full_trans_start_date.
CONTINUE.
ENDIF.
"Rehire Event check
IF <ls_job_info>-event NE 'R'.
EXIT. "Should only proceed if the very first event after FTSD is Rehire Event.
ENDIF.
"Fetch all of infotype 0 records between FTSD and 1 day prior to Job Information Start Date.
lv_endda = <ls_job_info>-start_date - 1.
CLEAR: lt_p0000, lt_pnnnn, lt_prelp.
TRY.
CALL METHOD cl_hrsfec_service_lib=>itf_read_all_it
EXPORTING
iv_pernr = lv_pernr
iv_infty = '0000'
io_message_handler = io_messsage_handler
iv_from_date = ls_ptp_config-full_trans_start_date
iv_to_date = lv_endda
IMPORTING
et_pnnnn = lt_pnnnn.
CATCH cx_hrsfec_root INTO lx_root.
CLEAR lx_root.
EXIT. "Quit the loop
ENDTRY.
"Convert to infotype 0 structure.
IF NOT lt_pnnnn IS INITIAL.
APPEND LINES OF lt_pnnnn TO lt_prelp.
CALL METHOD cl_hr_pnnnn_type_cast=>prelp_to_pnnnn_tab
EXPORTING
prelp_tab = lt_prelp
IMPORTING
pnnnn_tab = lt_p0000.
SORT lt_p0000 BY begda.
CLEAR: lt_pnnnn, lt_prelp.
ENDIF.
"There should be exactly 1 record present, which is a term record.
DESCRIBE TABLE lt_p0000 LINES sy-tfill.
IF sy-tfill NE 1. "Expect exactly 1 record
EXIT. "Quit the loop
ENDIF.
"That record should be of term status.
READ TABLE lt_p0000 ASSIGNING FIELD-SYMBOL(<ls_p000>) INDEX 1.
CASE <ls_p000>-stat2.
WHEN '0' "Withdrawn
OR '2'. "Retiree
WHEN OTHERS.
EXIT. "Quit the loop
ENDCASE.
"Have Individual FTSD override
ev_full_trans_start_date = <ls_job_info>-start_date.
"Note: Subsequent standard replication process shall update the
" table hrsfec_pn_ftsd with this FTSD value for the PERNR.
EXIT. "We got what we wanted. Done with the loop.
ENDLOOP. "AT lt_job_info
ENDLOOP. "AT is_person-employment_information
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
6 | |
3 | |
3 | |
2 | |
2 | |
1 | |
1 | |
1 | |
1 | |
1 |