Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to analyze based on R12 Business Event+Workflow

2025-03-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article will explain in detail how to carry out the analysis based on R12 Business Event+Workflow. The content of the article is of high quality, so the editor will share it with you for reference. I hope you will have some understanding of the relevant knowledge after reading this article.

Today I made an example of Business events + Workflow and recorded it.

Function description:

When an INVOICE message is added to the table, Business events is automatically triggered, and then Workflow is called to send Notification to the approver for approval.

The main purpose is to test the function of Business events and learn.

The test was successful, but after completion, I found that I did not understand the advantages of Business events, because this function can be handled by calling Workflow directly when the record is added. I feel that the standard Business events of the system is nothing more than triggering an Events to complete the subsequent operation after the completion of a certain operation. Even if there is a Defer function, it seems that we can still achieve it through database job. The Subscriptions function also seems to be able to write Package to implement branch processing of different business logic.

If there is TX to see my confusion, please do not hesitate to comment!

Here are the detailed steps for the example.

1. Create a customized table

Notification is defined as follows:

Note the definition of Performer, that is, the recipient

Upload Workflow and register with the system

Definition of Event subscription

Note that Phase defined below 100 is instant processing.

Note: the customized program in PL/SQL Rule Function is used to save Event information and initialize Event.

Workflow Type is the Workflow developed above, and Process is the only create or replace package body c_customer_invoice_pkg is in it.

Used to generate test data and call Events

Procedure insert_data is

L_invoice_id number

Begin

Select c_apps.c_customer_invoice_s.nextval into l_invoice_id from dual

-- Insert data

-- 3137 is my user id, which is convenient for testing and can be used directly.

Insert into c_apps.c_customer_invoices_all

(invoice_id

Invoice_date

Invoice_amount

Submit_id

Submit_date

Approval_id

Approval_date

Approval_memo

Approval_status)

Values

(l_invoice_id, sysdate, 1000, 3137, sysdate, null, null)

Commit

-- call procedure to start Event

Raise_event (l_invoice_id, 3137)

End insert_data

-- used to start Event

PROCEDURE raise_event (pi_invoice_id in NUMBER, pi_submit_id in NUMBER) is

L_parameter_list wf_parameter_list_t: = wf_parameter_list_t ()

L_parameter_t wf_parameter_t: = wf_parameter_t (null, null)

L_event_key NUMBER

L_event_data varchar2 (300)

L_message varchar2 (10)

BEGIN

-- use invoice id as event key

L_event_key: = pi_invoice_id

-- define the parameters of event

L_parameter_t.setName ('INVOICE_ID')

L_parameter_t.setVALUE (pi_invoice_id)

L_parameter_list.extend

L_parameter_list (1): = l_parameter_t

L_parameter_t.setName ('SUBMIT_ID')

L_parameter_t.setVALUE (pi_submit_id)

L_parameter_list.extend

L_parameter_list (2): = l_parameter_t

-- start

Wf_event.raise (p_event_name = > 'oracle.apps.c_apps.invoice.approval'

P_event_key = > l_event_key

-- p_event_data = > l_event_data

P_parameters = > l_parameter_list)

Commit

L_parameter_list.DELETE

END raise_event

-- this procedure is set in the rule function of Subscription, and the Event information is written in the trip table.

FUNCTION rule_function (p_subscription in RAW

P_event in out NOCOPY WF_EVENT_T)

Return varchar2 is

L_rule VARCHAR2 (20)

L_parameter_list wf_parameter_list_t: = wf_parameter_list_t ()

L_parameter_t wf_parameter_t: = wf_parameter_t (null, null)

I_parameter_name l_parameter_t.name%type

I_parameter_value l_parameter_t.value%type

I pls_integer

L_invoice_id l_parameter_t.value%type

L_submit_id l_parameter_t.value%type

BEGIN

If p_event.geteventname () = 'oracle.apps.c_apps.invoice.approval' then

-- get the parameters of Event

L_parameter_list: = p_event.getParameterList ()

If l_parameter_list is not null then

I: = l_parameter_list.FIRST

-- get the value of the parameter

While (I itemtype

Itemkey = > itemkey

Aname = > 'INVOICE_ID')

L_submit_id: = wf_engine.getitemattrnumber (itemtype = > itemtype

Itemkey = > itemkey

Aname = > 'SUBMIT_ID')

Wf_directory.GetRoleName (p_orig_system = > l_orig_system)

P_orig_system_id = > l_submit_id

P_name = > l_submit_name

P_display_name = > l_submit_display_name)

Wf_engine.setitemattrtext (itemtype = > itemtype)

Itemkey = > itemkey

Aname = > 'SUBMIT_NAME'

Avalue = > l_submit_name)

Wf_engine.setitemattrtext (itemtype = > itemtype)

Itemkey = > itemkey

Aname = > 'SUBMIT_DSP_NAME'

Avalue = > l_submit_display_name)

Wf_directory.GetRoleName (p_orig_system = > l_orig_system)

P_orig_system_id = > l_submit_id

P_name = > l_approval_name

P_display_name = > l_approval_display_name)

Wf_engine.setitemattrnumber (itemtype = > itemtype)

Itemkey = > itemkey

Aname = > 'APPROVAL_ID'

Avalue = > l_submit_id)

Wf_engine.setitemattrtext (itemtype = > itemtype)

Itemkey = > itemkey

Aname = > 'APPROVAL_NAME'

Avalue = > l_approval_name)

Wf_engine.setitemattrtext (itemtype = > itemtype)

Itemkey = > itemkey

Aname = > 'APPROVAL_DSP_NAME'

Avalue = > l_approval_display_name)

Select invoice_amount, invoice_date

Into l_invoice_amount, l_invoice_date

From c_apps.c_customer_invoices_all

Where invoice_id = l_invoice_id

Wf_engine.setitemattrnumber (itemtype = > itemtype)

Itemkey = > itemkey

Aname = > 'INVOICE_AMOUNT'

Avalue = > l_invoice_amount)

Wf_engine.SetItemAttrDate (itemtype = > itemtype)

Itemkey = > itemkey

Aname = > 'INVOICE_DATE'

Avalue = > l_invoice_date)

Resultout: = 'COMPLETE'

EXCEPTION

When others then

Wf_core.context ('cased customer informed PKG'

'get_submit_info'

Itemtype

Itemkey

TO_CHAR (actid)

Funcmode

SQLERRM)

Raise

End get_submit_info

-- approval Branch for Workflow

PROCEDURE invoice_approval (itemtype IN VARCHAR2

Itemkey IN VARCHAR2

Actid IN NUMBER

Funcmode IN VARCHAR2

Resultout OUT NOCOPY VARCHAR2) is

L_invoice_id NUMBER

L_approval_memo c_apps.c_customer_invoices_all.approval_memo%TYPE

L_approval_id NUMBER

Begin

IF (funcmode wf_engine.eng_run) THEN

Resultout: = wf_engine.eng_null

RETURN

END IF

L_invoice_id: = wf_engine.getitemattrnumber (itemtype = > itemtype

Itemkey = > itemkey

Aname = > 'INVOICE_ID')

L_approval_id: = wf_engine.getitemattrnumber (itemtype = > itemtype

Itemkey = > itemkey

Aname = > 'APPROVAL_ID')

L_approval_memo: = wf_engine.getitemattrtext (itemtype = > itemtype

Itemkey = > itemkey

Aname = > 'APPROVAL_MEMO')

UPDATE c_apps.c_customer_invoices_all

SET approval_id = l_approval_id

Approval_date = sysdate

Approval_memo = l_approval_memo

Approval_status ='Y'

WHERE invoice_id = l_invoice_id

Resultout: = 'COMPLETE'

EXCEPTION

When others then

Wf_core.context ('cased customer informed PKG'

'invoice_approval'

Itemtype

Itemkey

TO_CHAR (actid)

Funcmode

SQLERRM)

Raise

End invoice_approval

-- reject branch for Workflow

PROCEDURE invoice_reject (itemtype IN VARCHAR2

Itemkey IN VARCHAR2

Actid IN NUMBER

Funcmode IN VARCHAR2

Resultout OUT NOCOPY VARCHAR2) is

L_invoice_id NUMBER

L_approval_memo c_apps.c_customer_invoices_all.approval_memo%TYPE

L_approval_id NUMBER

Begin

IF (funcmode wf_engine.eng_run) THEN

Resultout: = wf_engine.eng_null

RETURN

END IF

L_invoice_id: = wf_engine.getitemattrnumber (itemtype = > itemtype

Itemkey = > itemkey

Aname = > 'INVOICE_ID')

L_approval_id: = wf_engine.getitemattrnumber (itemtype = > itemtype

Itemkey = > itemkey

Aname = > 'APPROVAL_ID')

L_approval_memo: = wf_engine.getitemattrtext (itemtype = > itemtype

Itemkey = > itemkey

Aname = > 'APPROVAL_MEMO')

UPDATE c_apps.c_customer_invoices_all

SET approval_id = l_approval_id

Approval_date = sysdate

Approval_memo = l_approval_memo

Approval_status ='N'

WHERE invoice_id = l_invoice_id

Resultout: = 'COMPLETE'

EXCEPTION

When others then

Wf_core.context ('cased customer informed PKG'

'invoice_reject'

Itemtype

Itemkey

TO_CHAR (actid)

Funcmode

SQLERRM)

Raise

End invoice_reject

End c_customer_invoice_pkg

Finally, it is executed in PL/SQL

BEGIN

C_customer_invoice_pkg.insert_data

End

Check the Event table, record generation, enter the system, found that Notification has been received, can be normal approval!

This is the end of the analysis based on R12 Business Event+Workflow. I hope the above content can be helpful to you and learn more. If you think the article is good, you can share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 218

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report