Ansicht
Dokumentation

HRSFEC_DEC_HIRE_REHI - BAdI: Specify Action: Hire or Rehire

HRSFEC_DEC_HIRE_REHI - BAdI: Specify Action: Hire or Rehire

Vendor Master (General Section)   Addresses (Business Address Services)  
This documentation is copyright by SAP AG.
SAP E-Book

Use

This Business Add-In (BAdI) is used for the integration between SuccessFactors Employee Central and SAP ERP HCM. There are various use cases for this BAdI. Two example implementations are provided.

Note that the BAdI will overwrite the automatically determined standard decision of whether a new personnel number should be pulled or not.

Method: IF_HRSFEC_DECIDE_HIRE_REHIRE~ DECIDE_HIRE_REHIRE

In this case you implement the BAdI to determine whether replicated employee master data should lead to a new personnel number (pernr), meaning, the action hire is either executed or not. Standard SAP implementation creates a personnel number (pernr) per company code (bukrs); therefore, a change in the Job Information history with a new company assignment leads to the creation of a new personnel number unless the two Employee Central legal entities are mapped to the same company code.

The delivered example implementation CL_HRSFEC_DECIDE_HIRE_REHIRE decides if a rehire has to take place based on the country code (molga). As long as the organizational data of the employee leads to an infotype 0001 record for the same country code, the existing personnel number for that country code (molga) is reused, otherwise a new personnel number (pernr) is created.

In this case, you implement the BAdI to check if an employee to be hired already exists in the SAP ERP system. This is important to avoid the creation of (event: hire) employees that you would normally only have to rehire, because they already exist in the system. This might happen if the SAP ERP system was the legacy system in the past and, in the meantime, Employee Central has become the leading system. If an employee was hired in the SAP ERP system before the system switch and was inactive at the time of the switch and is now being hired in the Employee Central system, the system will not automatically treat this as a rehire, thereby creating unnecessary duplicates.

The delivered example implementation CL_HRSFEC_REHIRE_DUPLICATE checks if the employee replicated from Employee Central to the SAP ERP system already exists on the SAP ERP side. If a duplicate is found, an error message is generated saying that the event reason in Employee Central needs to be changed to:

  • REHIREDUPL: if this employee should be rehired, or to
  • IGNOREDUPL: if the found duplicate should be ignored and the transferred employee should be hired as a new employee.

A key mapping entry is created for the found duplicate to simulate the employee's existence on the Employee Central side and to assign the two personnel numbers (pernr) to the same person (CP).

The duplicate check uses the attributes first name, last name, birth date, and gender. If the employee's country is USA, the Social Security Number (perid)is used in addition. This duplicate check expects to only find either one or no duplicates. If the check finds multiple duplicates, an error message is generated accordingly.

Requirements

Standard settings

There is no standard implementation for this BAdI.

For more information about the standard settings (filters, single, or multiple uses), see the Enhancement Spot Element Definitions tab in the BAdI Builder (transaction SE18/SE20).

Activities

The BAdI method interface contains the following data that identifies the employee master data record:

  • Employee ID: IV_EMPLOYEE_ID
  • Person UUID : IV_PERSON_UUID
  • Employment ID: IV_EMPLOYMENT_ID
  • External Employee ID: IV_EMPLOYEE_ID_EXTERNAL
  • User ID: IV_USER_ID
  • Work Agreement data: IS_WORKAGREEMENT
  • National ID details (optional): IT_NATIONAL_ID
  • Personal details (optional): IT_PERSONAL_DETAILS
  • Reference to message handler: IO_MESSSAGE_HANDLER
  • Reference to key mapping handler: IO_EE_KEY_MAPPING

You can use this data irrespective of whether an employee master data record leads to a new personnel number (pernr) or not.

If you want the employee master data record to lead to a new personnel number, set these change parameters to the following values:

  • CV_NEW_HIRE --> ABAP_TRUE
  • CV_PERNR --> 00000000

If you want the employee master data record to lead to an already existing personnel number, set these change parameters to the following values:

  • CV_NEW_HIRE --> ABAP_FALSE
  • CV_PERNR --> The personnel number of your choice.

Important:

  • It is not advised to create new personnel numbers (pernr) with a finer granularity than the standard SAP coding, which is one personnel number (pernr) per employment and company code (bukrs).
  • Even if the BAdI implementation returns cv_new_hire = ABAP_FALSE and in cv_pernr a pernr to be re-used, it might not be possible to actually use this pernr to store the employee data. The changes in infotype 0001 might be such that normal SAP ERP logic requires a new personnel number (pernr), for example when the country code (molga)changes. This will result in a replication failure and will generate error messages in the log.
  • Do not try to combine data for distinct employment records into one personnel number (pernr). This will result in data inconsistencies because Employee Central keeps separate sets of data for Job Information, Compensation Information, and so on, per employment. This BAdI is relevant for new personnel numbers created by changes in the Job Information history only. If a new employment object is created in Employee Central (by Global Assignment, Pension Payout, or Concurrent Employment functionality), then a new personnel number (pernr) is needed regardless of Job Information details.
  • As can be seen in CL_HRSFEC_REHIRE_DUPLICATE, the parameter io_ee_key_mapping provides the possibility to simulate inactive employees' existence by creating key mapping entries so that the system can recognize duplicates. Be careful to follow the example implementation closely.

For more information about how to implement BAdIs in the Enhancement Framework, see SAP NetWeaver Library and choose Function-Oriented View -> Application Server -> Application Server ABAP -> Application Development in AS ABAP -> ABAP Customer Development -> Enhancement Framework.

Example

The delivered example implementation CL_HRSFEC_DECIDE_HIRE_REHIRE decides if a rehire has to take place based on the country code (molga). As long as the organizational data of the employee leads to an infotype 0001 record for the same country code, the existing personnel number for that country code (molga) is reused, otherwise a new personnel number (pernr) is created.

The delivered example implementation CL_HRSFEC_REHIRE_DUPLICATE checks if the employee replicated from Employee Central to the SAP ERP system already exists on the SAP ERP side. If a duplicate is found, an error message is generated saying that the event reason in Employee Central needs to be changed to:

  • REHIREDUPL: if this employee should be rehired, or to
  • IGNOREDUPL: if the found duplicate should be ignored and the transferred employee should be hired as a new employee.

A key mapping entry is created for the found duplicate to simulate the employee's existence on the Employee Central side and to connect the two personnel number (pernr) for the specific person.

The duplicate check uses the attributes first name, last name, birth date, and gender. If the employee's country is USA, the Social Security Number (perid) is used in addition. This duplicate check expects to only find either one or no duplicates. If the check finds multiple duplicates, an error message is generated accordingly.

If you require both use cases in your company, you can combine the two implementations by adding the coding of use case 1 at the end of the coding of use case 2.






Vendor Master (General Section)   Vendor Master (General Section)  
This documentation is copyright by SAP AG.

Length: 8804 Date: 20240523 Time: 211644     sap01-206 ( 168 ms )