Sunteți pe pagina 1din 21

Business Events in Oracle Order Management

(An Oracle White Paper, May 2009)

by Srecko Bartl, Sarath Nimmagadda and Vaibhav Kapoor


Document Structure ............................................................................................................ 3
Intended Users .................................................................................................................... 3
Documentation References ................................................................................................. 3
Introduction......................................................................................................................... 4
The Oracle Workflow Business Event System ........................................................................... 4
Business Events in Oracle Order Management ........................................................................... 5
Business Event oracle.apps.ont.oi.xml_int.status .................................... 6
Set-Up Considerations .......................................................................................................... 6
Parameter Details ................................................................................................................. 6
When raised due to Processing Constraint setup ........................................................ 6
When raised due to Workflow Sub-process setup ...................................................... 6
Business Event oracle.apps.ont.genesis.outbound.update...................... 6
Set-Up Considerations .......................................................................................................... 6
Parameter Details ................................................................................................................. 6
Use Case – A Fully Functional Custom Extension............................................................. 6
Requirement ....................................................................................................................... 6
Setup ................................................................................................................................. 6
Conclusion .......................................................................................................................... 6

Business Events in Oracle Order Management Page 2 of 21


Document Structure

This document starts with a brief introduction of Workflow Business Events as available with
Oracle e-Business Suite Technology Stack.

Next, the business events supported out of the box by Oracle Order Management are described.
The salient parameters associated with these business events are explained.

Subsequent sections of the white paper elaborate the set up to be done by Oracle Order
Management Administrator/Super User, to enable Order Management to emit business events
with relevant payload (of event parameter values).

Towards the final phases of the document, an illustrated example delineating the integration
process (defining subscriptions to the business events) is presented in Use Case – A Fully
Functional Custom Extension.

Intended Users

Oracle Applications System Administrators, and Third-Party System Integrators find the
information contained in this document particularly useful.

Documentation References

o Oracle Applications - Order Management Open Interfaces, API & Electronic Messaging
Guide, part # B14446-01, Chapter 7 (Electronic Messaging Technical Information) and
Chapter 8 (Electronic Messaging Implementation Considerations).
o Oracle Workflow – Administrators’ Guide, API Reference Guide, and Developers’ Guide.

Business Events in Oracle Order Management Page 3 of 21


Introduction

The Oracle Workflow Business Event System

The Oracle Workflow Business Event System is an application service that leverages the Oracle
Advanced Queuing (AQ) infrastructure to communicate business events between application
systems. The Business Event System consists of the Event Manager and workflow process event
activities.

The Event Manager contains a registry of business events, systems, named communication agents
within those systems, and subscriptions indicating that an event is significant to a particular
system. Events can be raised locally or received from an external system or the local system
through AQ.

When an event occurs, the subscribing code gets executed.

Subscriptions can include the following types of processing:

o Executing custom code on the event information


o Sending event information to a workflow process
o Sending event information to other queues or systems.

The uses of Business Event System include:

1. System integration messaging hubs


2. Distributed applications messaging
3. Message-based system integration
4. Business event based workflow processes
5. Customization of packaged applications in a non-invasive manner

Business Events in Oracle Order Management Page 4 of 21


Business Events in Oracle Order Management

Subject to the completion of certain set-up steps, Oracle Order Management raises Business
Events at salient points during the processing of a given sales order. This allows for the use:
Customization of Oracle Order Management in a non-invasive manner – simply by registering suitable
subscriptions to the relevant Business Events.

The following table displays a quick summary of Business Events raised by Order Management:

Activity of Interest in Order Name of the Business Event Raised by Order


Supported by
Processing Management
Processing of Electronic
Messages (XML, EDI Automatically by
oracle.apps.ont.oi.xml_int.status
transactions) and seeded workflows.
Order Import.
Create a sales order (line); Defining a
Modify a sales order (line); processing constraint
and of type: oracle.apps.ont.oi.xml_int.status
Cancel a sales order (line). Raise Integration
Event.
Status Change Utilizing the seeded
workflow sub-
process “Raise Show
Sales Order Event
oracle.apps.ont.oi.xml_int.status
Sub Process” (of
workflow item type
OESO i.e., “OM Show
Sales Order”)
Apply a hold; For sales orders
Release a hold; some flow created from order
oracle.apps.ont.genesis.outbound.update
status changes sources marked as
“AIA Enabled”

Oracle.apps.ont.oi.xml_int.status is available in release 11i and up.


Oracle.apps.ont.genesis.outbound.update is available in 11i10 and R12.1 and up, but not in
R12.0.x.

Business Events in Oracle Order Management Page 5 of 21


Business Event oracle.apps.ont.oi.xml_int.status

Set-Up Considerations

A raise of this event by Order Management is controlled by the profile option: OM: Electronic
Message Integration Event Sources. The possible values are XML (default value), XML & EDI and
All.

This profile determines order sources that are capable of raising this business event. The Order
Management Super User sets this profile option value accordingly.

Parameter Details

The event oracle.apps.ont.oi.xml_int.status is raised with the following parameters:

Parameter Name Parameter Description Comments


XMLG_INTERNAL_CONTROL Unique document number generated by Overloaded to
_NUMBER XML Gateway for inbound messages. provide a unique
id for EDI
inbounds and
Order Import as
well.
XMLG_MESSAGE_ID Unique message id generated
by XML gateway for
outbound messages.
XMLG_INTERNAL_TXN_TYPE Typically 'ONT' except for
Confirm BOD which is owned
by 'ECX'.
XMLG_INTERNAL_TXN_SUB TYPE Identifies XML transaction Overloaded to
Type. contain
EDI and Order
Import
transaction type,
namely '850',
'860', '855',
'865', 'GENERIC'
DOCUMENT_DIRECTION 'IN' or 'OUT'
XMLG_DOCUMENT_ID Unique ID provided by OM Overloaded to
for outbound messages. provide a
unique identifier
for outbound EDI
transactions.
TRADING_PARTNER_TYPE 'C'
TRADING_PARTNER_ID TP Party ID
TRADING_PARTNER_SITE TP Party Site ID
DOCUMENT_NO Sales Order Number
ORG_ID Organization ID
PARTNER_DOCUMENT_NO Purchase Order Number
DOCUMENT_REVISION_NO Change Sequence
ONT_DOC_STATUS 'ACTIVE', 'SUCCESS',
'ERROR'
MESSAGE_TEXT FND MESSAGE detailing
what has occurred.
WF_ITEM_TYPE Workflow Info for XML/EDI

Business Events in Oracle Order Management Page 6 of 21


Processing.
WF_ITEM_KEY Workflow Info for XML/EDI
Processing.
ORDER_SOURCE_ID Order Source
SOLD_TO_ORG_ID Customer ID
ORDER_TYPE_ID Order Type ID
CONC_REQUEST_ID Processing Concurrent
Request ID
PROCESSING_STAGE Code to identify why this
event was raised. Sample
values include
'INBOUND_IFACE',
'OUTBOUND_SENT'.
SUBSCRIBER_LIST Comma delimited list of
product short names of the
intended subscribers e.g.,
'ONT,CLN'.
DOCUMENT_STATUS 'SUCCESS', 'ERROR'
RESPONSE_FLAG 'Y' for 3A8 Change PO
Response documents
HEADER_ID Order Header identifier
LINE_IDS Only applicable for events
raised via Processing
Constraints.

It may be noted that not every parameter will be populated in all cases, as described in
subsequent sections.

When raised due to Processing Constraint setup

The following table contains a Y if a particular parameter is populated for Processing Constraint
based Event Raise:

Parameter Name Parameter Populated (Electronic Message


Types)
DOCUMENT_NO Y
ORG_ID Y
PARTNER_DOCUMENT_NO Y
DOCUMENT_REVISION_NO Y
ORDER_SOURCE_ID Y
SOLD_TO_ORG_ID Y
HEADER_ID Y
SUBSCRIBER_LIST Y ('DEFAULT')
LINE_IDS Y
Colon-delimited string of Line Ids for
Line-level triggering. NULL for header-level
triggering.

Note : Regarding the colon-delimited string of Line Ids for line-level triggering: if the values
populating the line_id string exceed 2000 characters, the relevant business event will be raised
multiple times. The Raise Integration Event operation in the Processing Constraints window
will not fail because the line_id string can accommodate more characters.

When raised due to Workflow Sub-process setup

The following table contains a Y if a particular parameter is populated for workflow sub-process
based event raise (using the Raise Show Sales Order Event Sub Process):

Business Events in Oracle Order Management Page 7 of 21


Parameter Name Parameter Populated (Electronic Message
Types)
DOCUMENT_NO Y
ORG_ID Y
PARTNER_DOCUMENT_NO Y
DOCUMENT_REVISION_NO Y
ORDER_SOURCE_ID Y
SOLD_TO_ORG_ID Y
ORDER_TYPE_ID Y
HEADER_ID Y
SUBSCRIBER_LIST Y ('DEFAULT')
LINE_IDS Y ('ALL')

Note : Because the event passes no useful line id as its parameter, “Raise Show Sales Order Event
Sub Process” is only suitable to raise events from header-level (“OM Order Header”) workflow
processes. To raise events from a line-level (“OM Order Line”) workflow process, you can add
Event nodes to its definition, with Event Action = Raise, the desired Event Name, and with line id
as one of the parameters. Standard activity “Set Event Property” can be used to set the parameter
value(s) as desired. For more details on this topic, see Oracle Workflow Developer’s Guide.

Business Event oracle.apps.ont.genesis.outbound.update

Set-Up Considerations

This business event is raised for orders that are generated from an order source marked as “AIA
Enabled” in the Order Import Sources definition.

This event is raised on such orders after they are booked and:

1. A hold is applied.
2. A hold is released.
3. Flow status code on the order header/line is changed to Supply Eligible, Awaiting
Shipping, Shipped, Fulfilled or Closed.
4. Schedule Ship/Arrival Date is changed.

Business Events in Oracle Order Management Page 8 of 21


Parameter Details

Parameter Name Parameter Description Comments


HEADER_ID Header ID (reference to Always populated.
OE_ORDER_HEADERS_ALL) of the
order/line that underwent a change,
causing the event to be raised.
LINE_ID Line ID (reference to Populated when the
OE_ORDER_LINES_ALL) of the order action performed is
line that underwent a change, on a specific order
causing the event to be raised. line.

A null value
indicates, the event
is the result of an
action that got
performed on the
order level.
HDR_REQ_ID An auto-generated identifier. For internal use.
LINE_REQ_ID An auto-generated identifier. For internal use.
CHANGE_TYPE Indicates the type of change the APPLY – a hold has
order/line is being subjected to. been applied.

RELEASE – a hold has


been released.

LINE_STATUS – Flow
status code has
changed.

SHIP_DT_CHG –
Schedule Ship date
has been changed.

ARVL_DT_CHG –
Schedule Arrival date
has been changed.

HOLD_SOURCE_ID Hold Source ID (reference to Populated only when


OE_ORDER_HOLDS_ALL) which caused CHANGE_TYPE is APPLY
the hold to be applied on the order or RELEASE.
header.
ORDER_HOLD_ID Hold ID (reference to Populated only when
OE_ORDER_HOLDS). CHANGE_TYPE is APPLY
or RELEASE.

Business Events in Oracle Order Management Page 9 of 21


Use Case – A Fully Functional Custom Extension

Requirement

Trigger a custom workflow, registered as part of custom subscription to the seeded business
event oracle.apps.ont.oi.xml_int.status. The event should be raised every time Request Date is
updated on a booked sales order line, and every time an order is booked. It should be regardless
of order source. The custom workflow should make an entry in a custom audit table.

Setup

1. Create a custom table XX_OM_BES_TBL with following definition:

CREATE TABLE XX_OM_BES_TBL


( ORG_ID NUMBER
, ORDER_SOURCE_ID NUMBER
, ORDER_NUMBER NUMBER
, HEADER_ID NUMBER
, CUSTOMER_ID NUMBER
, LINE_NUMBER NUMBER
, BOOKED_FLAG VARCHAR2(1)
, LINE_ID NUMBER
, FLOW_STATUS_CODE VARCHAR2(30)
, REQUEST_DATE DATE
, CREATION_DATE DATE
);

The table’s purpose is to hold some basic order auditing information.

2. Create another custom table, XX_OM_BES_ERRORS:


CREATE TABLE XX_OM_BES_ERRORS
( ITEM_TYPE VARCHAR2(8),
ITEM_KEY VARCHAR2(240),
SQLERRNUMBER NUMBER,
SQLERRTEXT VARCHAR2(2000),
LOGTIME DATE);

The purpose of this table is to store any unexpected errors raised during the logging process.

Business Events in Oracle Order Management Page 10 of 21


3. Create a custom package with the following source code:

/******************************************************************************
**
** Spec of package XX_OM_BES_PKG_WF
**
** NOTES
** This is created for test purpose
**
*****************************************************************************/

CREATE OR REPLACE PACKAGE XX_OM_BES_PKG_WF AS

PROCEDURE Update_BES_InfoToCustTable (
p_itemtype IN VARCHAR2,
p_itemkey IN VARCHAR2,
p_actid IN NUMBER,
p_funcmode IN VARCHAR2,
p_x_result IN OUT NOCOPY VARCHAR2);

END XX_OM_BES_PKG_WF;
/

API XX_OM_BES_PKG_WF.Update_BES_InfoToCustTable() contains sample code to populate


the audit table XX_OM_BES_TBL.

/******************************************************************************
**
** Body of package XX_OM_BES_PKG_WF
**
** NOTES
** This is created for test purpose
**
*****************************************************************************/

CREATE OR REPLACE PACKAGE BODY XX_OM_BES_PKG_WF AS

PROCEDURE Update_BES_InfoToCustTable (
p_itemtype IN VARCHAR2,
p_itemkey IN VARCHAR2,
p_actid IN NUMBER,
p_funcmode IN VARCHAR2,
p_x_result IN OUT NOCOPY VARCHAR2)
IS
l_order_source_id NUMBER;
l_sold_to_org_id NUMBER;
l_order_number NUMBER;
l_org_id NUMBER;
l_result VARCHAR2(30);
l_header_id NUMBER;
l_line_id NUMBER;
l_pos NUMBER;
l_line_number varchar2(100);
l_request_date DATE;
l_open_flag VARCHAR2(1);
l_flow_status_code VARCHAR2(30);
l_line_ids VARCHAR2(4000);
l_sqlcode number;
l_sqlerrm VARCHAR2(2000);

Business Events in Oracle Order Management Page 11 of 21


CURSOR lines_info (c_line_id NUMBER) IS
SELECT line_id, booked_flag, request_date, flow_status_code
, line_number||'.'||shipment_number AS Line_Num
, (SELECT order_number FROM oe_order_headers_all WHERE header_id = l.header_id) AS
Order_Number
FROM oe_order_lines_all l
WHERE line_id = c_line_id;

cursor header_info (c_header_id NUMBER) IS


SELECT booked_flag, request_date, flow_status_code, order_number
FROM oe_order_headers_all l
WHERE header_id = c_header_id;

BEGIN

l_org_id := wf_engine.GetItemAttrNumber ( p_itemtype, p_itemkey, 'ORG_ID');


l_order_source_id := wf_engine.GetItemAttrNumber( p_itemtype, p_itemkey,
'ORDER_SOURCE_ID');
l_header_id := wf_engine.GetItemAttrNumber( p_itemtype, p_itemkey,
'HEADER_ID');
l_sold_to_org_id := wf_engine.GetItemAttrNumber( p_itemtype, p_itemkey,
'SOLD_TO_ORG_ID');
l_line_ids := wf_engine.GetItemAttrText( p_itemtype, p_itemkey,
'LINE_IDS');

IF l_line_ids = 'ALL' THEN – event was raised because order was booked
OPEN header_info (l_header_id);
FETCH header_info
INTO l_booked_flag, l_request_date, l_flow_status_code, l_order_number;
CLOSE header_info;

INSERT INTO XX_OM_BES_TBL


( ORG_ID
, ORDER_SOURCE_ID
, ORDER_NUMBER
, HEADER_ID
, CUSTOMER_ID
, BOOKED_FLAG
, REQUEST_DATE
, FLOW_STATUS_CODE
, CREATION_DATE
)
VALUES
( l_org_id
, l_order_source_id
, l_order_number
, l_header_id
, l_sold_to_org_id
, l_booked_flag
, l_request_date
, l_flow_status_code
, SYSDATE
);
ELSE – event was raised because line request dates were changed
WHILE l_line_ids IS NOT NULL LOOP -- decode colon delimited line id list
l_pos := INSTR(l_line_ids, ':',1, 1);
IF l_pos = 0 THEN
l_line_id := l_line_ids;
l_line_ids := NULL;
ELSE
l_line_id := SUBSTR(l_line_ids, 1, l_pos - 1);
l_line_ids := SUBSTR(l_line_ids, l_pos + 1);
END IF;
OPEN lines_info (l_line_id);
FETCH lines_info
INTO l_line_id, l_booked_flag, l_request_date, l_flow_status_code, l_line_number,
l_order_number;
CLOSE lines_info;

Business Events in Oracle Order Management Page 12 of 21


INSERT INTO XX_OM_BES_TBL
( ORG_ID
, ORDER_SOURCE_ID
, ORDER_NUMBER
, HEADER_ID
, CUSTOMER_ID
, LINE_NUMBER
, BOOKED_FLAG
, LINE_ID
, REQUEST_DATE
, FLOW_STATUS_CODE
, CREATION_DATE
)
VALUES
( l_org_id
, l_order_source_id
, l_order_number
, l_header_id
, l_sold_to_org_id
, l_line_number
, l_booked_flag
, l_line_id
, l_request_date
, l_flow_status_code
, SYSDATE
);
END LOOP;

END IF; -- line_ids = 'ALL'

p_x_result := 'COMPLETE:COMPLETE';

EXCEPTION
WHEN OTHERS THEN
l_sqlcode := sqlcode;
l_sqlerrm := SUBSTR(sqlerrm, 1, 2000);
INSERT INTO XX_OM_BES_ERRORS
( item_type,
item_key,
sqlerrnumber,
sqlerrtext,
logtime)
VALUES
( p_itemtype,
p_itemkey,
l_sqlcode,
l_sqlerrm,
sysdate);
p_x_result := 'COMPLETE:ERROR';
END Update_BES_InfoToCustTable;

END XX_OM_BES_PKG_WF;
/
COMMIT;
EXIT;

Business Events in Oracle Order Management Page 13 of 21


4. Create a custom workflow.

4.1 New Item Type = ‘Custom OM Business Event’ (Internal Name = XX_OMBES).

4.2 Create an event of Event Action = ‘Receive’ and name = ‘Custom Receive Event’ (Internal
Name = XX_BES_RECEIVE_EVENT). Set the Event filter = oracle.apps.ont.oi.xml_int.status

Business Events in Oracle Order Management Page 14 of 21


4.3 Create a new function ‘Write Details to Custom table’ (Internal Name =
XX_BES_WRITE_DETAILS) and assign Function Name =
XX_OM_BES_PKG_WF.Update_BES_InfoToCustTable

4.4 Create a process ‘Write Details Process’ (Internal Name = XX_WRITE_DETAILS) and check the
‘Runnable’ checkbox

4.5 Create a process definition by assigning the receive ‘Custom Receive Event’ as the start
activity, and workflow standard ‘End’ as end activity. Place the ‘Write Details to Custom table’
function activity between the above two activities and join the transition line as shown below:

Business Events in Oracle Order Management Page 15 of 21


4.6 Create following attributes to the custom item type ‘Custom OM Business Event’:

Event Name and Event Key should be of type Text, Event Message type Event, Line Ids type Text
with length of 2000, and the rest type Number.

4.7 Set the Event properties under the ‘Event Details’ property tab as shown below:

4.8 Create a custom subscription to event ‘oracle.apps.ont.oi.xml_int.status’ by navigating to

 Workflow administrator responsibility > Business Events > Events tab


 Query for event ‘oracle.apps.ont.oi.xml_int.status’ and press the create icon to create a new
custom subscription to this event

Business Events in Oracle Order Management Page 16 of 21


 Provide the appropriate system name and Action Type = ‘Launch Workflow’ along with
other necessary details for creation, as shown below and click the ‘Next’ button.

 In the next screen, provide the custom workflow item type and process internal name.
 Provide the Owner Name and Tag to this event and save the changes

Business Events in Oracle Order Management Page 17 of 21


5. Setup the processing constraint rule for raising the business event:

 Navigate to OM Super User responsibility > Setup > Rules > Security > Processing
Constraints form
 Query for:
Application = Order Management
Entity = Order Line
 Define a new user constraint with -
Operation = Update
Attribute = Request Date
User Action = Raise Integration Event
Enabled = Checked
And constraint condition as:
Scope = Any
Validation Entity = Order Line
Record Set = Line
Validation Template = Booked
Enabled = Checked
User Message = Business event has been raised

Business Events in Oracle Order Management Page 18 of 21


Save the changes.

6. Setup the value to profile OM: Electronic Message Integration Event Source' as ‘ALL’.

That completes the necessary implementation & set-up for the request date change part of the
requirement.

Now, test the implementation done so far.

 Navigate to OM Super User responsibility > Orders, Returns > Quick Sales Order
 Enter the Operating Unit, Customer details and Order Type information. Ensure other
required information to either be defaulted or enter it manually for the successful creation
of the order sales order.
 Once done, save the changes and enter a sales order line with a certain request date.
 Book the sales order.
 Now change the request date.
 Upon saving the changes, business event ‘oracle.apps.ont.oi.xml_int.status’ will be
raised.

Once the event is raised, navigate to Workflow Administrator responsibility > Status Monitor.

 Query for custom item type ‘XX_OMBES’ and the latest launched details of custom process
‘XX_WRITE_DETAILS’
 Click on view diagram button to ensure that the custom workflow, tied to custom
subscription, is triggered and completed.

Business Events in Oracle Order Management Page 19 of 21


Finally, check the entry to custom table ‘XX_OM_BES_TBL’. There should be a row in this table for
the modified sales order line along with the new request date value and any other desired details.

For the second part of the requirement, to get an entry in the audit table XX_OM_BES_TBL also
when an order is booked, there is a few more setup steps required. This is because booking is a
flow status change, rather than attribute change, and cannot be captured by processing
constraints. Instead, we’ll use the seeded workflow subprocess Raise Show Sales Order Event Sub
Process.

7. Copy and rename the seeded order header process R_STANDARD_HEADER (Order Flow –
Generic). Change the name to R_STANDARD_HEADER_SSO (Order Flow – Generic SSO).

8. In Oracle Workflow Builder, change the definition of Order Flow – Generic SSO by inserting
the seeded subprocess RAISE_SHOW_SO_SUB (Raise Show Sales Order Event Sub Process) from
item type OESO (OM Show Sales Order) between BOOK_PROCESS_ASYNCH (Book - Order,
Manual) and CLOSE_HEADER_PROCESS (Book - Order, Manual):

The item type OESO is defined in file $ONT_TOP/patch/115/import/US/oexwfoa.wft.

Business Events in Oracle Order Management Page 20 of 21


9. Assign workflow process Order Flow – Generic SSO to an order type in OM’s Transaction
Types form.

Now create an order with order type from step 9 and book it. This should cause a corresponding
row to be created in the audit table XX_OM_BES_TBL, as well as a workflow item of type
XX_OMBES, just as previously, when you tested the request date change scenario.

Conclusion

Oracle Order Management provides out-of-the-box support to raise workflow business events at
salient points within the lifecycle of a sales order.

By coding & registering appropriate subscriptions to the standard business events, in a very non-
invasive manner, you can:

o extend the standard functionality offered by Oracle Order Management, and/or


o accomplish third party system integration with Oracle Order Management

at various instances of interest during the sales order lifecycle.

Business Events in Oracle Order Management Page 21 of 21

S-ar putea să vă placă și