You are on page 1of 5

FUNCTIONAL DESCRIPTION:

When the person numbering method is automatic, Oracle HRMS allocates numbers for a
person type (employees, contingent workers, or applicants) from a single local or global
sequence.

You can write a formula of type Person Number Generation to generate a custom
number sequence in place of the default sequence. Once you have defined and validated a
formula, Oracle HRMS executes the formula whenever automatic person numbering is active
and a person number is required.

Change Person Numbering to Automatic Changed a business group from Manual


numbering for the selected Person Type, that being Applicant, Contingent Worker, or
Employee to automatic. This process checked for maximum person number of the selected
type and added one to this number then set this new value as the NEXT number in the
sequence. BUT still within a single Business Group.

Change automatic person number generation to global sequencing Again this


process checked for the next highest value in the selected sequence, but now, this sequence
would be applied ALL business groups within your organization. Now you now longer would
have the same employee in all three of your business groups. Once you went to Global
Numbering however, there was no way to go back to Automatic or Manual without the
possibility of causing duplicate numbers being entered and causing errors.

Note: Custom Person Number Generation Fast Formula will ONLY be called if the
Organization / Business Group numbering is set to Automatic. If the numbering is set to
Manual, the fast formula will not be called.

CONDITIONS
1. Formulas must be defined in Setup Business Group
2. Formula Type must be Person Number Generation
3. The formula names for the Person Number Generation type SHOULD be:
a. EMP_NUMBER_GENERATION (for employee numbers)
b. APL_NUMBER_GENERATION (for applicant numbers)
c. CWK_NUMBER_GENERATION (for contingent worker numbers)

FORMULA CONTEXT
The formula has only one context value Business Group ID

FORMULA INPUTS
1. Legislation Code
2. Person Type
3. Person Number(*)
4. Party ID
5. Person ID(*)
6. Date of Birth
7. Start Date
8. National Identifier.
Note: (*) Value is null when creating person records.

FORMULA OUTPUTS
1. Next Person Number
2. Message

Steps 1: Create a database sequence called CUST_NUMB


SQL> CREATE SEQUENCE CUST_NUMB
START WITH 1000
INCREMENT BY 1
NOCYCLE;
Note: 1000 should be replaced by the start number required

Steps 2: Create synonym for the sequence for user HR


SQL> CREATE OR REPLACE SYNONYM HR.CUST_NUMB FOR APPS.CUST_NUMB;

Steps 3: Create package/function to return toe number; this function will include all your
business requirements

Note: Do not change the function parameters nor the output

/**************************************
BEGIN GET_CUSTOM_NUMBER
**************************************/
/********************************************************************
Create By : APPSLINK
Creation Date : 14-FEB-2012
Purpose : Returns Custom Employee
Used From : Person Number Generation Formula
Modified By :
Modify Date :
*********************************************************************/

FUNCTION get_custom_number(p_business_group_id IN NUMBER


,p_legislation_code IN VARCHAR2
,p_person_type IN VARCHAR2
,p_person_number IN VARCHAR2
,p_party_id IN NUMBER
,p_person_id IN NUMBER
,p_national_id IN VARCHAR2
,p_date_of_birth IN DATE) RETURN VARCHAR2 IS
--
CURSOR person_exists IS
-- We need to see if this person already exists in the system
--
SELECT employee_number
,applicant_number
,npw_number
FROM per_all_people_f
WHERE party_id = p_party_id
AND SYSDATE BETWEEN effective_start_date AND effective_end_date;
--
l_seq_num NUMBER;
l_next VARCHAR2(30);
l_emp_num NUMBER;
l_apl_num NUMBER;
l_npw_num NUMBER;
--
BEGIN
OPEN person_exists;
FETCH person_exists
INTO l_emp_num
,l_apl_num
,l_npw_num;
IF person_exists%NOTFOUND
THEN
-- no match was found, therefore use our custom sequence
-- append the first 3 characters of the national identfier
SELECT cust_numb.nextval INTO l_seq_num FROM dual;
l_next := to_char(l_seq_num
,'FM0000009');
RETURN l_next;

ELSE
-- a match was found, therefore return existing person number
IF p_person_type = 'EMP'
THEN
l_next := l_emp_num;
ELSIF p_person_type = 'APL'
THEN
l_next := l_apl_num;
ELSIF p_person_type = 'CWK'
THEN
l_next := l_npw_num;
END IF;
END IF;
CLOSE person_exists;
RETURN l_next;
--
END get_custom_number;
/**************************************
BEGIN GET_CUSTOM_NUMBER
**************************************/
Step 4: Register external function in Setup Business Group
(Login to Setup Business Group -> Other Definitions -> Formula Functions)

Name = GET_CUSTOM_NUMBER
Data Type = TEXT
Class = EXTERNAL FUNCTION
Alias Name = NULL
Description = Returns the next custom number value
Definition = APPSLINK_HR_PACKAGE.GET_CUSTOM_NUMBER

Click on Context Usages Button


Number = 1
Contract Name = BUSINESS_GROUP_ID
Data Type = NUMBER

Click on Parameters Button


SEQ Parameter Name Type Class
1 P_LEGISLATION_CODE Text Input only
2 P_PERSON_TYPE Text Input only
3 P_PERSON_NUMBER Text Input only
4 P_PARTY_ID Number Input only
5 P_PERSON_ID Number Input only
6 P_NATIONAL_ID Text Input only
7 P_DATE_OF_BIRTH Date Input only

Step 4: Write Formula in Setup Business Group


(Login to Setup Business Group -> Total Compensation -> Basic -> Write Formula)
Effective Date Formula Name Type
01-JAN-1900 EMP_NUMBER_GENERATION Person Number Generation

/*FORMULA NAME : EMP_NUMBER_GENERATION


* FORMULA PURPOSE : Global Employee Numbering
* FORMULA TYPE : Person Number Generation
* CREATE BY : APPSLINK Consulting
* CREATION DATE : 14-FEB-2012
* Source Formula : N/A
* Version : 1.0
****************************************************************
* MODIFIED BY :
* MODIFICATION DATE :
* CHANGE DESCRIPTION :
* Version :
****************************************************************/
DEFAULT FOR PERSON_NUMBER IS ' '
DEFAULT FOR PARTY_ID IS 0
DEFAULT FOR PERSON_ID IS 0
DEFAULT FOR NATIONAL_ID IS ' '
DEFAULT FOR DATE_OF_BIRTH IS '1900/01/01 00:00:00' (DATE)
DEFAULT FOR HIRE_DATE IS '1900/01/01 00:00:00' (DATE)

INPUTS ARE LEGISLATION_CODE (TEXT),


PERSON_TYPE (TEXT),
PERSON_NUMBER (TEXT),
PARTY_ID,
PERSON_ID,
DATE_OF_BIRTH (DATE),
HIRE_DATE (DATE),
NATIONAL_ID (TEXT)

NEXT_NUMBER = '0'
INVALID_MSG = ' '

IF PERSON_TYPE = 'EMP'
THEN
(
NEXT_NUMBER = GET_CUSTOM_NUMBER(LEGISLATION_CODE
,PERSON_TYPE
,PERSON_NUMBER
,PARTY_ID
,PERSON_ID
,NATIONAL_ID
,DATE_OF_BIRTH)
)
ELSE
INVALID_MSG = 'This is not an person_type of Employee!'

RETURN NEXT_NUMBER,INVALID_MSG

You might also like