Friday, October 1, 2010

Basics of Business events

HI All,
some basics syntax and statements to work with business events..

Business Events:
Business event is an activity in the system which is of some significance .Like creating a purchase order, booking a sales order or ship confirming one.

Subscription:

A subscription is action that needs to be performed on occurrence of the business event



What are the standard parameters for the procedure to be subscribed to business events?The custom plsql code should be a packaged function.
It will have two default parameters
1. P_susbcription_guid raw data type
2. P_event the event data

FUNCTION xx_test
( p_subscription_guid IN RAW , p_event IN OUT NOCOPY wf_event_t) RETURN VARCHAR2


How to get the Event Data if the data type is Rule or message? l_event_name := p_event.getEventName();
l_event_key := p_event.getEventKey();

How to get the parameters defined along with the business event?
l_parameter_list WF_PARAMETER_LIST_T ;

l_parameter_list:=p_event.getParameterList();

IF l_parameter_list IS NOT NULL THEN

FOR i IN l_parameter_list.FIRST .. l_parameter_list.LAST
LOOP

INSERT INTO XX_PARAM_NAME_VALUES
VALUES(l_parameter_list(i).getName() , l_parameter_list(i).getValue());

END LOOP;

ELSE
Dbms_output.put_line(‘No parameters’);
END IF;

How to get a value of a parameter?
p_event.getparameter(parametername)
p_event is the value passed to the procedure from the subscription.

How to raise a custom Business Event?
wf_event.raise( p_event_name => '',
p_event_key => '',
p_event_data => l_eventdata,
p_parameters => l_parameter_list);


Event data need to be populated only when the subscription requires message data
l_message := wf_event.test('');

This above function will provide whether any of the subscription requires business event data or not
if l_message = 'KEY' then
-- Raise the Event
wf_event.raise( p_event_name => ,
p_event_key => ,
p_parameters => l_parameter_list);
else
if l_message = 'MESSAGE' then
if l_xmldocument is not null then
dbms_lob.createtemporary(l_eventdata, FALSE,
DBMS_LOB.CALL);
dbms_lob.write(l_eventdata, length(l_xmldocument), 1 ,
l_xmldocument);
-- Raise the Event with the message
wf_event.raise( p_event_name => '',
p_event_key => '',
p_event_data => l_eventdata,
p_parameters => l_parameter_list);
else
-- Raise the Event without the message
wf_event.raise( p_event_name => '',
p_event_key => '',
p_parameters => l_parameter_list);
end if;


end if;


How to add parameters to the business event while raising a business event?procedure AddParameterToList
(p_name in varchar2,
p_value in varchar2,
p_parameterlist in out wf_parameter_list_t);
wf_event.addparametertolist(p_name=>’userid’,p_valehue=>’100’,p_parameterlist=>l_parameter_list);
use the above statement before wf_Event.raise

10 comments:

Anvesh said...

hi...

Thanks for sharing the information on business of basics events.As I am new to oracle I have learn some basic syntax.

Regards.
www.suneratech.com

Anonymous said...

Hi,
When a standard business event is raised,will data be populated into wf_bpel_qtab?

Unknown said...
This comment has been removed by the author.
Anonymous said...

Hello,

Kindly assist with request below...

For BE - 'oracle.apps.cs.sr.ServiceRequest.updated'

when certain fields on the SR self service page are changed, then certain table should get update with this field.

The challenge is getting these fields as they are not in the list of parameters that come with the p_event (p_event.getparameterlist).

Please how do I get this additional attributes?

Thanks in advance...

Unknown said...
This comment has been removed by the author.
Unknown said...


Regards
Sridevi Koduru (Senior Oracle Apps Trainer Oracleappstechnical.com)
LinkedIn profile - https://in.linkedin.com/in/sridevi-koduru-9b876a8b
Please Contact for One to One Online Training on Oracle Apps Technical, Financials, SCM, SQL, PL/SQL, D2K at sridevikoduru@oracleappstechnical.com | +91 - 9581017828.

Doradla said...

Hi,
Following is my system.
1. Created a Oracle EBS JMS queue.
2. Created a Business event and subscription.
3. Written a concurrent program.

In the concurrent program, i am looping a table based on a condition which gives more than one record, in that loop, i am raising the business event. It looks like my Business event is raising, but it is always inserted only one record into my JMS queue, even though there are multiple records.

My question is when business event trigger in a loop, does it post the data into JMS queue only one time for that whole transaction?

Please help me in this.

Regards,
Doradla.

Industry Consultant said...

Nice information, If you are freelance business consultant who is looking for consulting projects, then kindly register with SolutionBuggy, India's largest business consulting platform dedicated to MSMEs. We act as a bridge between consultants and industries.

Industry Consultants said...

Contract Manufacturing has Become a go-to-option for Many Companies in the Manufacturing Sector. It Offers a lot of Benefits to Businesses Across Industries.

Industry Consultants said...

Connect with 600+ energy consultants &amp Solar Consultants in India. Our Energy Consultants and Solar Consultants Help You Address Your End-to-End Requirements.