Thursday, August 27, 2009

Error while running blank query on an applet !!

Today while working on one of the issue in UAT env, when I navigated to Assets screen to see list of all assets, ran a blank query, I got the following error :

There were more rows than could be returned. Please refine your query to bring back fewer rows(SBL-DAT-00500).

In the very first sight, it seems query is bringing a large number of records which Siebel can't handle. hmmm... okayy, lets try running a query which will bring less records so I put a query on "Type" field on the applet and ran the query and it worked fine. That means there is some limitation in Siebel while fetching the records and if the number of records goes beyond that limit it gives up. So, one might ask what is that upper limit??

Upper limit for number of records that Siebel can pull from a single query is equal to the value set for "MaxCursorSize" parameter available in your siebel.cfg file. Here below can be the values :

a) 0 : If this parameter set to 0 (zero), that means Siebel can fetch 10,000 records in a single query. This is the recommended value.

b) -1 : it indicates infinite number of records, results in low performance and not recommended by Siebel.

c) >0 : any number greater than 0 will fetch that many records in one query.

So, what happens is if you run a query on UI and you try to scroll the records and crosses the limit what has been set by "MaxCursorSize" parameter, you will get the above mentioned error. Moreover, the parameter is applied for each and every query that Siebel runs with the exception that it might override by "Maximum Cursor Override" property at the business component level.

I checked for the value of "MaxCursorSize" parameter in CFG and it was set to 0. Just to cross verify I also ran a query in the database and confirmed that number of records in S_ASSET records were more than 10,000 records. But, wait a minute, I didn't even scroll once on the Asset Screen and I just tried to navigate on the default view of the screen and still I received this error. This is something else is going on here, isn't it?

One more thing to notice here is that I realized that even I have more than 10,000 Accounts records in the application, but there is no issue when I navigate to All Accounts view. That means something special does exist with Asset business component which is causing this issue. And here below is the reason for it :

"Hierarchy Parent Field" property of business component was set to "Parent Asset Id" and due to this while running a blank query on the Assets UI, resulted in putting a "/*+ ALL_ROWS */" hint in the SQL that Siebel runs in the background. This is the difference I observed when I just removed the "Hierachy Parent Field" and compiled the SRF again and blank query worked fine this time. No issues. But this doesn't mean that this is the solution for the issue, you can't just remove this property to avoid this error because it get reflect in all the applet based on this business component. So here is the solution for this :

Use "Disable Buscomp Hierarchy", a user property available on the applet and set its value to True. Since it is applet based user property, only applies to the applet on which it is used.

Disable Buscomp Hierarchy = True

What it does is : it will just ignore the effect of "Hierarchy Parent Field" on the business component and run the query without "/*+ ALL_ROWS */" hint in the background to bring the records as per the normal process.

I put this user property on the All Assets List Applet and ran a blank query again, everything worked fine.

Hope it helps !!
.

Tuesday, August 25, 2009

Refreshing a record in Siebel applet - Possible ways !!

Sometimes it happens you clicks on a button on an applet which is supposed to do some modification on the current record but you get an error saying : The selected record has been modified by another user. This happens when the same record has been updated into the database (by another user or some other process like Workflow, EAI etc) and system is trying to update the old context of record on the UI. So the better way to get the updated copy of the record by refreshing it and then do any modifications. But the bottom line is you should not loose the context of the current record, so if you are thinking of using ClearToQuery() and ExecuteQuery(), it will not solve the purpose here.

There are few possible ways by which you can refresh a record on the UI, without loosing the context of the current record, depending upon the requirement you can take the decision which one to use.

1. RefreshRecord : Business Component Method

This is a method available on Business Component which are derived from CSSBCBase class. Here is how you can use it, if writing code in PreInvokeMethod of applet :
if (MethodName == "MyMethod")
{
this.BusComp().InvokeMethod("RefreshRecord");
...............................................
}

This method will just refresh the highlighed record on the UI.

2. RefreshBusComp : Business Component Method

This is similar to RefreshRecord method available on Business Component which are derived from CSSBCBase class. The only difference is that it will refresh all the records in the current query context :

if (MethodName == "MyMethod")
{

this.BusComp().InvokeMethod("RefreshBusComp");
...............................................
}

3. FINS Teller UI Navigation : Business Service

Unlike RefreshRecord and RefreshBusComp, this business service can be used for refreshing any applet/buscomp, no matter which class it has been derived from. The method need to use is "RefreshCurrentApplet".
if(MethodName == "MyMethod")
{

TheApplication().GetService("FINS Teller UI Navigation").InvokeMethod("RefreshCurrentApplet", TheApplication().NewPropertySet(), TheApplication().NewPropertySet());

}


.


Friday, August 21, 2009

Automating Siebel SRF Full Compile process!!!

One of most boring and mechanical task for Siebel Administrators is to do a Full Compile of SRF from Siebel Tools connected to Server Siebel Repository and put it onto the Siebel Server whenever Development team ask to do so.

Here is atleast we can make a process in which Admin guy doesn't require to open Siebel Tools with Server database and do a Full Compile. This can be automated, just follow the below steps :

1. Copy paste the below lines of command into a text file and save it in .bat file lets say : FullCompile.bat

D:\Siebel\8.1\Tools_1\BIN\siebdev.exe /c D:\Siebel\8.1\Tools_1\bin\enu\siebel.cfg /d ServerDataSrc /u <_username> /p <_password> /bc "Siebel Repository" D:\Siebel\8.1\Client_1\OBJECTS\ENU\DailyFullCompileSRF.srf

exit

2. You can change the location of Siebel Tools / Client directory in the above command, as per your requirement. Also the Username and Password.

3. Create a Windows Scheduled Task to run this .bat file on the daily basis. I have set the time for scheduled task as everyday 7AM morning, and I see the newly compiled SRF ready once I reach office :) . SRF name : DailyFullCompileSRF.srf.

I am not sure whether this works in Unix env via creating a cron job, if somebody has tried that please share your experience.

.