Académique Documents
Professionnel Documents
Culture Documents
Custom Table?
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.
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.
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.
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:
Create your table in Custom Schema. Give grants to Apps and also create the synonym in Apps.
Register your custom table in Oracle Application via the APIs of AD_DD Package.
//Procedure REGISTER_TABLE
1 //Procedure REGISTER_TABLE
2
3 procedure register_table ( p_appl_short_name in varchar2,
4 p_tab_name in varchar2,
5 p_tab_type in varchar2,
6 p_next_extent in number default 512,
7 p_pct_free in number default 10,
8 p_pct_used in number default 70);
9
1 //Procedure REGISTER_COLUMN
0
1 procedure register_column (p_appl_short_name in varchar2,
1 p_tab_name in varchar2,
1 p_col_name in varchar2,
2 p_col_seq in number,
1 p_col_type in varchar2,
3 p_col_width in number,
1 p_nullable in varchar2,
4 p_translate in varchar2,
1 p_precision in number default null,
5 p_scale in number default null);
1
6 //Procedure DELETE_TABLE
1
7 procedure delete_table (p_appl_short_name in varchar2,
1 p_tab_name in varchar2);
8
1 //Procedure DELETE_COLUMN
9
2 procedure delete_column (p_appl_short_name in varchar2,
0 p_tab_name in varchar2,
2 p_col_name in varchar2);
1
2
2
2
3
2
4
2
5
2
6
2
7
2
8
2
9
3
0
3
1
3
2
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 tables blocks reserved for future
updates to the table (199). 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 (199).
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).
DECLARE
v_appl_short_name VARCHA
v_tab_name VARCHAR2
v_tab_type VARCHAR2
v_next_extent NUMBER :=
1 DECLARE
2 v_appl_short_name VARCHAR2 (40) := 'XXCUST';
3 v_tab_name VARCHAR2 (32) := 'TXN_ACK_LOG'; -- Change the table name if you require
4 v_tab_type VARCHAR2 (50) := 'T';
5 v_next_extent NUMBER := 512;
6 v_pct_free NUMBER;
7 v_pct_used NUMBER;
8 BEGIN
9 -- Unregister the custom table if it exists
10 ad_dd.delete_table (p_appl_short_name => v_appl_short_name,
11 p_tab_name => v_tab_name);
12
13 -- Register the custom table
14 FOR tab_details IN (SELECT table_name,
15 tablespace_name,
16 pct_free,
17 pct_used,
18 ini_trans,
19 max_trans,
20 initial_extent,
21 next_extent
22 FROM dba_tables
23 WHERE table_name = v_tab_name)
24 LOOP
25 ad_dd.register_table (
26 p_appl_short_name => v_appl_short_name,
27 p_tab_name => tab_details.table_name,
28 p_tab_type => v_tab_type,
29 p_next_extent => NVL (tab_details.next_extent, 512),
30 p_pct_free => NVL (tab_details.pct_free, 10),
31 p_pct_used => NVL (tab_details.pct_used, 70));
32 END LOOP;
33
34 -- Register the columns of custom table
35 FOR all_tab_cols IN (SELECT column_name,
36 column_id,
37 data_type,
38 data_length,
39 nullable
40 FROM all_tab_columns
41 WHERE table_name = v_tab_name)
42 LOOP
43 ad_dd.register_column (p_appl_short_name => v_appl_short_name,
44 p_tab_name => v_tab_name,
45 p_col_name => all_tab_cols.column_name,
46 p_col_seq => all_tab_cols.column_id,
47 p_col_type => all_tab_cols.data_type,
48 p_col_width => all_tab_cols.data_length,
49 p_nullable => all_tab_cols.nullable,
50 p_translate => 'N',
51 p_precision => NULL,
52 p_scale => NULL);
53 END LOOP;
54
55 FOR all_keys IN (SELECT constraint_name, table_name, constraint_type
56 FROM all_constraints
57 WHERE constraint_type = 'P' AND table_name = v_tab_name)
58 LOOP
59 ad_dd.register_primary_key (
60 p_appl_short_name => v_appl_short_name,
61 p_key_name => all_keys.constraint_name,
62 p_tab_name => all_keys.table_name,
63 p_description => 'Register primary key',
64 p_key_type => 'S',
65 p_audit_flag => 'N',
66 p_enabled_flag => 'Y');
67
68 FOR all_columns
69 IN (SELECT column_name, POSITION
70 FROM dba_cons_columns
71 WHERE table_name = all_keys.table_name
72 AND constraint_name = all_keys.constraint_name)
73 LOOP
74 ad_dd.register_primary_key_column (
75 p_appl_short_name => v_appl_short_name,
76 p_key_name => all_keys.constraint_name,
77 p_tab_name => all_keys.table_name,
78 p_col_name => all_columns.column_name,
79 p_col_sequence => all_columns.POSITION);
80 END LOOP;
81 END LOOP;
82
83 COMMIT;
84 END;
Once the table registration API completes successfully, log in to Oracle Apps.
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
You can run the following to validate whether these two packages exist under your custom schema or not:
from dba_objects
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:
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:
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.
You log into the Oracle Applications, choose the Alert Manager Responsibility and then navigate:
Alert > Define
Name = xxcust_event_alert
Type = Event
2] You enter the Event Alert Details section for your alert and then check the After Insert and After Update boxes:
Table = TXN_ACK_LOG
4] You can now click on the Action Button and create the detail action for your event alert, by the following steps:
At this point, you can choose an action type, like a message and complete the message detail.
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.
Seq = 1
Seq = 1
Action = xxcust_event_action
Seq = 2
For detail information on how to create Event Alert please go through the Oracle Alert Users Guide.
References:
2. Metalink Note: Beginners Guide: Create a Custom Event Alert to Fire against a Custom Table (Doc ID
103418.1)
3. Metalink Note: Integrating Custom Applications with Oracle Applications (Doc ID 176852.1)
4. Blog: oraclemaniac.com
AOL
Leave a comment
MOC Admin
Enter a suitable Name of the alert (up to 50 characters), and give it a meaningful description (up to 240
characters).
Select a frequency for your periodic alert. You can choose from nine frequency options:
1. On Demand
5. Every Day
Depending on the frequency you choose in the previous step, the Start Time and End Time fields become
enabled. You may also specify the number of times within a 24-hour period that Oracle Alert checks your
alert.
Specify a value in the Keep _ Days field to indicate the number of days of exceptions, actions, and response
actions history you want to keep for this alert.
Specify a value in the End Date field if you want to disable your alert by a certain date.
Enter a SQL Select statement that retrieves all the data your alert needs to perform the actions you plan to
define.
Note:
Your periodic alert Select statement must include an INTO clause that contains one output for each column
selected by your Select statement.
Identify any inputs with a colon before the name, for example, :INPUT_NAME.
Identify any outputs with an ampersand (&) before the name, for example, &OUTPUT_NAME.
You can use PL/SQL functions in your Select statement to fetch complex business logic.
2] You can view all the input and output column details in Alert Details Tab. The Alert Details window includes
information such as which Application installations you want the alert to run against, what default values you want
your inputs variables to use, and what additional characteristics you want your output variables to have.
3] After you define your alert you need to create the actions you want your alert to perform. For that click on the
Actions tab.
Enter a name (up to 80 characters) and description (up to 240 characters) for your alert action.
Specify the electronic mail IDs of the recipients you want to send your message to in the To field.
If you list more than one recipient in any of these recipient fields, separate each recipient by a space, or a
comma, or a combination of the two.
You can also enter alert outputs or response variables in any of the alert detail fields. Oracle Alert
automatically substitutes the associated output value when checking the alert or the associated response
variable value when reading the response.
Enter a Sequence number that lets you order the execution of action sets during an alert check.
Check Suppress Duplicates if you want Oracle Alert to suppress the actions in this action set if the exception
found is a duplicate that occurred during the last alert check.
Go to Members tab.
7] Since it is an On Demand periodic alert, we can run the alert at any time we want. For that go to Request > Check
and enter the alert details. Then click on Submit Request.
This will fire one concurrent program which you can view by going through the navigation: Request > View
View the Log and Output files of the concurrent program to find that the alert is fired successfully.
Donecheck your mailbox and you should get emails that are sent from Oracle Alerts