Employee Number Generation | Parameter (Computer Programming) | Subroutine

Custom Employee Number Generation

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” SQL> CREATE SEQUENCE CUST_NUMB START WITH 1000 INCREMENT BY 1 NOCYCLE;

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

l_next varchar2 (30).p_person_id IN number .no match was found. / commit.p_party_id IN number . -begin open person_exists.p_person_number IN varchar2 .1. 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.) return varchar2. therefore use our custom sequence -.We need to see if this person already exists in the system -SELECT employee_number. l_npw_number. .p_national_id IN varchar2 . l_apl_num number.’0009’)||’-‘||SUBSTR(p_national_id. l_npw_num number. -l_seq_num number.p_legislation_code IN varchar2 . l_emp_num number. END PER_FF_CUSTOM_NUMBER_GENERATION. exit. applicant_number.p_date_of_birth IN date ) return varchar2 is -cursor person_exists is -.nextval INTO l_seq_num from dual.append the first 3 characters of the national identfier -SELECT cust_numb. IF person_exists%NOTFOUND then --. Save this file Step 3: Create the package CREATE OR REPLACE PACKAGE PER_FF_CUSTOM_NUMBER_GENERATION AS /* $Header */ Function Get_Custom_Number(p_business_group_id IN number . l_next :=‘XYZ-‘||TO_CHAR(l_seq_num.3). l_apl_num. fetch person_exists into into l_emp_num.p_person_type IN varchar2 .

END IF. close person_exists. ELSIF p_person_type = ‘APL’ then L_next := l_apl_num. -ELSE --.pkh SQL> start mygetval. exit. One way is from sqlplus SQL> start mygetval. 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.pkb Step 4: Log into the SETUP BUSINESS GROUP Create a Fast Formula Function – Navigation = Other Definitions > Formula Functions . -END Get_Custom_Number.return l_next. return l_next. ELSIF p_person_type = ‘CWK’ then L_next := l_npw_num. therefore return existing person number -IF person_type = ‘EMP’ then L_next := l_emp_num. / commit. END IF.a match was found.

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.Alter the Session date to reflect the earliest date you would want the custom numbering to start (01-JAN1900 for example).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 .

*/ /*-------------------------------------------------------------------------------------------------------*/ 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). Party_id.Party_ID . Date_of_birth (date). Person_number (text).Date_Of_Birth) ELSE invalid_msg = ‘This is not an person_type of Employee!’ RETURN Ne . Hire_date (date).Person_Type .National_ID .Person_ID .Click on the Edit Button and enter the following text /* -------------------------------------------------------------------------------------------------------*/ /* NAME: EMP_NUMBER_GENRATION */ /* Returns the Next Employee Number. Person_id. 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 (text).Person_Number .

National_ID .Person_Type .Person_Number .Date_Of_Birth) When you are writing any formula for Person/Applicant/Contingent Number generation. 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 .Get_Custom_Number(Legislation_Code . Without this. then the formula type should always be 'Person Number Generation'.Party_ID . it won't work.Person_ID .

Sign up to vote on this title
UsefulNot useful