Friday, 12 September 2014

How to Generate Employee Number through Programming in Oracle HRMS

There are following steps need to follow to generate employee number through programming:
Step #1:
Create the FUNCTION “Get_Next_Employee_Number”:
CREATE OR REPLACE Function APPS.Dafz_Get_Next_Employee_Number(p_Business_Group_Id In Number,
p_Emp_Type In Varchar2)
Return Varchar2 Is
v_Emp_No Varchar2(100) := ‘0000’;
Begin
If (p_Emp_Type = ‘EMP’) Then
Begin
Select ‘0’ || Max(To_Number(Papf.Employee_Number) + 1)
Into v_Emp_No
From Per_All_People_f Papf
Where Papf.Employee_Number Is Not Null
And Papf.Employee_Number Not Like ‘XX%’
And Papf.Employee_Number Like ‘0%’
And Papf.Business_Group_Id = p_Business_Group_Id;
Exception
When Others Then
v_Emp_No := ‘NULL';
End;
End If;
Return v_Emp_No;
End;
/
STEP # 2
Change the “HR:Business Group” & “HR: Security Profile” profile setting to “Setup Business Group
HR Business Group Profile Setting
STEP # 3
Define Function in Oracle HRMS Responsibility, switch to “UAE HRMS Responsibility” and open “DEFINE FUNCTION”
Create New Function and calling the above function in it:
Define Function

 Step # 4
Switch to Responsibility “UAE HRMS Manager”  then Total Compensation –> Basic –> Write Formulas, Search for “EMP_NUMBER_GENERATION
EMP NUM GEN
Edit this and update with below Fast Formula code:
/* ——————————————————————————————————-*/
/* NAME: EMP_NUMBER_GENERATION */
/* Returns the Next Employee Number.
/* Developed By: M Muzzammil Khan
/* Dated: 01-May-2013 */
/*——————————————————————————————————-*/
DEFAULT FOR Person_number IS ‘0000’
DEFAULT FOR Party_ID IS 0
DEFAULT FOR Person_ID IS 0
DEFAULT FOR National_ID IS ‘0000’
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 = ‘0000’
IF person_type = ‘EMP’ then
(
Next_Number = DAFZ_Get_Next_Employee_Number(81,Person_Type)
)
RETURN Next_number

 STEP # 5
Save and compile the Fast formula and then try to create new staff from HRMS responsibility, you will see it will generate the new staff # through programming.
Feel free to contact me if further details required.

1 comment:

  1. Hi Raghvan,

    I followed same steps for employee number generation but unable to generate custom employee number.

    Can you please help me on this.

    ReplyDelete