0% found this document useful (0 votes)
183 views3 pages

Registering User Hook

This document provides instructions for registering user hooks in three tables: HR_API_MODULES, HR_API_HOOKS, and HR_API_HOOK_CALLS. It describes getting the API hook ID from HR_API_HOOKS using the module name, then creating an API hook call using that ID, the hook package and procedure names, and other parameters. Code examples are provided to query the tables and create an API hook call.

Uploaded by

hossam.elrweny
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
183 views3 pages

Registering User Hook

This document provides instructions for registering user hooks in three tables: HR_API_MODULES, HR_API_HOOKS, and HR_API_HOOK_CALLS. It describes getting the API hook ID from HR_API_HOOKS using the module name, then creating an API hook call using that ID, the hook package and procedure names, and other parameters. Code examples are provided to query the tables and create an API hook call.

Uploaded by

hossam.elrweny
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

-----------------------------------------------------------------------------------

----------------------

<<< Registration for user hooks>>>


1) three tables important in regestration :

A)HR_API_MODULES

B)HR_API_HOOKS

C)HR_API_HOOK_CALLS

2) you need to get :api hook id ; to use it in


hr_api_hook_call_api.create_api_hook_call.... (api)
you can get the api hook id from : HR_API_HOOKS
you can get the name of the module which match your needs,such as :UPDATE_PERSON
make the filter on the table (A) as:MODULE_NAME LIKE '%UPDATE_PERSON%' depend on
your case.
get the API_MODULE_ID for the MODULE_NAME which get it,

3)GO th the table(B)AND PUT THE API_MODULE_ID IN FILTER ,EX:API_MODULE_ID = 1212


TAKE THE HOOK PACKAGE AND HOOK PROCEDURE ,EX: HR_PERSON_BK1(HOOK PACKAGE)
UPDATE_PERSON_B(HOOK PROCUDER)

4)HOOK PACKAGE.HOOK PROCUDER>> F4>> AND GET THE PROCEDURE OVERALL


5)OPEN XXX_HR_USER_HOOKS(CUSTOM CODE)
CREATE THE PREVIOUS PROCEDURE IN SPECIFICATION AND HEADER.
6) USE THIS API:
set serverout on;
-- Procedure to Create API Hook

declare
l_api_hook_call_id number;
l_object_version_number number;
l_sequence number;
begin
select HR_API_HOOKS_S.NEXTVAL
into l_sequence
from dual;
hr_api_hook_call_api.create_api_hook_call
(p_validate => false,
p_effective_date => to_date('01-01-2014','dd-mm-yyyy'),
p_api_hook_id => 3876, ------------------------------------
p_api_hook_call_type => 'PP',
p_sequence => l_sequence,
p_enabled_flag => 'Y',
p_call_package => 'XXX_HR_USER_HOOKS', --------------
p_call_procedure => 'AFTER_INSERT',
-----------------
p_api_hook_call_id => l_api_hook_call_id,
p_object_version_number => l_object_version_number);
dbms_output.put_line('l_api_hook_call_id:'||l_api_hook_call_id);
dbms_output.put_line('l_object_version_number:'||l_object_version_number);
end;
/
TABLE(A)ABOVE.

___________________________________________________________________________________
_____________________________

HR_API_MODULES

HR_API_HOOKS

HR_API_HOOK_CALLS
--------------------------------------------------------------
select * from hr_api_modules where module_name = 'CREATE_PERSON_EXTRA_INFO'
-----------------
select ahk.api_hook_id,ahk.api_hook_type,

ahk.hook_package,

ahk.hook_procedure from hr_api_hooks ahk where

api_module_id = 1226
---------------------------------
select * from hr_api_hook_calls where api_hook_id = 2758 -- After Proccess
------------------------------
select ahk.api_hook_id,ahk.api_hook_type,

ahk.hook_package,

ahk.hook_procedure

from hr_api_hooks ahk,

hr_api_modules ahm

where ahm.module_name='CREATE_PERSON_EXTRA_INFO'

and ahk.api_module_id=ahm.api_module_id
-------------------------------------------

declare

l_api_hook_call_id number;

l_object_version_number number;

begin

hr_api_hook_call_api.create_api_hook_call

(p_validate => false,

p_effective_date => to_date('01-JAN-1900','DD-MON-YYYY'),


p_api_hook_id => 2758,-- API HOOK ID

p_api_hook_call_type => 'PP',

p_sequence => 3100,-- SEQ NO

p_enabled_flag => 'Y',

p_call_package => 'XXX_HR_USER_HOOKS', -- Package Name

p_call_procedure => 'CREATE_PERSON_EXTRA_INFO_B', -- Procedure Name

p_api_hook_call_id => l_api_hook_call_id,

p_object_version_number => l_object_version_number);


dbms_output.put_line('Procedure Successfully Registered');
exception when others then
dbms_output.put_line(sqlerrm);
end;
----------------------------------
DECLARE

BEGIN

hr_api_user_hooks_utility.create_hooks_one_module(1226); -- Module ID

dbms_output.put_line('Pre-Preocessor Run Successfully');

exception

when others then

dbms_output.put_line(sqlerrm);
END;

-----------------------------------------------------------------------------------
------------------------

You might also like