You are on page 1of 11

Subject:How To Implement Custom Person Numbering

Using FastFormula
  Doc ID:Note:279458.1 Type:HOWTO
Last Revision Status:
  05-MAY-2006 PUBLISHED
Date:

In this Document
  Goal
  Solution
  References

Applies to:

Oracle Human Resources - Version: 11.5.9


Information in this document applies to any platform.

Goal

Two Questions about Custom Person Numbering to be released in HR-PF.H

1) Can I get a BackPort / One-Off to HR-PF.G?

2) Can you supply information on how to implement this for when it is released?

Solution

Here are the current answers from Support:

1) While this is new functionality and is released in a Family Pack it is also


available in Patch 3583096 for HR-PF.G installations

2) Please review the Readme for Patch 3583096 or the What New for Family
Pack H documents on MetaLink for some information.

Please Review the Readme for Patch 3583096 or the "What's New in Family
Pack H",
both available from MetaLink.

Here is an excerpt from the patch readme:

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.

The formula names for the Person Number Generation type are:

EMP_NUMBER_GENERATION (for employee numbers)


APL_NUMBER_GENERATION (for applicant numbers)
CWK_NUMBER_GENERATION (for contingent worker numbers)

You can define only one formula for each person type.
You must define person number generation formulas in the setup business
group, and they must have the names shown here.

They have no effect if you define them in any other business group or if you do
not use the specified names.

The formula context value is Business Group ID.

The formula INPUTS are:


Legislation Code, Person Type, Person Number(*), Party ID, Person ID(*),
Date of Birth, Start Date, and National Identifier.

(*) Value is null when creating person records.

The formula OUTPUTS are:


Next Person Number, Message

3) Here is some sample information that should help get you going:

href="./ImplementingCustomPersonNumbering_files/filelist.xml">

Implementing
CUSTOM PERSON NUMBER GENERATION USING FAST FORMULAS

First, we should visit person numbering in general as used within the Oracle
HRMS suite.

Historically in the 10.x and 11.0.x Oracle HRMS suite, Applicant and Employee
were controlled through the Business Group under the navigation:
Work Structures > Organization > Classifications section > *Business Group
Information selection > Others button.
Now In 11.5.x Contingent worker number as also been added.
These choices controlled numbering ONLY within that specific Business Group.

The choices available were Manual, Automatic, National Identifier, or based on a


sequence for contingent workers. The only problem with this scheme is the same
number would exist in multiple Business groups within a multi-business group
organization.

Example: Your organization has Business Groups In the US, UK, and Japan.

A Person entered into the US could have employee number 1201; a person
entered into the UK could ALSO have Employee number1201, and the same for
the Japanese business group.

← Manual – When a person is entered into the HRMS suite, the number for
the person, Applicant, Contingent Worker, or Employee, had to be entered
by the User entering the person. This could cause minor errors if the
number being entered was already use.

 
← Automatic – Again, when a person is entered into the system, a number is
generated.This time by the system itself, no user intervention is required.
The system would check for the next number in the sequence being used
within that specific business group.

Now in 11.5.x, with the application of HR Family Pack F, Global Person was
introduced. A new pair of concurrent processes were created to alter the
numbering scheme of your Organization.

← “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.

Now with the release of Family Pack H, Oracle has added Custom person
numbering. One piece of information not mentioned up to the point is that these
“numbers” are not stored in the database as a number. They are a text field.A
person could be Employee number 1, A1, XYZ-123-2213, or ABCDEFG.
However, only Manual Numbering allowed
to use anything other then numbers. Custom Person numbering now allows the
creation of a function and fast
formula that will control how the number looks and the next value making the
person numbering scheme much more flexible.
The following pages will provide an example of the function needed and a fast
formula as well as examples of the information created.

DISCLAIMER: These examples are Untested and may contain errors or other
mistakes. They are meant simply as an example to aid you in the creation of the
Fast Formula and associated Functions.

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.

Step 1:

Create a database sequence called “CUST_NUMB”

Using SQL*Plus, run the following command:

SQL> CREATE SEQUENCE CUST_NUMB


START WITH 1000
INCREMENT BY 1
NOCYCLE;

You might need to grant access to other users. Contact your DBA to perform the
necessary steps.

Step 2:
Create a package Header and body to do the work of finding the next value to be
used:

Example of package header – File named: mygetval.pkh

REM
REM This example will use a DB Sequence to get the next value and it
returns an existing
REM person number every time it finds a match in the system using the
PARTY_ID parameter.
REM
SET VERIFY OFF
WHENEVER OSERROR EXIT FAILURE ROLLBACK;
WHENEVER SQLERROR EXIT FAILURE ROLLBACK;
CREATE OR REPLACE PACKAGE PER_FF_CUSTOM_NUMBER_GENERATION AS
/* $Header */
--
Function Get_Customd 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;
END PER_FF_CUSTOM_NUMBER_GENERATION;
/
commit;
exit;

Save this file

Step 3:
Create the package body

Example of package body – File named: mygetval.pkb

CREATE OR REPLACE PACKAGE PER_FF_CUSTOM_NUMBER_GENERATION AS


/* $Header */
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 p_effective_date 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 into l_emp_num, l_apl_num, l_npw_number;
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 :=‘XYZ-‘||TO_CHAR(l_seq_num,’0009’)||’-‘||
SUBSTR(p_national_id,1,3);
return l_next;
--
ELSE
--
-- a match was found, therefore return existing person number
--
IF 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;
/
commit;
exit;

A description of what this should return:

Assumption NEXT sequential number = 1201 (from custom database sequence)

Entering a person with National Identifier = 110-22-1212

And Party_id is null

Should return a person number = XYZ-1201-110

The package Header and Body must now be generated into the system. One
way is from sqlplus

SQL> start mygetval.pkh


SQL> start mygetval.pkb

If errors are generated, then compile package manually:

SQL> alter package PER_FF_CUSTOM_NUMBER_GENERATION compile;


SQL> show errors; (hopefully there will be none)
SQL> alter package PER_FF_CUSTOM_NUMBER_GENERATION compile
body:
SQL> show errors; (again – hopefully there are none)

Once the package compiles cleanly we are ready to proceed


Step 4:

Log into the SETUP BUSINESS GROUP

This is a must – Using any other business group to implement and custom
numbering WILL NOT WORK!

Create a Fast Formula Function –

Navigation = Other Definitions > Formula Functions

Alter the Session date to reflect the earliest date you would want the custom
numbering to start (01-JAN-1900 for example).

Enter the following Information – again this is an example

Name = Get_Custom_Number
Data Type = Text
Class = External Funtion
Alias Name = NULL or what you want the alias to be
Description = Returns the next custom number value
Definition = PER_FF_CUSTOM_NUMBER_GENERATION.Get_Custom_Number

Next click on the Context Usages Button

Enter the following


Number = 1
Context Name = BUSINESS_GROUP_ID
Data Type = Number

NOTE: this is the ONLY context usage that needs to be defined.

Save this and close the form

Click the Parameters button and enter the following:

NUMBER 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_national_id Text Input Only
6 p_date_of_birth Date Input Only
Step 5:

Now it is time to create the Fast Formula

Navigation = Total Compensation > Basic > Write Formula

Enter the Following:

Name = EMP_NUMBER_GENERATION
Type = Person Number Generation
Description = Returns next Employee number

Click on the Edit Button and enter the following text

/*
------------------------------------------------------------------------
-------------------------------*/
/* NAME: EMP_NUMBER_GENRATION
*/
/* Returns the Next Employee Number.
*/
/
*-----------------------------------------------------------------------
--------------------------------*/
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)
INPUT 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 = ‘ ‘
/
*-----------------------------------------------------------------------
--------------------------------*/
/* Next test is to insure we are processing an EMPLOYEE and
*/
/* not an Applicant or Contingent Worker
*/
/
*-----------------------------------------------------------------------
--------------------------------*/
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 Ne

You might also like