extending ebs

74
Extending the E-Business Suite with Application Express (APEX) OR Finding joy in our job

Upload: shobaki

Post on 13-Apr-2016

254 views

Category:

Documents


0 download

DESCRIPTION

Extend EBS

TRANSCRIPT

Page 1: Extending Ebs

Extending the E-Business Suite

with Application Express

(APEX)

OR

Finding joy in our job

Page 2: Extending Ebs

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

Page 3: Extending Ebs

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

Page 4: Extending Ebs

Possible Use Cases

Page 5: Extending Ebs

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/developer-

tools/apex/learnmore/apex-ebs-extension-white-paper-345780.pdf

MOS Note 1306563.1 provides the scripts but links to an older version of the White Paper (Revision 1,

dated December, 2012)

Page 6: Extending Ebs

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

Page 7: Extending Ebs

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

Page 8: Extending Ebs

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

Page 9: Extending Ebs

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)

Page 10: Extending Ebs

Architecture

• E-Business Suite Database

APPS

SchemaCUSTOM

Schema

Grant Select

EBS APIs

APEX

Engine

Page 11: Extending Ebs

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_objectsWHERE object_name = ‘F’;

Page 12: Extending Ebs

The ‘f’ Procedure and the URL

DESC F;

Page 13: Extending Ebs

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

Page 14: Extending Ebs

Options for the HTTP Listener

Embedded PL/SQL GatewayPossible problem with scalability

ApacheHighly scalable

Doesn’t support some APEX 4 features

Oracle REST Data Services (formerly the APEX Listener)

Generally recommended

Implementation options

Page 15: Extending Ebs

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

Page 16: Extending Ebs

Apache

� Very scalable

� Proven technology

� Licensing may be an issue

� Doesn’t support some newer APEX functions

� RESTful web services

� PDF printing

Page 17: Extending Ebs

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

Page 18: Extending Ebs

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

Page 19: Extending Ebs

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

Page 20: Extending Ebs

Key Terms

■ Users:

▪ Instance Administrator

▪ Workspace Administrator

▪ Developer

▪ End User

Page 21: Extending Ebs

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

Page 22: Extending Ebs

Potential Gotchas

• LOV – List of Values to be selected

• Can allow multiple selections

• Source: Static List or SQL query

List – a navigation aid

Can use images or text

Page 23: Extending Ebs

Overview

Suggest you create an APEX application before starting the White Paper’s 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.

Page 24: Extending Ebs

Differences in 4.2

Page 25: Extending Ebs

Differences in 5.0

• Grid Layout is a paradigm shift

Page 26: Extending Ebs

Differences in 5.0

• Multi-item editing

Page 27: Extending Ebs

Differences in 5.0

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

In White Paper, this field is called

“Item Containing Primary Key Column Value”

Page 28: Extending Ebs

Free Workspace

https://apex.oracle.com/

Good place to learn APEX fundamentals

No E-Business Suite

Page 29: Extending Ebs

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)

Page 30: Extending Ebs

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

Page 31: Extending Ebs

Configure APEX

Within APEX

� Create a workspace

� Create users

� Developer(s) to create app

� End User(s) to test

� Create the application

Page 32: Extending Ebs

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

Page 33: Extending Ebs

Programming Best Practices

• Do NOT perform direct updates to seeded tables!

• Will bypass Oracle’s validation and referential

integrity

– Use published APIs

– with instead-of triggers

– direct calls from the APEX code

• Can use FND_SUBMIT for intensive updates

Page 34: Extending Ebs

Programming Best PracticesDirect 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 );

Page 35: Extending Ebs

Programming Best PracticesAPI = 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;

Page 36: Extending Ebs

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 0spool grantem.sql

SELECT 'grant select, insert, update, delete on '||owner||'.'||table_name||' to polk_apex_sand;' FROM dba_tables WHERE owner = 'APPS';

spool off

Page 37: Extending Ebs

Better Solution to Public API Problem

create or replace procedure polk_create_irec_user

( v_user_name IN varchar2,

v_password IN varchar2,v_email IN varchar2,v_last_name IN varchar2,v_first_name IN varchar2 )

authid definer

ASBEGINapps.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;

Definer = author

Not current user

Compile as APPS

Grant execute to apex_userCall from apex_user

Page 38: Extending Ebs

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

Page 39: Extending Ebs

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

Page 40: Extending Ebs

Install APEX

■ Change Admin password apxchpwd.sql

■ Alter User APEX_PUBLIC_USER Account Unlock

■ Alter User APEX_PUBLIC_USER Identified by <password>;

Page 41: Extending Ebs

Install APEX

■ Password Expiration in 11gIn 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

Page 42: Extending Ebs

Install APEX on R12.2

■ Must update the custom schema to enable Edition-Based 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

Page 43: Extending Ebs

Deploy to Glassfish

Oracle® REST Data ServicesInstallation, Configuration, and Development Guide Release 3.0

Chapters on:1. Configuring ORDS

2. Deploying ORDS to: GlassfishWeblogic

Apache Tomcat

Page 44: Extending Ebs

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]:

Page 45: Extending Ebs

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

Page 46: Extending Ebs

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

Page 47: Extending Ebs

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

Page 48: Extending Ebs

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 …

Page 49: Extending Ebs

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

Page 50: Extending Ebs

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

Page 51: Extending Ebs

Create the List

Page 52: Extending Ebs

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.

Page 53: Extending Ebs

Terminology Gotchas

■ Page 0 is now the Global Page

▪ One Global Page per application, per interface

— Desktop UI

— Mobile UI

Page 54: Extending Ebs

Install Sample Application

• apexebs_apps_setup.sql

As APPS

• apexebs_apex_setup.sqlAs apex_ebs schema

• apexebs_apex_application_rev2.sqlWithin the application builder (creates the app if you don’t

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

Page 55: Extending Ebs

Manually Create Application

Page 56: Extending Ebs

Create A Form

Page 57: Extending Ebs

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

Page 58: Extending Ebs

Create a Form

Page 59: Extending Ebs

Create a Form

Page 60: Extending Ebs

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

);

Page 61: Extending Ebs

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

Page 62: Extending Ebs

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

Page 63: Extending Ebs

Define Function

Page 64: Extending Ebs

Define Function Without Responsibilities

GWY.jsp?targetAppType=APEX&p=105:1

Application ID = 105, Page 1

Page 65: Extending Ebs

Define Function With ResponsibilitiesPassing 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]

Page 66: Extending Ebs

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 -------------------------------------------------------

Page 67: Extending Ebs

Menu

Add the functions to a menu

Page 68: Extending Ebs

Responsibility

Page 69: Extending Ebs

User

Page 70: Extending Ebs

APEX User Home Page

Page 71: Extending Ebs

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

Page 72: Extending Ebs

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 developer’s responsibility to use the templates and arrange content to achieve truly responsive interface

� Not a “native” app – no access to GPS or camera

Page 73: Extending Ebs

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, D’Souza, 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 BeginnersRiaz Ahmed

� Blogs: David Peake, Dimitri Gielis, Martin D’Souza

Page 74: Extending Ebs