About Me

Dubai, United Arab Emirates
My name is Muhammad Faizan Karim and my aim is to spread the knowledge to everyone who want to learn oracle HRMS. I will try to write the video blogs for beginners so they can understand e-business suits from HRMS perspective, and if you have any difficulty in oracle applications HRMS , please feel free to contact with me at this email : faizan.kareem.ocp@gmail.com
Powered by Blogger.

User Hook for Salary Proposal in HRMS


Kindly find attached  the scripts 1,2,3,4 for User Hook created on Create
Salary Proposal for restricting it to make duplicate entry in case of
proposed salary found for the employee on or after the hire date.

All, Please find below the step by step process for creating a User Hook.


1) Query table 'hr_api_hooks' to find user hooks available for the API you wanted to restrict, based on below conditions.

    a) Before hook : BP
    b) After Hook : AP

    c) hook_pacakge(API name with '_' and suffix like 'BKn' where n is number starting from '1') which is attached to the API you wanted to restrict.

    d) hook_procedure(API Procedure name with '_' and suffix 'A' or 'B' which indicates after hook or before hook) which is attached to the Hook Package.


2) Create your package and procedure to incorporate your restriction on the API you wanted to put, depending upon before hook or after hook keeping below point in mind.

    a) Parameters in ur procedure should be same as all 'IN' Parameters in ur Hook Procedure i.e. Before hook procedure or after hook procedure.

3) Register ur package with the User Hook Pacakge by making an entry in 'hr_api_hook_calls' table. Script3 attached.

4) Run Hook Pre-processor by running script4.

1.

create or replace package BTVL_PAY_PROPOSAL_HOOK_PKG
as
procedure btvl_pay_proposal_insert_hook
  p_assignment_id                in number,
  p_business_group_id            in number,
  p_change_date                  in date,
  p_comments                     in varchar2,
  p_next_sal_review_date         in date,
  p_proposal_reason              in varchar2,
  p_proposed_salary_n            in number,
  p_forced_ranking               in number,
  p_date_to                      in date,
  p_performance_review_id        in number,
  p_attribute_category           in varchar2,
  p_attribute1                   in varchar2,
  p_attribute2                   in varchar2,
  p_attribute3                   in varchar2,
  p_attribute4                   in varchar2,
  p_attribute5                   in varchar2,
  p_attribute6                   in varchar2,
  p_attribute7                   in varchar2,
  p_attribute8                   in varchar2,
  p_attribute9                   in varchar2,
  p_attribute10                  in varchar2,
  p_attribute11                  in varchar2,
  p_attribute12                  in varchar2,
  p_attribute13                  in varchar2,
  p_attribute14                  in varchar2,
  p_attribute15                  in varchar2,
  p_attribute16                  in varchar2,
  p_attribute17                  in varchar2,
  p_attribute18                  in varchar2,
  p_attribute19                  in varchar2,
  p_attribute20                  in varchar2,
  p_multiple_components          in varchar2,
  p_approved                     in varchar2,
  p_element_entry_id             in number
);
end BTVL_PAY_PROPOSAL_HOOK_PKG;



2.

create or replace package BTVL_PAY_PROPOSAL_HOOK_PKG
as
procedure btvl_pay_proposal_insert_hook
  p_assignment_id                in number,
  p_business_group_id            in number,
  p_change_date                  in date,
  p_comments                     in varchar2,
  p_next_sal_review_date         in date,
  p_proposal_reason              in varchar2,
  p_proposed_salary_n            in number,
  p_forced_ranking               in number,
  p_date_to                      in date,
  p_performance_review_id        in number,
  p_attribute_category           in varchar2,
  p_attribute1                   in varchar2,
  p_attribute2                   in varchar2,
  p_attribute3                   in varchar2,
  p_attribute4                   in varchar2,
  p_attribute5                   in varchar2,
  p_attribute6                   in varchar2,
  p_attribute7                   in varchar2,
  p_attribute8                   in varchar2,
  p_attribute9                   in varchar2,
  p_attribute10                  in varchar2,
  p_attribute11                  in varchar2,
  p_attribute12                  in varchar2,
  p_attribute13                  in varchar2,
  p_attribute14                  in varchar2,
  p_attribute15                  in varchar2,
  p_attribute16                  in varchar2,
  p_attribute17                  in varchar2,
  p_attribute18                  in varchar2,
  p_attribute19                  in varchar2,
  p_attribute20                  in varchar2,
  p_multiple_components          in varchar2,
  p_approved                     in varchar2,
  p_element_entry_id             in number
);
end BTVL_PAY_PROPOSAL_HOOK_PKG;



create or replace package BTVL_PAY_PROPOSAL_HOOK_PKG
as
procedure btvl_pay_proposal_insert_hook
  p_assignment_id                in number,
  p_business_group_id            in number,
  p_change_date                  in date,
  p_comments                     in varchar2,
  p_next_sal_review_date         in date,
  p_proposal_reason              in varchar2,
  p_proposed_salary_n            in number,
  p_forced_ranking               in number,
  p_date_to                      in date,
  p_performance_review_id        in number,
  p_attribute_category           in varchar2,
  p_attribute1                   in varchar2,
  p_attribute2                   in varchar2,
  p_attribute3                   in varchar2,
  p_attribute4                   in varchar2,
  p_attribute5                   in varchar2,
  p_attribute6                   in varchar2,
  p_attribute7                   in varchar2,
  p_attribute8                   in varchar2,
  p_attribute9                   in varchar2,
  p_attribute10                  in varchar2,
  p_attribute11                  in varchar2,
  p_attribute12                  in varchar2,
  p_attribute13                  in varchar2,
  p_attribute14                  in varchar2,
  p_attribute15                  in varchar2,
  p_attribute16                  in varchar2,
  p_attribute17                  in varchar2,
  p_attribute18                  in varchar2,
  p_attribute19                  in varchar2,
  p_attribute20                  in varchar2,
  p_multiple_components          in varchar2,
  p_approved                     in varchar2,
  p_element_entry_id             in number
);
end BTVL_PAY_PROPOSAL_HOOK_PKG;


Script to register api to hr_api_hook_calls.pkb 3.txt


set serveroutput on size 1000000
declare
--
ln_api_hook_call_id            number;
ln_object_version_number       number;
ln_api_hook_id                 number;
--
begin

   select ahk.api_hook_id
     into ln_api_hook_id
     from hr_api_hooks ahk, hr_api_modules ahm
    where ahm.module_name = 'INSERT_SALARY_PROPOSAL'
      and ahm.api_module_type = 'BP'
      and ahk.hook_package = 'HR_MAINTAIN_PROPOSAL_BK1'
      and ahk.hook_procedure = 'INSERT_SALARY_PROPOSAL_B'
      and ahk.api_hook_type = 'BP'               -- Before Process
      and ahk.api_module_id = ahm.api_module_id;
   --
   -- insert a row into HR_API_HOOK_CALLS
   --
   hr_api_hook_call_api.create_api_hook_call
      (p_effective_date        => to_date('28-Jul-2011','DD-MON-YYYY')
      ,p_api_hook_id           => ln_api_hook_id
      ,p_api_hook_call_type    => 'PP'
      ,p_sequence              => 1
      ,p_enabled_flag          => 'Y'
      ,p_call_package          => 'BTVL_PAY_PROPOSAL_HOOK_PKG'
      ,p_call_procedure        => 'btvl_pay_proposal_insert_hook'
      ,p_api_hook_call_id      => ln_api_hook_call_id
      ,p_object_version_number => ln_object_version_number);
   --
   dbms_output.put_line('Registered HOOK...');
   --
exception
   when others then
      dbms_output.put_line(substr('Error: '||sqlerrm,1,255));
end;
/


script to register user hook api call to hr_api_modules.pkb 4.txt


set serveroutput on size 1000000
declare
--
cursor c1_cur is
   select api_module_id
     from hr_api_modules
    where module_name = 'INSERT_SALARY_PROPOSAL';
--
begin
   --
   for c1 in c1_cur loop
      hr_api_user_hooks_utility.create_hooks_one_module( p_api_module_id =>   c1.api_module_id);
   end loop;
   --
exception
   when others then
      dbms_output.put_line(substr(sqlerrm,1,255));
end;


0 comments: