Google
 
We have moved to a http://siebelunleased.com Please visit there for updated posts

Friday, September 28, 2007

Siebel Business Component Outer Join - How Important?

During my past two years of working on Siebel I have come across lot of situations where just one little miss can wreck havoc with the application. It can result in performance issues and Data issues. I think some of you might have guessed by know what miss I am talking about.

I am talking about Outer Join Flag on Join Section of the Business Component. Joins are the integral part of Siebel configuration. They are indispensable, joins are required because we know the database (it can be oracle, DB2 or Microsoft SQL Server) is a relational database known as RDBMS in short form. Which means the information that resides in it is in the form of related tables and we always need information of one table in another. These tables are related with the help of Foreign Keys (FK). So, when we want to show information of one table in another we use Joins and we use them all the times.


When we are creating Joins in Siebel you can see a field called Outer Join Flag. Please see the screenshot below.



and every time we don't check that flag we are heading for trouble.
Now, what exactly does that flag represent? Before I explain it I assume that you have basic understanding of SQL and simple joins. As I have mentioned earlier that everything that configure or do on UI is converted into SQL and that is where this flag comes into picture.

For example see the simple sql pulling data from another table with the help of simple join

select name b
from siebel.s_opty a, siebel.s_doc_quote b
where b.par_row_id = a.row_id
and a.somefield = b.somefield
and a.row_id = 'Some Id'

Now this SQL is suppose to select name of the quote where the par_row_id column (which store row id of its parent) is equal to the row if of opportunity and in addition to that somefield of opportunity is equal to some field of quote. Now we assume that you had created a join between Opportunity-Quote and forgot to check the outer join flag.You will be amazed to see that there are No Records on UI. The reason being it will try to match the exact values in the field and any record that is a not a match will be discarded. Which means if there are some records that have no value in 'somefield' either in Opportunity or on Quote will be discarded. What if we want those records to shown? We have to check the Outer join flag which will result in a query as given below

select name b
from siebel.s_opty a, siebel.s_doc_quote b
where b.par_row_id = a.row_id
and a.somefield = b.somefield(+)
and a.row_id = 'Some Id'

Which will result in all the Quotes that have 'Some Id' in par_row_id or in simple terms that have Opportunity Id with 'Some Id' as their parent.

My experience has taught me to ask this as the first question whenever I face problem mentioned above and I have seen developers sweat over this kind of problem for hours before they spot it. I will mention some real life situations I have faced which were due this little (or rather huge) miss while doing configuration.

Examples - Real Life Situations:
We have developed a web service that resulted in the insertion of quotes from a Java Application. When we inserted a quote it got inserted successfully and when we tried to update it, it Failed. It took us almost a day to find out that a developer had created a new join in business component and forgot to check that Outer Join flag which resulted in update to failed as it was not able to fetch that record.

I had created a new View in Assets Screen. When user was in My Assets view then he was able to see the records but as soon as he choose All view the records disappeared. The reason same a new join and forgot to check Outer join flag.

Whenever you face this kind of problem go through logs and more often than not you will find this as your root cause. To know more about logs read my Post Siebel - Logs How useful are they?

If this Post was helpful to you please post some comments and come back for more.


0 Comments:

You Might want to read following articles also.