Friday, October 5, 2012

Guide to Create a Unique Sequence Number in Siebel

How to configure unique running sequence number

Many times in a Business Applications , there is a need to have a running sequence number to represent and keep track of a single and multiple business entities.

In order to achieve this functionality in Siebel CRM Applications, there are two alternatives that can be implemented which are:
1. Use Oracle Database Sequence Object
Firstly, the Database Administrator must create the object. Below are the syntax:

CREATE <SEQUENCE OBJECT NAME> INCREMENT BY <INCREMENT VALUE> START WITH <START RANGE> MIN VALUE <MIN VALUE> MAX VALUE <MAX VALUE> CYCLE ORDER

For Example:
CREATE SEQUENCE customers_seq
 START WITH     1000
 INCREMENT BY   1
 CYCLE ORDER;

The first reference to customers_seq.nextval returns 1000. The second returns 1001. Each subsequent reference will return a value 1 greater than the previous reference.
for more details of Oracle DB Sequence Objects can be found in
http://docs.oracle.com/cd/B13789_01/server.101/b10759/statements_6014.htm

you also need to grant the permission to SSE_ROLE in order for the object to function properly.

Later in Siebel Tools, you need to configure the field properties with name "Oracle Sequence Object" under Business Component > Fields. You put in the specified Oracle DB Sequence Object name that has been configured earlier.

compile and run. you will see the field is going to be populated with running sequence number when a new record is being created.

2. Use a Custom Controlled Table to handle the sequences

You can also create a control table to handle the sequences. Script can be written to handle the uniqueness and session control mechanism to perform as per expected.

In comparison of the two option, using a predefined sequence object is more preferable and has minimum risk.

No comments:

Post a Comment