Custom Employee Number Generation: Step 1
Custom Employee Number Generation: Step 1
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:
Step 2:
Create a package Header and body to do the work of finding the next value to be used:
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;
Step 3:
Create the package
The package Header and Body must now be generated into the system. One way is from sqlplus
Step 4:
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
Step 5:
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
Get_Custom_Number(Legislation_Code
,Person_Type
,Person_Number
,Party_ID
,Person_ID
,National_ID
,Date_Of_Birth)
When you are writing any formula for Person/Applicant/Contingent Number generation, then the formula
type should always be 'Person Number Generation'.
Without this, it won't work.
Name of the formula and type should be as follows
Purpose formula name formula type
------------------------------------------------------------------------------------
Employee EMP_NUMBER_GENERATION Person Number Generation
Applicant APL_NUMBER_GENERATION Person Number Generation
Employee CWK_NUMBER_GENERATION Person Number Generation