Extending the E-Business Suite
with Application Express
(APEX)
OR
Finding joy in our job
Why APEX?
Rapid Application Development
Shorter learning curve than OAF, ADF, MAF
Avoid customizations
No impact on patching and upgrading
Fun and Free! But check with Oracle
EBS limited use license does NOT allow for an
additional schema
Fully supported by Oracle
Possible Use Cases
Real time access to EBS data
Additional reporting and analysis
Simple and customized export of data
Deliver new business functionality
Custom ordering system
Searchable personnel directory
Custom data collection
Personalization of complex EBS workflows
APEX can NOT be used to customize EBS
pages or forms
Possible Use Cases
White Paper
Extending Oracle E-Business Suite Release 12.1
and above using Oracle Application Express
Revision 2.01,
Dated March, 2015
http://www.oracle.com/technetwork/developertools/apex/learnmore/apex-ebs-extension-white-paper345780.pdf
MOS Note 1306563.1 provides the scripts but links
to an older version of the White Paper (Revision 1,
dated December, 2012)
Prerequisites for the
White Paper Sample
Oracle E-Business Suite ( 12.1.3)
Fully licensed Oracle Database ( 10.2.0.3)
Oracle Application Express ( 4.2)
Oracle REST Data Services ( 2.0)
Oracle WebLogic Server ( 12c)
Can use Oracle Glassfish Server or Apache Tomcat
For Oracle E-Business Suite Release 12.1, patch
9659153:R12.FND.B is required
Need patch 12316083
30,000 ft Overview
Create an APEX Application
Configure APEX Login Process
Define APEX Authorizations
Define EBS Profile Option and Functions
Link Functions to Menu and Responsibility
What is APEX?
Rapid Application Development tool
Similar to Microsoft Access
Flows Oracle Platform Project Marvel HTML DB Application Express (APEX)
Tightly coupled with the Oracle database
Declarative (what to do rather than how to do it)
Use Wizards and Templates to create applications
The applications created by APEX are accessed
through a web browser
Architecture
Applications are stored as meta-data in the
database (Not the APPS server)
Procedures generate HTML
The meta-data is used to render pages and
processing
Can be installed on 10gR2 and above
Development and runtime access is 100 %
browser based (no client software - ever)
Architecture
E-Business Suite Database
Grant Select
APPS
Schema
CUSTOM
Schema
EBS APIs
APEX
Engine
The f Procedure and the URL
http://myserver.com:8080/ords/dev/f?p=XXX:Y:zzz
F is a PL/SQL procedure that generates APEX pages
f is from flow, APEX was once called Project Flows.
SELECT owner, object_type
FROM dba_objects
WHERE object_name = F;
The f Procedure and the URL
DESC F;
Changes in R12
In 11i, access to APEX apps was processed via
mod_plsql in Application Server
In R12, enabling mod_plsql is not supported and
can put your support at risk
For R12, use Apache, Oracle REST Data Services
within Oracle Glassfish or WebLogic, or
Embedded PL/SQL Gateway
APEX will use JSP but wizards make it simple
Options for the HTTP Listener
Embedded PL/SQL Gateway
Possible problem with scalability
Apache
Highly scalable
Doesnt support some APEX 4 features
Oracle REST Data Services
(formerly the APEX Listener)
Generally recommended
Implementation options
Embedded PL/SQL Gateway
Very easy to use
Requires Shared Server
Cannot separate the listener tier from the database
tier (less secure)
Possible issues with session management
Apache
Very scalable
Proven technology
Licensing may be an issue
Doesnt support some newer APEX functions
RESTful web services
PDF printing
Oracle REST Data Services
(replaces the APEX Listener)
Generally recommended as best choice
Supports latest APEX features
Redirects call to APEX applications to the APEX
run-time engine
Accepts RESTful Web Service call URIs
Can marshal data from SQL to .csv or JSON
formats
Deployment options
Glassfish (free)
Weblogic (extra license)
Third party container
Key Terms
Representational State Transfer (REST) is an architectural
style that specifies constraints, such as the uniform interface,
that if applied to a web service induce desirable properties,
such as performance, scalability, and modifiability, that
enable services to work best on the Web. -Whew!
A RESTful service provides access to resources (web pages,
pictures, videos, information, etc.) in a lightweight,
maintainable and scalable manner.
Bottom line difference for most developers:
myserver.com:8080:/apex/f?p=400:103
myserver.com:8080:/ords/f?p=400:103
Key Terms
Schema (database):
Collection of database objects owned by a user
Parse As Schema the default schema of the
user/app
Workspace (APEX):
Logical container for one or more application(s)
Separate, self contained development
environment
Contains applications, users, and schemas
Key Terms
Users:
Instance Administrator
Workspace Administrator
Developer
End User
Key Terms
Session: a series of related browser requests
Session State: variables representing APEX items
and their values, maintained on the server
Submit: an operation that saves the values of the
items in the corresponding session state variable
before rendering a target page
Redirect: an operation that renders a target page
without saving values to the session state
Potential Gotchas
List a navigation aid
Can use images or text
LOV List of Values to be
selected
Can allow multiple selections
Source: Static List or SQL query
Overview
Suggest you create an APEX application before
starting the White Papers application.
Get familiar with newer screens in the wizards and
with the location of development items.
Some steps have been combined in newer
versions
Plenty of good books, websites, and blogs.
Differences in 4.2
Differences in 5.0
Grid Layout is a paradigm shift
Differences in 5.0
Multi-item editing
Differences in 5.0
In White Paper, this field is called
Item Containing Primary Key Column Value
Page 28: Create a region Type of Region HTML
IN 5.0 the Type is Static Content
Under Attributes, you can find
Output As which is set to HTML
Free Workspace
Good place to learn APEX fundamentals
No E-Business Suite
https://apex.oracle.com/
Install APEX
Download APEX (5.0) and Installation Guide from
OTN
Install APEX (in database)
Download and install Glassfish
Download and register Oracle REST Data
Services with Glassfish (war file)
Install APEX
Configure database for APEX
Create a user/schema in the database
(APEX_USER)
Create views and instead-of triggers in APPS
Grant select on views to APEX_USER
Configure APEX
Within APEX
Create a workspace
Create users
Developer(s) to create app
End User(s) to test
Create the application
Installation Best Practices
Create custom applications in a separate schema
Create the custom tables, views, triggers,
sequences in custom schema
Create views on APPS tables
Grant select privileges on APPS views to APEX
user as necessary
Programming Best Practices
Do NOT perform direct updates to seeded tables!
Will bypass Oracles validation and referential
integrity
Use published APIs
with instead-of triggers
direct calls from the APEX code
Can use FND_SUBMIT for intensive updates
Programming Best Practices
Direct Update = Bad
INSERT INTO FND_USER
( USER_ID
, USER_NAME
, PASSWORD
, START_DATE
, EMPLOYEE_ID)
VALUES
( fnd_user_seq.nextval
,
[email protected], oracle12
, sysdate
, 1234
);
Programming Best Practices
API = Good
DECLARE
v_user_id number;
BEGIN
v_user_id := fnd_user_pkg.createuserid
( x_user_name =>
[email protected], x_unencrypted_password => oracle12
, x_start_date => sysdate)
, employee_id => 1234;
COMMIT;
END;
Problem with EBS Public APIs
ORA-00942: table or view does not exist
Per Service Request - Users should:
Grant SELECT, INSERT, UPDATE and DELETE privileges
to your non-APPS schema for all tables owned by APPS
set pages 0
spool grantem.sql
SELECT 'grant select, insert, update, delete on
'||owner||'.'||table_name||' to polk_apex_sand;'
FROM dba_tables
WHERE owner = 'APPS';
spool off
Better Solution to
Public API Problem
create or replace procedure polk_create_irec_user
( v_user_name IN varchar2,
Definer = author
v_password
IN varchar2,
v_email
IN varchar2,
Not current user
v_last_name
IN varchar2,
Compile as APPS
v_first_name IN varchar2 )
authid definer
Grant execute to apex_user
AS
Call from apex_user
BEGIN
apps.irc_party_api.create_user
(p_user_name
=> v_user_name
,p_password
=> Thursday123'
,p_start_date
=> 16-APR-2015'
,p_responsibility_id
=> 23350
,p_resp_appl_id
=> 800
,p_security_group_id
=> 0
,p_email
=> v_email
,p_last_name
=> v_last_name
,p_first_name
=> v_first_name );
commit;
dbms_output.put_line ('User:'||v_user_name||'Created Successfully');
EXCEPTION
when others then
dbms_output.put_line (Cant create User due to'||SQLCODE||' '||SUBSTR(SQLERRM, 1, 100));
rollback;
END;
Programming Best Practices
APEX wizards (used to) require primary keys
Wizards make life simple, but need primary keys
Create views on seeded tables with an arbitrary
primary key (2 columns at most)
Modify APEX pages row processing (created by
the wizards) to call APIs
Or call APIs via INSTEAD OF triggers on views
Install APEX
Apexins.sql Parameters
APEX tablespace - APEX application user
Not SYSAUX!
Files tablespace - APEX files
Not SYSAUX!
Temporary tablespace
Images - /i/ - virtual directory for APEX images
* SYSAUX belongs to Oracle
Install APEX
Change Admin password apxchpwd.sql
Alter User APEX_PUBLIC_USER Account Unlock
Alter User APEX_PUBLIC_USER Identified by
<password>;
Install APEX
Password Expiration in 11g
In 11g default profile PASSWORD_LIFE_TIME is
180 days. At expiration the APEX instance will be
unusable until the password is reset.
Consider creating separate profile for APEX:
CREATE PROFILE APEX_PROFILE LIMIT
PASSWORD_LIFE_TIME UNLIMITED;
ALTER USER APEX_PUBLIC_USER PROFILE APEX_PROFILE;
Apply Patch 12726556 Launching APEX From
Forms Navigator
Install APEX on R12.2
Must update the custom schema to enable EditionBased Redefinition (EBR)
Register the schema within E-Business Suite
See Registering an Oracle Schema Chapter 6
of the E-Business R12.2 Suite Maintenance
Guide
Apply Patch 12726556 Launching APEX From
Forms Navigator AFTER enabling EBR
Deploy to Glassfish
Oracle REST Data Services
Installation, Configuration, and Development Guide
Release 3.0
Chapters on:
1. Configuring ORDS
2. Deploying ORDS to:
Glassfish
Weblogic
Apache Tomcat
Configure ORDS
PL/SQL Gateway is not Embedded PL/SQL
Gateway!
If you plan to use APEX with ORDS you MUST configure the
PL/SQL Gateway.
The PL/SQL Gateway is what provides the mod_plsql like
functionality to invoke PL/SQL procedures in the database
This step creates the apex.xml file. Without an apex.xml file APEX
will not be accessible (or any other PL/SQL procedures).
Bottom line when configuring ORDS, be sure to reply with 1
to:
Enter 1 if you want to use PL/SQL Gateway or 2 to skip this step [1]:
Security
Authentication
Who are you?
Controls access to application (the doorman)
Authorization
What are you allowed to do? (the bartender)
Controls access to forms, pages, buttons, etc.
and to data
Authentication (the doorman)
Preconfigured schemes
Single Sign On
Oracle Access Manager
Custom Scheme
In APP - PL/SQL function to validate user
based on username and password
In APEX define an authorization scheme to
use the function
Authorization (the bartender)
Apply Authorization to all non-public pages, not just
menus.
Can be applied to almost any component of an
application (i.e. pages, regions, buttons, items)
Session State Protection
The URLs can be manipulated to circumvent security
Managing Application Security Understanding
Session State Protection
Session State Protection
Session State Protection uses the Page Access
Protection attributes and the Session State
Protection item attributes with checksums
positioned in f?p= URLs to prevent URL tampering
and unauthorized access to and alteration of
session state.
--Oracle Application Express Application
Builder User's Guide Release 4.2
Think changing f?p=200:1 to f?p=300:12
Custom Authorization
Note: There is a typo in Revision 1 of the White Paper.
The last RETURN statement should read function_test not
function.test (underscore, not period)
--Included in apexebs_apps_setup.sql
Custom Authorization
Edit the Page
Double click the page title
On the Security tab, assign the custom scheme and
set the page to require authentication
Create the List
List Region (not in white paper)
By selecting Do not create list regions(s) we can
add a List Region to the Global Page or to any page
we choose later.
Terminology Gotchas
Page 0 is now the Global Page
One Global Page per application, per interface
Desktop UI
Mobile UI
Install Sample Application
apexebs_apps_setup.sql
As APPS
apexebs_apex_setup.sql
As apex_ebs schema
apexebs_apex_application_rev2.sql
Within the application builder (creates the app if you dont
want to do it manually)
Be sure to download the _rev2 file from the White Paper,
not the version in Note 1306563.1 as of February 2015
Manually Create Application
Create A Form
Create a Form
Forms perform insert, update and delete
operations on table rows in the database. The
rows are identified using either a Primary Key
defined on the table, or the ROWID pseudo
column, which uniquely identifies a row in a table.
Select "Managed by Database" if you would like to
use the ROWID. Otherwise select the Primary Key
column(s) defined for your table or view.
Forms support up to two columns in the Primary
Key. For tables using Primary Keys with more than
two columns, the ROWID option should be used
Create a Form
Create a Form
Processing Code in a Page
PL/SQL Page Process
apps.apex_integration_sample_apis.apex_update_email
( p_username => :APP_USER
, p_owner => :APP_USER
, p_email_address => :P2_EMAIL_ADDRESS
);
Profile Option
In 11i, a mod_plsql procedure could redirect the
user to APEX
In R12, a JSP is used. This is configured by setting
a Profile Option and defining functions to point to
the APEX pages
Call APEX from APPS Menus
Create form function with type : SSWA jsp function
An HTML call to the APEX app
Application number, Page number, and
parameters
Add the form function to an APPS menu
Assign the menu to a responsibility
Assign the responsibility to a user
Define Function
Define Function Without Responsibilities
GWY.jsp?targetAppType=APEX&p=105:1
Application ID = 105, Page 1
Define Function With Responsibilities
Passing Parameters
GWY.jsp?targetAppType=APEX&p=105:3:::::
EBS_RESP_ID, EBS_APP_ID,
EBS_SEC_GROUP:[RESPONSIBILITY_ID],
[RESP_APPL_ID], [SECURITY_GROUP_ID]
Application Items in APEX
GWY.jsp?targetAppType=APEX&p=105:3:::::
------------------------------ APEX Application Items -----------------------------------------
EBS_APP_ID,
EBS_RESP_ID,
EBS_SEC_GROUP:
[RESP_APPL_ID], [RESPONSIBILITY_ID], [SECURITY_GROUP_ID]
--------------------------- EBS Values -------------------------------------------------------
Menu
Add the functions to a menu
Responsibility
User
APEX User Home Page
Security
Easy to deploy to production
Export the application (generates a SQL script)
Provide script to DBA
DBA executes the script
Use DEV TEST PROD model
Security configuration in TEST should be
identical to PROD
In PROD, run APEX in run only mode
Mobile Apps with APEX
Responsive Design
Techniques to create content that can dynamically adapt to
fit screens on phones, tablets, and computers
Page items resize and realign to conform to different
screen sizes
APEX 4.2 introduced Theme 25
Templates for responsive design
Not automatic it is the developers
responsibility to use the templates and arrange
content to achieve truly responsive interface
Not a native app no access to GPS or camera
References
Extending Oracle E-Business Suite Release 12.1 and above using
Oracle Application Express Revision 2.0 March 2015
MOS Note 1306563.1 Extending Oracle E-Business Suite Release
12 using Oracle Application Express
Beginning Oracle Application Express 4.2 (NOT 4)
Gault, Cannell, Cimolini, DSouza, St. Hilaire
Oracle Application Express for Mobile Web Applications
Hartman, Rokitta, Peake
Understanding APEX 4.2 Application Development
Edward Sciore
Oracle Application Express 5 For Beginners
Riaz Ahmed
Blogs: David Peake, Dimitri Gielis, Martin DSouza