Académique Documents
Professionnel Documents
Culture Documents
Overview
API User Hooks allow users to extend the business logic of the standard business rules that are
executed by APIs. This is done by allowing custom procedures to be called at specific points in
the standard APIs. For instance, a user may want to implement User Hooks for one of the
following reasons:
To extend the validation of data beyond what the standard system provides.
To maintain data held in extra customer specific tables (not part of Oracle Applications)
as it is entered.
To send alerts when particular events happen within Oracle Human Resources
Management System (HRMS)
Advantages
User Hooks allow extra business logic to be inserted in exactly the right place in the application
without needing to bespoke any of the standard APIs. Upgrades are no problem as the hooks will
be regenerated during the upgrade process. However, Oracle reserves the right to change the HR
schema at any time, which may necessitate modifications to customized PL/SQL procedures.
The main advantages of hooks over custom library are that they only need to be implemented in
one place whereas custom library modifications could conceivably have to be made on several
clients. They are also immediately available to any interface that calls the API. For example,
Forms, Self Service, Data Pump, etc.
Disadvantages
A customized procedure called by a User Hook will only work if the API that the call has been
added to is executed. It sounds obvious. However, at the time of writing there are still a large
number of forms that don't call APIs. The Enter Person Information form is one of them.
Therefore, any hook added to the Create_Employee API will not be executed from this form. It is
policy to eventually convert all existing forms to call APIs but this will not be a short term
process. Unfortunately, there is no list available which indicates which forms call APIs and which
do not. The only certainty is that all new forms will call APIs. A sensible approach to any
implementation of configuration logic, therefore, if required to be executed by a standard form, is
for the user to use a hook if the form calls a supported API, and custom library if not.
1- Use this SQL statement to get original procure which you will use
SELECT AHM.API_MODULE_ID,
AHM.API_MODULE_TYPE,
AHM.MODULE_NAME,
AHK.API_HOOK_ID,
AHC.API_HOOK_CALL_ID,
AHK.HOOK_PACKAGE,
AHK.HOOK_PROCEDURE,
AHC.SEQUENCE,
AHC.CALL_PACKAGE,
AHC.CALL_PROCEDURE,
AHC.STATUS,
AHC.API_HOOK_CALL_ID,
AHC.OBJECT_VERSION_NUMBER
FROM HR_API_HOOKS AHK, HR_API_MODULES AHM,
HR_API_HOOK_CALLS AHC
WHERE AHM.MODULE_NAME LIKE '%PERSON_EXTRA_INFO%'
-- AHM.MODULE_NAME LIKE '%CREATE_SIT%'
-- AHM.MODULE_NAME LIKE '%CREATE_PERSON_ABSENCE%'
AND AHM.API_MODULE_TYPE = 'BP' -- Before
-- AND AHK.API_HOOK_TYPE = 'AP' -- After
AND AHK.HOOK_PACKAGE LIKE '%BK1'
AND AHK.API_MODULE_ID(+) = AHM.API_MODULE_ID
AND AHC.API_HOOK_ID(+) = AHK.API_HOOK_ID
-- AND AHC.SEQUENCE > 2000
ORDER BY 7, 5 ASC
Change only Module name to get what you need
Method 1:
SELECT MAX(MESSAGE_NUMBER)
FROM FND_NEW_MESSAGES
Parameter to use
it in procedure
DECLARE
obj number := 1; -- any number from starting from 1
l_api_hook_call_id number :=503; -- Original API hook call id
p_api_hook_id number := 3839; -- Original API hook id
BEGIN
hr_api_hook_call_api.create_api_hook_call
(p_validate => false,
p_effective_date => sysdate,
p_api_hook_id => p_api_hook_id, -- Original API hook id
p_api_hook_call_type => 'PP',-- (package procedure) this is the only available type now.
p_sequence => 2001, -- any number above 2000 and it is used to sequence the execution of the
validation procs
p_enabled_flag => 'Y',
p_call_package => 'Package Name', -- your package name
p_call_procedure => 'Procedure Name', -- your procedure name
p_api_hook_call_id => l_api_hook_call_id, -- Original API hook call id
p_object_version_number => obj); -- any number from starting from 1
COMMIT;
END;
8- Run first select statement and be sure that your new record had inserted and the status is N
9- Logon to the application server (by telnet open server_name . User name/passwd)
10- Run:
cd $PER_TOP/admin/sql 11i
Or
cd $PER_TOP/patch/115/sql R12
Then
SQL> @hrahkone