An event alert is a database trigger that tells you when data in an object within the database has been changed. Event alerts can be configured to trigger an action, like sending an email to a user or running some concurrent programs. The post will provide you a step-by-step guide on how to create a custom event alert, which will fire when a row in a custom table is updated. The update can be the result of an insert or update DML statement.
Step 1: Create your Custom schema:
You should have a Custom schema within the database where you can create your custom tables. If you already have a custom schema in use that is created by the DBA, you can simply use them.
Step 2: Create your Custom Application:
You should have a Custom Application. If your apps instance already has it, then simply use it or, you can create a custom application via the below navigation:
Log into Applications as the System Administrator and navigate to: Application –> Register.
Step 3: Register the Custom schema in AOL:
Register the Custom schema with the Application Object Library.
Log into Oracle Applications as the System Administrator and navigate: Security –> ORACLE –> Register.
Step 4: Add the Custom schema to Data Group:
You need to add the custom user/schema to a data group. You can do this by logging into Oracle Applications as the System Administrator and navigate:
Security –> ORACLE –> DataGroup.
The following is an example row for your user registration:
Data Group: Standard
Description: Standard Data Group
VARIABLE NAMES DESCRIPTION
p_appl_short_name The application short name of the application that owns the table (usually your custom application).
p_tab_name The name of the table (in uppercase letters).
p_tab_type Use ’T’ if it is a transaction table (almost all application tables), or ’S’ for a” seed data” table (used only by Oracle Applications products).
p_pct_free The percentage of space in each of the table’s blocks reserved for future updates to the table (1–99). The sum of p_pct_free and p_pct_used must be less than 100.
p_pct_used Minimum percentage of used space in each data block of the table (1–99). The sum of p_pct_free and p_pct_used must be less than 100.
p_col_name The name of the column (in uppercase letters).
p_col_seq The sequence number of the column in the table (the order in which the column appears in the table definition).
p_col_type The column type (’NUMBER’, ’VARCHAR2’, ’DATE’, etc.).
p_col_width The column size (a number). Use 9 for DATE columns, 38 for NUMBER columns (unless it has a specific width).
p_nullable Use ’N’ if the column is mandatory or ’Y’ if the column allows null values.
p_translate Use ’Y’ if the column values will be translated for an Oracle Applications product release (used only by Oracle Applications products) or ’N’ if the
Values are not translated (most application columns).
p_next_extent The next extent size, in kilobytes. Do not include the ’K’.
p_precision The total number of digits in a number.
p_scale The number of digits to the right of the decimal point in a number.
BEGIN
-- Unregister the custom table if it exists
ad_dd.delete_table (p_appl_short_name => v_appl_short_name,
p_tab_name => v_tab_name);
-- Register the custom table
FOR tab_details IN (SELECT table_name, tablespace_name, pct_free,
LOOP
ad_dd.register_column (p_appl_short_name => v_appl_short_name,
p_tab_name => v_tab_name,
p_col_name => all_tab_cols.column_name,
p_col_seq => all_tab_cols.column_id,
p_col_type => all_tab_cols.data_type,
p_col_width => all_tab_cols.data_length,
p_nullable => all_tab_cols.nullable,
p_translate => 'N',
p_precision => NULL,
p_scale => NULL);
END LOOP;
FOR all_keys IN (SELECT constraint_name, table_name, constraint_type
FROM all_constraints
WHERE constraint_type = 'P' AND table_name = v_tab_name)
LOOP
ad_dd.register_primary_key (p_appl_short_name => v_appl_short_name,
p_key_name => all_keys.constraint_name,
p_tab_name => all_keys.table_name,
p_description => 'Register primary key',
p_key_type => 'S',
p_audit_flag => 'N',
p_enabled_flag => 'Y');
FOR all_columns IN (SELECT column_name, POSITION
FROM dba_cons_columns
WHERE table_name = all_keys.table_name
AND constraint_name = all_keys.constraint_name)
LOOP
ad_dd.register_primary_key_column (p_appl_short_name => v_appl_short_name,
p_key_name => all_keys.constraint_name,
p_tab_name => all_keys.table_name,
p_col_name => all_columns.column_name,
p_col_sequence => all_columns.POSITION );
Responsibility: Application Developer
Navigation: Application > Database > Table
Query for the custom table, ‘TXN_ACK_LOG’
After creating and registering your objects and schema, you need to run the APPS_DDL and APPS_ARRAY_DDL packages against your user/schema. You must run the scripts from the $AD_TOP/admin/sql directory in the order noted below. Please remember that you must run these scripts from the “APPS” user/schema account.
1. adaddls.pls
2. adaaddls.pls
3. adaddlb.pls
4. adaaddlb.pls
General Syntax Form:
SQL> @$AD_TOP/admin/sql/adaddls.pls
SQL> @$AD_TOP/admin/sql/adaaddls.pls
SQL> @$AD_TOP/admin/sql/adaddlb.pls
SQL> @$AD_TOP/admin/sql/adaaddlb.pls
You can run the following to validate whether these two packages exist under your custom schema or not:
select object_name, object_type, status
from dba_objects
where object_name in (‘APPS_DDL’,’APPS_ARRAY_DDL’)
and owner = ‘CUSTOM_SCHEMA’;
Step 8: Create a custom request group:
You need to create a custom request group that will hold your custom and/or standard requests within a custom responsibility. You can do this by logging into Oracle Applications as System Administrator and navigate:
Security –> Responsibility –> Request.
Step 9: Create a custom responsibility:
After creating your custom request group, you need to create a custom responsibility for your custom user/schema. You can do this by logging into Oracle Applications as System Administrator and navigate:
Security –> Responsibility –> Define
You have now completed the steps on how to create and register a customer schema in the Oracle Applications. The next section discusses how you can create the alert in Oracle Alerts.
Step 10: Create the Event Alert:
You log into the Oracle Applications, choose the Alert Manager Responsibility and then navigate:
Alert –>Define
You can create a new alert as follows:
1] You enter the appropriate general information for your alert:
2] You enter the Event Alert Details section for your alert and then check the “After Insert” and “After Update” boxes:
3] You enter the select statement.
4] You can now click on the Action Button and create the detail action for your event alert, by the following steps:
a. You can set the general action parameters:
NOTE: The article assumes that the integration between Oracle Applications and an operating system mail server is already configured correctly.
5] You can navigate back to the main Alert Definition form, and click on the Action Set button, which will allow you to enter a new action set. Below is a basic example consistent with the example code in this entry.
Then, you need to check the “Enabled” check box so that your event alert is enabled to run. You should set members as follows:
Seq = 1
Action = xxcust_event_action
Type = Action: Message
Seq = 2
Action = Exit Action Set Successfully
Type = Exit from Action Set successfully
For detail information on how to create Event Alert please go through the Oracle Alert User’s Guide.
Security –> ORACLE –> DataGroup.
The following is an example row for your user registration:
Data Group: Standard
Description: Standard Data Group
Step 5: Create your table in Custom Schema:
Create your table in Custom Schema. Give grants to Apps and also create the synonym in Apps.
Step 6: Register your custom table in AOL:
Register your custom table in Oracle Application via the API’s of AD_DD Package.
Procedures in the AD_DD Package:
//Procedure REGISTER_TABLE
procedure register_table ( p_appl_short_name in varchar2,
p_tab_name in varchar2,
p_tab_type in varchar2,
p_next_extent in number default 512,
p_pct_free in number default 10,
p_pct_used in number default 70);
//Procedure REGISTER_COLUMN
procedure register_column (p_appl_short_name in varchar2,
p_tab_name in varchar2,
p_col_name in varchar2,
p_col_seq in number,
p_col_type in varchar2,
p_col_width in number,
p_nullable in varchar2,
p_translate in varchar2,
p_precision in number default null,
p_scale in number default null);
//Procedure DELETE_TABLE
procedure delete_table (p_appl_short_name in varchar2,
p_tab_name in varchar2);
//Procedure DELETE_COLUMN
procedure delete_column (p_appl_short_name in varchar2,
p_tab_name in varchar2,
p_col_name in varchar2);
VARIABLE NAMES DESCRIPTION
p_appl_short_name The application short name of the application that owns the table (usually your custom application).
p_tab_name The name of the table (in uppercase letters).
p_tab_type Use ’T’ if it is a transaction table (almost all application tables), or ’S’ for a” seed data” table (used only by Oracle Applications products).
p_pct_free The percentage of space in each of the table’s blocks reserved for future updates to the table (1–99). The sum of p_pct_free and p_pct_used must be less than 100.
p_pct_used Minimum percentage of used space in each data block of the table (1–99). The sum of p_pct_free and p_pct_used must be less than 100.
p_col_name The name of the column (in uppercase letters).
p_col_seq The sequence number of the column in the table (the order in which the column appears in the table definition).
p_col_type The column type (’NUMBER’, ’VARCHAR2’, ’DATE’, etc.).
p_col_width The column size (a number). Use 9 for DATE columns, 38 for NUMBER columns (unless it has a specific width).
p_nullable Use ’N’ if the column is mandatory or ’Y’ if the column allows null values.
p_translate Use ’Y’ if the column values will be translated for an Oracle Applications product release (used only by Oracle Applications products) or ’N’ if the
Values are not translated (most application columns).
p_next_extent The next extent size, in kilobytes. Do not include the ’K’.
p_precision The total number of digits in a number.
p_scale The number of digits to the right of the decimal point in a number.
Useful API to register a Table in Apps:
DECLARE
v_appl_short_name VARCHAR2 (40) := 'XXCUST';
v_tab_name VARCHAR2 (32) := 'TXN_ACK_LOG'; -- Change the table name if you require
v_tab_type VARCHAR2 (50) := 'T';
v_next_extent NUMBER := 512;
v_pct_free NUMBER;
v_pct_used NUMBER;
DECLARE
v_appl_short_name VARCHAR2 (40) := 'XXCUST';
v_tab_name VARCHAR2 (32) := 'TXN_ACK_LOG'; -- Change the table name if you require
v_tab_type VARCHAR2 (50) := 'T';
v_next_extent NUMBER := 512;
v_pct_free NUMBER;
v_pct_used NUMBER;
BEGIN
-- Unregister the custom table if it exists
ad_dd.delete_table (p_appl_short_name => v_appl_short_name,
p_tab_name => v_tab_name);
-- Register the custom table
FOR tab_details IN (SELECT table_name, tablespace_name, pct_free,
pct_used,ini_trans, max_trans,initial_extent,next_extent
FROM dba_tables
WHERE table_name = v_tab_name)
LOOP
ad_dd.register_table (p_appl_short_name => v_appl_short_name,
p_tab_name => tab_details.table_name,
p_tab_type => v_tab_type,
p_next_extent => NVL(tab_details.next_extent,512),
p_pct_free => NVL(tab_details.pct_free,10),
FROM dba_tables
WHERE table_name = v_tab_name)
LOOP
ad_dd.register_table (p_appl_short_name => v_appl_short_name,
p_tab_name => tab_details.table_name,
p_tab_type => v_tab_type,
p_next_extent => NVL(tab_details.next_extent,512),
p_pct_free => NVL(tab_details.pct_free,10),
p_pct_used => NVL(tab_details.pct_used,70));
END LOOP;
END LOOP;
-- Register the columns of custom table
FOR all_tab_cols IN (SELECT column_name, column_id, data_type,
FOR all_tab_cols IN (SELECT column_name, column_id, data_type,
data_length,nullable
FROM all_tab_columns
WHERE table_name = v_tab_name)
WHERE table_name = v_tab_name)
LOOP
ad_dd.register_column (p_appl_short_name => v_appl_short_name,
p_tab_name => v_tab_name,
p_col_name => all_tab_cols.column_name,
p_col_seq => all_tab_cols.column_id,
p_col_type => all_tab_cols.data_type,
p_col_width => all_tab_cols.data_length,
p_nullable => all_tab_cols.nullable,
p_translate => 'N',
p_precision => NULL,
p_scale => NULL);
END LOOP;
FOR all_keys IN (SELECT constraint_name, table_name, constraint_type
FROM all_constraints
WHERE constraint_type = 'P' AND table_name = v_tab_name)
LOOP
ad_dd.register_primary_key (p_appl_short_name => v_appl_short_name,
p_key_name => all_keys.constraint_name,
p_tab_name => all_keys.table_name,
p_description => 'Register primary key',
p_key_type => 'S',
p_audit_flag => 'N',
p_enabled_flag => 'Y');
FOR all_columns IN (SELECT column_name, POSITION
FROM dba_cons_columns
WHERE table_name = all_keys.table_name
AND constraint_name = all_keys.constraint_name)
LOOP
ad_dd.register_primary_key_column (p_appl_short_name => v_appl_short_name,
p_key_name => all_keys.constraint_name,
p_tab_name => all_keys.table_name,
p_col_name => all_columns.column_name,
p_col_sequence => all_columns.POSITION );
END LOOP;
END LOOP;
COMMIT;
END;
Once the table registration API completes successfully, log in to Oracle Apps.
END LOOP;
COMMIT;
END;
Once the table registration API completes successfully, log in to Oracle Apps.
Responsibility: Application Developer
Navigation: Application > Database > Table
Query for the custom table, ‘TXN_ACK_LOG’
Also you can verify from below backend tables:
- FND_TABLES
- FND_COLUMNS
- FND_PRIMARY_KEYS
- FND_PRIMARY_KEY_COLUMNS
After creating and registering your objects and schema, you need to run the APPS_DDL and APPS_ARRAY_DDL packages against your user/schema. You must run the scripts from the $AD_TOP/admin/sql directory in the order noted below. Please remember that you must run these scripts from the “APPS” user/schema account.
1. adaddls.pls
2. adaaddls.pls
3. adaddlb.pls
4. adaaddlb.pls
General Syntax Form:
SQL> @$AD_TOP/admin/sql/adaddls.pls
SQL> @$AD_TOP/admin/sql/adaaddls.pls
SQL> @$AD_TOP/admin/sql/adaddlb.pls
SQL> @$AD_TOP/admin/sql/adaaddlb.pls
You can run the following to validate whether these two packages exist under your custom
select object_name, object_type, status
from dba_objects
where object_name in (‘APPS_DDL’,’APPS_ARRAY_DDL’)
and owner = ‘CUSTOM_SCHEMA’;
Step 8: Create a custom request group:
You need to create a custom request group that will hold your custom and/or standard
Security –> Responsibility –> Request.
Step 9: Create a custom responsibility:
After creating your custom request group, you need to create a custom responsibility for
Security –> Responsibility –> Define
You have now completed the steps on how to create and register a customer schema in
Step 10: Create the Event Alert:
You log into the Oracle Applications, choose the Alert Manager Responsibility and then
Alert –>Define
You can create a new alert as follows:
1] You enter the appropriate general information for your alert:
- Application = XXCUST Receivables
- Name = xxcust_event_alert
- Description = My event alert test
- Type = Event
- Application = XXCUST Receivables
- Table = TXN_ACK_LOG
4] You can now click on the Action Button and create the detail action for your event alert,
a. You can set the general action parameters:
- Action Name = xxcust_event_action
- Action Description = xxcust event detail action
- Action Level = Detail b. You can click on action details:
NOTE: The article assumes that the integration between Oracle Applications and an
5] You can navigate back to the main Alert Definition form, and click on the Action Set
- Seq = 1
- Action Set Name = xxcust_event_actionset
Seq = 1
Action = xxcust_event_action
Type = Action: Message
Seq = 2
Action = Exit Action Set Successfully
Type = Exit from Action Set successfully
Challa.
No comments:
Post a Comment