Академический Документы
Профессиональный Документы
Культура Документы
1-18-09-17
Document1 Page i of 33
Document Control
Change Record
4
Reviewers
Name Position
SEPG Group
Distribution
Name Location
Project Repository
Purpose
This document describes the standards that will be followedby TransSys for the
Oracle E-Business Suite extensions when building customizations to the Oracle
Applications.
Coding conventions and standards for Fusion have also been included.
Background
The information in this document has been defined as the result of discussions
between SEPG Group, project team representatives, technical staff, and
TransSysconsultants.
This document defines standards and guidelines for the extension development and
documentation. The objective of this document is to:
Provide standards to identify components, thus promoting reuse and
simplifying the defect troubleshooting process.
Encourage the use of successful solutions already deployed
Provide standard mechanisms to identify custom components and
dependencies among them.
Improve the development process with the feedback from previous releases.
Related Documents
1. Oracle Applications Developers Guide
2. Oracle Applications User Interface Standards
Overview
Environment has a single “Custom Top” structure which is used for all custom
programs.
The main name conventions used for Communications Authority Of Kenya are:
Directory Structure
Create $XXCA_TOP environment variable for Oracle Apps.
This should be added to the $APPL_TOP/admin/adovars.env file in the
‘customizations’ area at the end of the file. The entry would appear similar to :
$XXCA_TOP/admin
$XXCA_TOP /bin
$XXCA_TOP /data
$XXCA_TOP /data/archive
$XXCA_TOP /disc
$XXCA_TOP /forms/US
$XXCA_TOP /help/US
$XXCA_TOP /html/US
$XXCA_TOP /java
$XXCA_TOP /jsp
$XXCA_TOP /lib
$XXCA_TOP /log
$XXCA_TOP /media
$XXCA_TOP /mesg
$XXCA_TOP /out
$XXCA_TOP /patch
$XXCA_TOP /plsql
$XXCA_TOP /reports/US
$XXCA_TOP /resource
$XXCA_TOP /sql
$XXCA_TOP /wf
FORMS60_PATH=”$XXCA_TOP/forms/US:$XXCA_TOP/resource:$XXCA_TOP/m
edia:$AU_TOP/forms/US:$AU_TOP/resource:$FORMS60_PATH”
export FORMS60_PATH
Note: these paths allow customizations to share common objects (e.g. logos in
reports).
Use standard Oracle Schema creation Utlity to create custom Schema. Utlity name:
ADSPLICE
You must register your application before you can begin developing custom
modules. The following is an example of the steps typically required to register a
new application:
1. Create the directory structure
2. Modify $APPL_TOP/APPLSYS.env to set the environment variable
XXCA_TOP and add $XXCA_TOP/bin to the PATH environment variable.
3. Shutdown the concurrent manager.
4. Execute the APPLSYS.env file.
. APPLSYS.env
5. Restart the concurrent manager.
6. Invoke found and select the Application Developer responsibility
7. Register the application with name “Business Online”, short name XXCA and
basepathXXCA_TOP.
Naming conventions
Custom objects written specifically for Communications Authority are named using
the prefix CA.
The Communications Authority naming conventions are shown below.
DATABASE OBJECTS
T: U = Unique
N = Non-Unique
n = sequential number
Packages CA_<APPS>_DDDDD_PKG CA_HR_PERFORMANCE_A None. Stored in If the procedure is to be
(all PPRAISAL_PKG SVN called from sql, the
procedures (can be up to 32 char) PRAGMA tags can be
should be used to store them in a
inside a non read-only package.
package)
WORKFLOWS
Note that all database functions and procedures need to be contained within packages
NOTE: Database objects other than packages that are owned by the same owner may be combined into one script where
appropriate, e.g. tables, indexes and sequences.
Database table_trg.sql TABLE = Base tablename None. Stored in Multiple trigger types will
Trigger TRG = Trigger SVN be combined into one
Install script install script
Single object.sql OBJECT = name of database None. Stored in
Database Object SVN
Object
creation
script
Table seed table_seed.sql TABLE = Base table name None. Stored in
data script SEED = Seed data SVN
Grant/Syno CA_<apps> AAA = Application prefix None. Stored in
nym script _<descry>_grants_syns..sql where objects reside SVN
BBB = Application prefix of
grantee
To ensure seamless integration with Oracle Applications, you must start with the
TEMPLATE.fmb form which can usually be found in $AU_TOP/forms/US or on the
Oracle Applications CD. Follow the Oracle Applications forms development
standards described in the Developer’s Guide manual to ensure user interface
consistency between Oracle Applications and your extensions.
Note that in order to use SRWINIT, you are required to create the user parameter:
Name: P_CONC_REQUEST_ID
Type: Number(15)
This will, of course, receive the concurrent request id of the report, should you need
to refer to it in the report execution.
You must select and refer to the relevant currency code for the displayed amount in
the queries.
You must specify a character width to format to.
You may optionally specify a decimal precision.
Option 3 is recommended.
Application Messages
If you are displaying boilerplate that application users may want the ability to
change, store the text in an application message and use:
fnd_message.get_string(
fnd_profile.value('XXFND_CUST_APPL_PF'),
‘application_message_name');
Note that:
Custom messages should be stored in the custom application.
Several of the Financial applications have set up information that may be useful to a
custom report. Prime amongst these are:
PO_SYSTEM_PARAMETERS;
AR_SYSTEM_PARAMETERS;
AP_SYSTEM_PARAMETERS; and
FINANCIAL_SYSTEM_PARAMETERS.
In 11i, these are views that will only return one row. If you need to refer to
information in these tables you can either:
In the beforereport trigger, select value(s) into report level placeholder column(s); or
In the data model, create a top level query in which you select the value(s) you
require. In this case you then can make a Cartesian join to the other, lower queries, as
you should only have one record here.
Key Flexfields
The user exists FND FLEXSQL and FLEXIDVAL should be used to select and display
the segments for key flexfields. Hard-coded key flexfield segment catenation is poor
programming practice. Refer to the Oracle Applications Flexfields Guide for the
relevant documentation about properly setting SELECT, WHERE, HAVING and
ORDER_BY clauses in sql code on key flexfields. Mostly used in GL, and to some
extent PO.
When you are required to modify a standard Oracle Report, avoid adding extra
tables to the FROM clause of a query. Instead, use a formula column to select the
data by referencing a unique ID in the original selected data. If you need to get
many columns of data, then use a formula column to select into placeholder columns
as required. Remember to reset each placeholder column to NULL if the formula
column does not select any data into it.
1. The original query is not modified. The data set selected by the report
should remain consistent with the original report. Bug testing should be
much easier.
2. You are able to handle the joins in any way you want: Raise application
errors, provide default values, write log file messages, whatever; whether or
not you find data or any particular type of data.
3. If Oracle release a new version of the report – it is much easier to re-
implement your customizations in this way.
Note the following ways to restrict the data being displayed in a report:
4. Hide it – Code the format trigger of the frame that displays the unwanted
record to not display the record. Note that the record information is still
calculated within the report.
5. Filter it – Code the plsql filter of the record’s data model group to return false
under the specified conditions. The data is still selected and known within
the filter (if you want to write it to the log file), but will not be calculated
within the report.
6. Restrict it – Create a lexical parameter to not select the data in the first place.
This way minimizes the amount of records to be retrieved from the database
in the first place.
Standards
In typical character reports:
7. Include page number in the form Page 1 of 20 at top right of the page
8. Include end of report and no data found messages
9. Underline boilerplate headings with dotted lines within the boilerplate item.
And give each object a meaningful name (ie do not keep a number value such as B_1,
CF_23, M_5 etc).
When you refer to operating system files, never hardcode the operating system path
to the filename, use the REPORTS60_PATH to store and find the files, e.g. place logos
in $XXCA_TOP/media and include this in the REPORTS60_PATH.
--
-- Start of custom code
--
Custom code
--
-- End of custom code
--
Comment out unneeded original code, rather than delete it, so that it remains for
reference purposes during future support.
SELECT
pl.attribute2
, pl.attribute1
FROM
po.po_linespl
, po.po_distributionspd
WHERE
pl.po_header_id = pd.po_header_id
AND pl.po_line_id = pd.po_line_id
AND perl.attribute9 = pd.po_distribution_id
AND EXISTS
(SELECT ‘is in the batch’
FROM pms.pms_expense_report_headersperh
WHERE perl.report_header_id = perh.report_header_id
AND perh.attribute4 = '&&batch')
Both of the above are acceptable. The desirable features that they demonstrate are…
All SQL reserved words shall be written in upper case text, with columns
definitions and variables written in lower case. This includes, column names,
table names and aliases.
Every clause (i.e. SELECT, FROM, WHERE, ORDER BY, GROUP BY) shall start
on a new line as shall second and subsequent occurrences of :
column names
table names
SQL reserved words
When using OR in a WHERE clause, use braces to make the meaning clear, and
to avoid mistakes relating to order of precedence of AND and OR.
-- RIGHT --
AND c.customer_id = p_customer_id
AND (t.trx_id = p_trx_idOR p_trx_id IS NULL)
-- WRONG --
AND c.customer_id = p_customer_id
AND t.trx_id = p_trx_idOR p_trx_id IS NULL
Braces “(“ and “)” that delimit clauses and nested subqueries should be aligned
vertically if this will help to clarify structure.
AND (
(x = 1 AND y = 2)
OR
(x = 3 AND y = 5)
OR
(x = 5 AND y = 7)
)
Operators and predicates should be aligned vertically.
The closing “;” can be at the end of the last line of the SQL statement or on a line
of its own after the last line.
The aim of these standards is to ensure an uncluttered and clear layout. For
unusually logically complex or long statements this ‘list’ style of presentation may
be adapted, but only where the ‘list’ style would make the SQL difficult to read
(e.g. spans too many pages) or the logic difficult to follow. The number of these
statements should be few.
e.g. the following is acceptable
WHERE x IN (1,2,5,10, 20, 30, 40, 99, 199, 500, 1000, 2000, 5000)
General Notes
Columns listed in ORDER BY clauses shall always be listed by column name,
not number, unless the statement contains the set operators UNION, MINUS
or INTERSECT.
Always explicitly list columns in an INSERT statement to prevent changes in
table structures rendering statements invalid.
Always use multi-org views, not ‘_ALL’ tables (unless all data required).
Aliases
Each column in the SQL statement shall be prefixed with a table alias, even in
SELECT statements that select rows from a single table. An alias makes an SQL
statement more readable and easily extendible, without becoming sensitive to
errors.A table alias should be no more than five characters in length.
In the SELECT list, a column alias shall be specified for all expressions and columns
modified by functions. A meaningful name shall be used for the column alias which
is not the same as the original column name.
An example SELECT statement:
SELECT t1.col1
, t1.col2
FROM table1 t1
, table1 t2
WHERE
t1.numcol <10
AND t2.numcol = 20
AND t1.keycol = t2.fkeycol
GROUP BY
t1.col1
, t1.col2;
BEGIN
l_retval := 0;
IF p_version IS NOT NULL THEN
l_version := p_version||'.';
f1 := substr(l_version, 1
, instr(l_version, '.', 1,1) - 1);
f2 := substr(l_version, instr(l_version, '.', 1,1) + 1
, instr(l_version, '.', 1,2) - (instr(l_version, '.', 1,1) + 1));
f3 := substr(l_version, instr(l_version, '.', 1,2) + 1
, instr(l_version, '.', 1,3) - (instr(l_version, '.', 1,2) + 1));
f4 := substr(l_version, instr(l_version, '.', 1,3) + 1
, instr(l_version, '.', 1,4) - (instr(l_version, '.', 1,3) + 1));
RETURN l_retval;
EXCEPTION
WHEN OTHERS THEN
RETURN ('Error in xxaxis_registry_pkg.fn_numerify_version for '||p_version||SQLERRM);
END;
Naming Cursors
The name of a cursor shall begin with "cu_", followed by a description which will
generally relate to most important table in the select statement, in lower case.
e.g. cu_lines or cu_processed_lines.
Naming Variables
PL/SQL variables, except for fields in record structures, shall not have names
identical to column names.
Local variables should be named after the database column or column alias that
will populate them, prefixed with a "l_". Local variables which do not have a
direct relation with a column shall be given a meaningful name and also prefixed
with a "l_".
Parameter variable names should be prefixed with a “p_”.
Global variables should be prefixed with “g_”.
For all variables use underscores to separate words rather than camel case. For
example use l_hdr_curr_code rather than l_hdrCurrCode or l_Hdr_Curr_Code.
Exceptions
Exceptions that can be anticipated should be catered for specifically within the
EXCEPTIONS portion of a module. A standard “catch-all” exception clause (i.e.
WHEN OTHERS) should conclude the EXCEPTIONS block.
Exception names shall be prefixed with a “ex_”. They should indicate what caused the
exception, not the actions that should be taken to handle the exception.
.... ....
END; END;
Make sure that exceptions are handled at the correct level. If a program unit does
not have sufficient knowledge to know how to treat an exception, it should pass it
up to its calling program unit to deal with.
Do not use “RAISE_APPLICATION_ERROR” in your Oracle Applications
program code. Leave that to Oracle Applications.
Approach to Development
Think “modular”. Big complex programs should be built using smaller modules or
program units. These modules should in turn be built from even smaller modules
where possible.
Each little module should work in its own right and once it has been thoroughly unit
tested you can rely on it to work every time i.e. given inputs A and B expect output Y,
but for inputs C and D expect output Z. This leaves you free to look at the bigger
picture.
Each module should be able to give a clear error message when something in it goes
wrong, informing the user which module is calling and what the problem is.Make
sure that error messages are informative and accurate rather than cryptic and
misleading as they often can be. Provide enough information to enable the support
staff to quickly find out what has gone wrong.
If you create a program unit that might be useful to other developers, consider
placing it in a generic package where it can be made available to other programs.
Besides thinking in modules it can also be useful to think in terms of “layers”. Deep
down we have the most generic layer, then we build a layer on top of this which is
less generic but which re-uses code from the generic layer. On top of that we can add
further layers as necessary. Keeping the concepts of modules and layers in mind
during development can help us to write robust high quality code.
When developing, remember the principle of “Plan Do Check Act”. Keep cycling
through this process as you develop until you are confident that your program is
working as it should.
No hard-coding!
Hard-coding is poor programming practice.Do not include any numbers or string
values in your program code unless there is zero possibility that they will ever have
to be changed in the future.
Constants should be assigned all together in a list where they can easily be located
and updated. Suitable places for such lists are at the beginning of the program or in
at the top of a package spec. Unless the purpose of a constant is obvious from its
name, a comment should be included to indicate what it is used for.
Aim to limit the number of constants used in concurrent programs by instead passing
the values in as hidden parameters with default values.
Get values from the database where possible rather than assigning a value to a
constant e.g.
SELECT generate_customer_number
INTO g_generate_customer_number
FROM ar_system_parameters
;
ratherthan
g_generate_customer_number := ‘Y’;
Lower case is preferred for install script filenames. If many existing scripts ar in
uppercase it may not be worthwhile changing them. This decision will be made
during the project initiation stage.
Packages offer many advantages including ease of maintainance and encouragement
of a more modularand tidy programming style through use of private functions and
procedures and package variables and cursors.
------------------------------------------------------------------------
-- create_code_combination
-- Verify a code combination and if it does not exist and it does not
-- violate any cross validation rules then create the code combination.
-- p_coa_id = chart of accounts id
-- p_concat is the concatenated code combination string e.g.
-- '01.0000.3111.00.00.000'
-- Return the ccidif it is valid otherwise return NULL
-------------------------------------------------------------------------
FUNCTION create_code_combination ( p_coa_id IN NUMBER
, p_concat IN VARCHAR2)
RETURN NUMBER;
Comments should not echo the code. They should add some extra information
to make the code more understandable, particularly by explaining steps whose
purpose is not clear from looking at the code. If an implementation strategy is
chosen for a particular reason, then comments should be added to explain the
decision.
Great care must be taken in the use of database triggers as they have the capability, if
not used correctly, to completely trash a database. It is recommended that custom
database triggers are only used for very simple activities such as logging or auditing
tasks or to automate some process required to support a de-normalisation design
decision (e.g. maintain an order total as the sum of all order line values). Remember
that database triggers are performed synchronously so that the database activity that
invoked them will not complete until all activities within the trigger complete.
Remember, also, that if a trigger is used to update another table and that other table
has triggers as well then these triggers must complete.
A custom trigger that is not behaving properly can cause major problems in the
application which are very difficult to track down
Exception handlers in triggerscan be coded to make sure that there is no doubt as to
the source of an unexpected Oracle Applications error message.
WHEN OTHERS THEN
fnd_message.set_name('GL','XXBATCHES_TR1');
fnd_message.set_token
('TRIGGER_NAME','XXGST_JRNL_GL_JE_BATCHES_TR1');
fnd_message.set_token
('MSG', 'GST toolkit trigger exception: '
||''||SQLERRM);
app_exception.raise_exception;
To improve performance, include all trigger logic in a database package and call the
package code from your database trigger.
Data Models
All data models created for reports developed in Oracle Fusion can have a maximum
of 100 characters. To indicate that the object is a data model, it shall be prefixed with
‘TS’ will be the short name of the client (TransSys) whom the project is executed for.
The name shall be suffixed with DM to denote that it is a data model. This is needed
to have clarity in archival and un archival process.
Data Set
Ex: TS Purchase Order Header DS
DS - Group
TS – Client Name
Purchase Order Header – Object Group Name
Groups
Ex: TS Purchase Order Lines GR
GR- Group
TS – Client Name
Purchase Order Lines – Object Group Name
Template
All Templates developed in Oracle Fusion can have a maximum of 100 characters. To
indicate that the object is a Template, it shall be prefixed with ‘TS’ will be the short
name of the client (TransSys) whom the project is executed for.
Reports
All reports developed in Oracle Fusion can have a maximum of 100 characters. To
indicate that the object is a report, it shall be prefixed with ‘TS’ will be the short name
of the client (TransSys) whom the project is executed for. The name shall end with the
Parameters
All report parameters should follow the convention of starting with “P_” followed by
a meaningful name. This shall be in lower case only.
Parameters Validations:
Ordering by the Parameters with Hierarchical
Dependent or Independent of the parameters
Date validations:
From Date must be sysdate or less than sysdate
To Date must be greater than or equal to From Date and not greater than sysdate.
Where ever possible provide list of values (value set attached to the parameters).
All report outputs shall have a prescribed format to maintain uniformity across reports
developed in Fusion. The formatting shall be as below, unless explicitly provided by
client. Any change from the below standards whether or not it is requested by client
and regardless of the volume of change shall be incorporated in objects only with the
prior approval from Quality team. Approval mail or document from Quality team
shall have to be preserved to back up such deviations.
Script Organization
All database object creation scripts will use the CREATE OR REPLACE <object
name> syntax so that they can be rerun on demand. Do not include a DROP
statement for a custom table that may include important data unless you are
absolutely sure that it can do no harm if the script is re-run at a later stage.
A grant/synonym script may also be required to give access to database objects that
do not belong to APPS. Scripts may also launch concurrent programs to register
program modules or load interface tables as needed.
Open Issues
Closed Issues