29/09/2015Use Custom SQL Bypass BusinessObjects Universe Limits | Business Objects Tips Business Objects Tips Business Objects tips, tricks, articles, blog, guides… Home Tips and Tricks Guides Utilities Links Blog Bypassing the Universe – Using Custom SQL The Downfall of Business Objects? Search Recent Posts "The Best Query Builder Guide Ever Written" Why Does the Java Report Panel / Web Intelligence Applet Take So Long Load Sometimes the wonderful drag and drop functionality of BusinessObjects can be its downfall as well. When report writers do not have access to Designer or edit access the universes that they must use there exists an opportunity for this downfall. If any object in the world of SAP BusinessObjects follows the rule of trash intrash out it is the universe. Tracking Concurrent Users with Query Builder and Auditing Data BusinessObjects Universes Must be Perfect A universe has to be just right. It can’t be too complex, nor too simple. It can’t have errors and it must be uptodate with its underlying database. Additionally, different users have different expectations of a universe and therefore all judgements a universe’s adequacy hinge on the collective opinions of that universe’s report writers/developers. Nothing I am saying hear is news to anyone that has struggled with universes and reports; however, I hope it helps some feel more justified or more understanding. A Workaround Comparison of Web Intelligence Java Report Panel and HTML Editor Query Builder Guide Most comprehensive, bestselling Business Objects Query Builder guide. Take control of your BO metadata. businessobjectstips.com Import Wizard, Life Cycle Manager, UMT, & Promotion Management, Oh My… Hot Backup & Restore of BusinessObjects XI3/BI4 Content If a universe is deficient, incomplete, or lacking there is a workaround. If a user is very comfortable with the data source data model and they want to bypass the universe, there is a workaround. If you are editing your report’s query and you want to test something not in the universe without editing the universe, there is a workaround. What is this workaround? Use Custom SQL. "Best Web Intelligence Quick Reference Guide" How Do You Use Custom SQL? First of all, you must New Comments have the rights of “View SQL” and “Edit Query” granted to you user account (members of Administrators user group should have these already). Both of Web Intelligence Guide Increase efficiency with this rich compilation of best functions, syntax, tips, operators, more. of these are found in Business Objects XI 3.1 under the object’s “User Security” > “Advanced” > “Content” > “Web Intelligence Report”. Once you have businessobjectstips.com these rights you can open the report (modify) in Java Report Panel. Once everything loads. click on the “Edit Query” button and then click the small “SQL” button on the toolbar. You will then see a new window open named “SQL Viewer”. Here you can see the underlying SQL of the query. Please note that you can Join Us on Facebook copy it to your clipboard by clicking the “Copy” button. You can also pass the point of no return by selecting the radio button option of “User custom SQL”. Actually, don’t let my drama scare you, you can always undo your custom SQL. In fact, it is rather easy to lose your custom SQL and revert to the Business Objects generated SQL; so please take care to backup your custom SQL statements. PLEASE NOTE: If any of the above mentioned options are disabled for you then you do NOT have your Busines… 823 likes rights set incorrectly. Like Page The Rules of BO Custom SQL Editing Here are a few rules that you must follow when working with Custom SQL in Web Intelligence (or Desktop Intelligence): 1. The number of fields in your SELECT clause must match the number of objects in the query 2. The type of the fields in you SELECT clause must match those of their corresponding BO objects. In other word, if your first query object is “Customer Name” and it Be the first of your friends to like this Bea on Import Wizard, Life Cycle Manager, UMT, & Promotion Management, Oh My… Prahadhir on Officially Released: The Best Business Objects XI Query Builder Guide Ever Written! Trudy on Import Wizard, Life Cycle Manager, UMT, & Promotion Management, Oh My… Hans on Import Wizard, Life Cycle Manager, UMT, & Promotion Management, Oh My… Julian on Which Business Objects Auditing Activities or Events Capture BO Universe Name? Facebook Members WordPress Plugin has a type of “string” then the first field/item in your SELECT clause must also have a datatype of string. If the third object in you query is of date type then you better make sure that the third field/item/element in your SELECT clause is of the date datatype. Usually a click of the “Validate SQL” will highlight any such violations (see screenshot). 3. This rule is really an extension of rule #2. Functions on objects in the SELECT clause are allowed; however, they must output a matching data type 4. Don’t forget about object type; the object containers will be treated by BO according to their type. If http://www.businessobjectstips.com/tips/webintelligence/bypassingtheuniverseusingcustomsql/ 1/9 This would make it easy to get the right objects that you need. and 4 are followed the fields used in the SELECT clause and the contents of the rest of the the SQL statement do not have to have any relation at all to the objects selected. I wish BO did that for you. for best results please try to use container objects that will match your custom SQL field in object type. take an object from the universe. Please share any tips that you might have picked up along the way. 2011 at 9:53 pm You are welcome Chris. and then type a value like “SQL MANUALLY EDITED!! DO NOT MODIFY!!” This way. 5. and prevented you from altering a manual SQL query without warning you first. Let’s Build BO Custom SQL Knowledge Base Together I have not played around with Custom SQL as must as some. BE CAREFUL. in 6 months from now. 2011 at 7:20 am Thank you Thank you and Thanks !!!! I would be happy to share stuff as I get going – as for many years. at least for me. then add the object and then replace the SQL that you copied. 8. 2011 at 6:13 am Hi Julian. 4. That is to say. Web Intelligence 41 Responses to “Bypassing the Universe – Using Custom SQL” 1. you’ll have a visual cue to the fact the query you see before you is not the one actually being run in this report. Thank for the tip Ethan. This won’t cause errors; nevertheless. After you Custom SQL is set then you should take much care not to touch the rest of the query in any way. but till they do. I suppose one could also add something to the report itself or the description of the report if acceptable to users. So if you suddenly decide you need to add another object then you have to be very careful to copy the SQL you have. do not attempt to adjust the results section or the conditions sections. Chris Bush says: June 17. This is particularly true in an environment in which several people might work on the same report over time. Julian says: June 17. for example. after using much custom SQL: Once you realize you’re going to be going down the custom SQL path. 2.businessobjectstips. SQL. 6. and click “Run Query” to refresh the query and data.com/tips/webintelligence/bypassingtheuniverseusingcustomsql/ 2/9 . 2011 at 1:37 pm A tip I developed over the years. I will start out with the visual interface and as I encounter limitations will do the custom – already have with filters as it is so much easier to nest ORs and ANDs textually when they get a little more complicated. When your Custom SQL edits are complete I suggest you copy the SQL and save it to a file somewhere. This is not actually a rule. then click the “Save” button. You cannot expect BO to start treating the container object “Customer Number” like a dimension in any aggregations. 3. Chris Bush 2. 3. 7. The best tip I can offer beyond the rules above is that if you plan to do this a lot you might want to prepare some dummy/generic objects that has their data type and object type in the object name. “Customer Number” is a dimension object and you successfully edited the SQL and forced order quantity (an obvious measure candidate) into this object. I really like it. GaryC says: October 5. Ethan says: June 17.29/09/2015 Use Custom SQL Bypass BusinessObjects Universe Limits | Business Objects Tips the BO object you selected. when you get back to this query. this is a solution that has saved many reports from being destroyed. Any edits to these will result in reverting your report’s SQL to that generated by BusinessObjects and your custom SQL statement will be lost completely. Glad I could help. 2011 at 9:23 pm Categories: Web Intelligence Tags: Desktop Intelligence. 41 comments What do you think? Posted by Julian June 16. but I felt I should point out that as long as rules 1. You remind me that the “WHERE” clause was the most common place to go custom. and make it equal to. drag it into the conditions section of the query pane. Universe. is it possible to use the WITH Clause in freehand sql of a WebI http://www. Do NOT select the option to “User the SQL generated by your query” unless you want to LOSE all of your custom SQL. Julian says: March 1. Ben says: November 12. Please have a look and let us know if the SQL you found was the manually edited SQL you needed to recover. (Also use the essential technique of persisting the custom sql in a condition object in the query panel so it doesn’t get lost when someone starts fiddling with the query!)) 7. as long as the select clause items match in type and number to the objects of the report. if you database is Oracle. I recently wanted to edit the query and I get the following error message: “The current query contains unresolvable objects ( WIJ 20004)”. 6.29/09/2015 5. Of course. I think I know how you can recover you SQL. Julian says: March 5. TPE says: March 4. 2011 at 7:33 pm Hi GaryC. and other things. 8. union. Christine says: March 1. SET no count on /* select */ EXECUTE MyProcedure Can extend this to use the @prompt syntax to pass runtime parameters to your sp. For example. you should probably search google for “SQL outer joins” to learn more about outer joins. Do you have any idea how I cut bypass this check and edit directly the custom SQL? Thx 10. Also have to include the word “select” within comment delimiters. 2013 at 9:56 pm The “(+)” creates an outer join in Oracle. If you have auditing enabled for “document refresh” then you should look for one of your schedule refreshes and in the many records recorded you could find the SQL stored for the execution. This is one of the many reasons customSQL reports are a bad idea. number and date type objects (called text1.O. etc) which I use when I need to use SPs. 2011 at 7:06 pm Using custom sql with ms sqlserver stored procedures – works with BO XR r2 SQL server 2005driver – anyone know about r3? To get data back from a SQL server sp in webi. 9. firstly I think that your error/warning comes from the fact that the report’s associated universe was changed and it seems that one of the fields named/dropped in the results section may no longer exist or has changed in some other way. This is standard Oracle SQL syntax. I saw this SQL on joining two tables: tableA=tableB(+) What is the meaning of this (+) behind the table name in the query? Please help. 2013 at 9:03 am Hi TPE. So you can even do things like derived tables. The daily (schduled) execution of the reports is still working fine which means that obviously my custom SQL is stored somewhere but I’m not able to edit it anymore.O. Please share your experiences when you can.businessobjectstips. However. I use a dedicated universe with a set of 20 generic text.com/tips/webintelligence/bypassingtheuniverseusingcustomsql/ 3/9 . 2013 at 10:53 am I am a beginner in BO. you can customize the sql AS LONG AS you follow 2 rules: first line must be”SET no count on” so as not to confuse it with multiple resultsets. This means you can even use custom functions. in freehand SQL you can get away with almost anything that that your database allows. And a very good reason to store you SQL as text on one of the reports on the tab (so that you can easily retrieve it later. proposes me to edit is not the right one but the one automatically built by B. http://www. use “having”. 2013 at 2:45 am I created some months ago reports using the technique you described in your article. Use Custom SQL Bypass BusinessObjects Universe Limits | Business Objects Tips Julian says: October 5. I scheduled the daily execution of those reports which is still working fine. with the objects selected from the universe. then if you can run a SQL statement successfully in SQL*Plus then you should be able to paste that same statement in your report’s custom SQL. BO seems to need to see this before it bothers passing the query on to the database to parse. the SQL that B. So this works (assuming you follow the rules about object typing and so on discussed above.text2. 2013 at 11:06 am Hi Binoy. Binoy says: April 15. and assuming your query is named Query 1.Status A. I do not have access to the Universe. put the following formula: =DataProviderSQL([Query 1]).C1.C1.com/tips/webintelligence/bypassingtheuniverseusingcustomsql/ 4/9 .’Open’ C. 15. Thx for your quick answers. and in the event of custom SQL – it’s the query you wrote.’Pending’ C. Use Custom SQL Bypass BusinessObjects Universe Limits | Business Objects Tips Ethan says: March 5.A1. This will show you what BUsinessObjects sent to the SQL server.29/09/2015 11.’ForceClosed’ A.OrderItem. I tried the solution with the formula (=DataProviderSQL([Query 1])) since it looked really straightforward and ‘BINGO’: it works perfectly I also discovered that indeed one of the ‘fake’ objects I used when I built my SQL seems not to be available anymore.C2. honestly. 2013 at 12:49 pm Can you link to an external file? For example. 2013 at 2:28 pm Hi. 2013 at 3:31 pm Hi NN.’Pending’ B. 2013 at 9:12 am TPE.A1.’Pending’ ….businessobjectstips.B1. 2013 at 8:33 pm Hi all.OrderItem.’Closed’. I have a requirement for which I need to know if I can achieve results without having to use custom SQL.’Open’ C. Thanks in advance! NN 16.’Pending’.’Pending’.Status. NN says: June 28.A2. Julian says: April 20. Ethan 12. create a blank cell (drag it out of the Templates menu) in it. I hope if someone else reading this does she or he will share it.’Pending’.’Pending’ …. a query to look up data using an ID. I need to add a fourth column ‘DerivedStatus’ that will have a value ‘ForceClosed’ for all records of an Order if any record for that Order has got a value of Status = ‘Closed’. you are asking more of a SQL question and less of a BusinessObjects reporting question. TPE says: March 6.DerivedStatus A.’ForceClosed’ B.’Closed’ A.C2.B1. http://www. Julian says: June 29. I don’t know how to accomplish that. but don’t edit the query. Thx a lot again 13. For a BO report whose output excel looks like how it is shown below: Order. I have to investigate this but I will now be able to rebuilt everything with a minimum of efforts.’Pending’ C. Also.’Open’. Can point the custom sql to a flat file with list of IDs? 14.A2. The above example should look like this: Order. so long as you have not yet made any changes to the report. you can retreive the SQL quite easily: Open the report. Don says: November 15. is if using a Custom SQL is the only option I have for this. Julian says: July 11. SOM says: July 10. Shal says: October 2. Shal 22. the custom SQL is used. So if you can’t edit the universe and you can’t use Custom SQL then I don’t think its possible to do what you want. Thanks once again! NN 18.but I am stuck with SQL coding. I have been creating report along way. 2013 at 5:28 pm Hi SOM. Cheers.businessobjectstips.in which Iam adding a object called year2. I just need to add a 4th column in the report called DerivedStatus. 17. 2013 at 10:08 am Hi NN. Sorry. If I schedule that same Report from Central Management Console or BO the custom SQL is not used. Regards. The datamodel is simple.in which I an writing in selsct as @select(class1\object1) . Riddhi Shah says: December 22.29/09/2015 Use Custom SQL Bypass BusinessObjects Universe Limits | Business Objects Tips I could see a solution using a nested query using the same query without Order Item. SOM 20. 2013 at 8:55 pm Hi Julian.but when I use this object in my report it gives an error as Query 1 – eFashion A database error occured. NN says: June 29. 2013 at 4:16 am Hi Julian. Most people use Custom SQL because they can’t edit the universe. or they don’t want to edit it for various reasons.. Is there some setting that needs to be set to get BO to use the custom SQL on scheduled reports? 23. Hope this helps. Julian says: June 30. (WIS 10901) Please help me to get out of this. 2013 at 12:50 am http://www. The values for this column is what I need to calculate and get like in the example I gave above. This give output in universe . 19. without seeing the entire SQL I don’t think anyone can answer your question. 2013 at 1:26 pm What we are seeing is that if I run the Report from Designer. OrderItem and Status all coming from the same Universe (and even the same underlying table infact). 21. thanks for the additional details.com/tips/webintelligence/bypassingtheuniverseusingcustomsql/ 5/9 . I have an existing BO report that gives me an Excel format output with 3 columns: Order. 2013 at 11:00 am Hi. You can create a variable in the report called DerivedStatus (assuming you are using WEBI) and specify the formula as such: =if(Status = “Closed”; “ForceClosed”; Status) This should help you bypass the Universe limitation. but still without knowing your data model its impossible to truly answer your question. What I am really looking for. As we know we have efashion universe . The database error text is: [Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression ‘( )’. In BusinessObjects if you can edit the Universe then you usually can overcome any need to use Custom SQL. and the custom SQL gets wiped out.com/tips/webintelligence/bypassingtheuniverseusingcustomsql/ 6/9 . ServerSQL. For this. we like to send also this BOQueries to IDAA (much faster responsetime). last year. 24. the SQL will revert to the internally generated version. I have gotten in the habit of saving my custom SQL code in a seperate report page. we installed IDAA for ths DB2. Then when again I opened my report in EDIT mode and through Data Access when I tried to see the SQL generated by my Custom SQL .saved it then refreshed the report saved the report and closed it. just a really (really) basic question from a person starting out in this – what type of SQL is used in Business Objects? e. Tauceef 25. 2014 at 3:31 pm Tauceef If you do ANYTHING to the query after saving out of the SQL window. Barbara says: February 21. Don’t know if it is something simple like this. For this reason. Now. Tauceef Sheikh says: February 18. I hope I have made myself clear. Chris Bush says: February 19. Thanks in advance. Any help on this will be appreciated.0 SP3. Oracle. close it and when open it again and check the sql it’s getting rechanged to “use the script generated by your query” instead of custom sql. And I just saved the report with custom sql and reopened and check it again without making any change in the query. only thing in the query is that its have some prompts and we are passing values to these prompts from another report via a link.I saw that the query no longer remains a Custom SQL but it has the query generated by my script. We tried following it but are facing an issue with custom sql in BO 4.29/09/2015 Use Custom SQL Bypass BusinessObjects Universe Limits | Business Objects Tips I had one question on using custom SQL in Webi 4.0.validated it. like add a field or even just a filter. We are not making any change in the query. we have a sort of header page on all our reports – I just save it in a table row there – in case a query gets changed inadvertantly. Thanks for the reply. Andrew says: April 25.g. 2014 at 12:00 pm We’re accessing some data in DB2 zOS. you have to execute this statement: set current query acceleration all; Is this possible in BO ? 28. it goes into default mode. When we save our custom sql and run the report it runs fine and then we save the report. Tauceef says: February 20. Tauceef 27. 2014 at 6:23 am Hi Chris.businessobjectstips. 2014 at 12:07 pm Hey guys. Thanks http://www.How is it possible?Or when you are in the EDIT mode of the report you won’t able to see the script which contains Custom SQL. Thanks for your post. Please let me know is there any setting I need to modify or anything else.I created a Custom SQL. 2014 at 4:43 am Hi Julian. MS SQL etc. hope it helps 26. Regards. Regards. actual cost.com/tips/webintelligence/bypassingtheuniverseusingcustomsql/ 7/9 . I then customized the SQL on the report and now the users are not being prompted for the year/month anymore. @GroupName varchar(255)) RETURNS INTEGER AS BEGIN DECLARE @ColumnValue INTEGER select @ColumnValue = ( select count(*) cnt from sys. these items are in two different tables http://www. I use another product which I can drag and drop.database_role_members rm inner join sys. So can anybody help me in this How can i make the modification affects my report. 2014 at 4:05 pm Looking for assistance on the use of a custom SQL function that takes a user’s login credentials and checks it against the SQL Server database role they belong to.[CheckPII](@RoleName varchar(255).29/09/2015 29. 2014 at 10:07 pm Hi Shawn. 30. 2014 at 4:03 pm Hi Andrew. The type of SQL will vary based on the database connection type. Shawn says: April 29. but it won’t give you a dropdown list of which ones are available. What am I missing with regard to how BO passes values into a function? TIA 35. 1 if they do. 32. 33.database_principals r on (rm. if I choose to go the “write my own SQL” route I can paste SQL into the SQL panel and the headings create themselves. CBK says: November 18. Is BO going to do something about this? 34. Jayanth. Julian says: May 14. but.principal_id) where r.name = @RoleName and (IS_MEMBER(@GroupName)) > 0 ); RETURN @ColumnValue END The function works fine in SQL Mgmt Studio but when plugged into a universe it defaults to the application login we use for Business Objects no matter who runs the report and doesn’t use the individual login running the report. ie. est labor and act labor.database_principals m on (rm. not your database). JeanB says: July 21.member_principal_id = m. BO strives to remain database independent and as such will not drastically differentiate the SQL it constructs for your database. is it possible that your edits to the SQL impacted the @Prompt() BO functions in the SQL? Those must remain untouched or at least syntactically correct (according to Business Objects. db_owner etc and returns a 0 or 1. 2014 at 10:40 am I created a report that prompts the user to enter the year(s) and month(s). Use Custom SQL Bypass BusinessObjects Universe Limits | Business Objects Tips Julian says: April 25. I am working on my webi Reports. Does anyone know why the prompts are not appearing when the report is refreashed? 31. 0 if they don’t belong to the role. However.role_principal_id = r. 2014 at 4:24 am This all seems “mad”. don’t expect profound support for productspecific SQL. 2014 at 12:04 am HI Guys. Here is the function: CREATE FUNCTION [dbo]. 2014 at 7:30 am I have a query with est cost.principal_id) inner join sys.businessobjectstips. Kdsturg5370 says: August 27.The Query generated is not what i wanted SO i choose the Use Costum SQL and modified it but its not affecting my report . Business Objects can connect to each of those databases. It will allow you to call productspecific functions.SN says: May 30. You should be able to use the SQL without having to select fields in the top pane using the rules you have helpfully stated. (WIS 10810) Here is a simplified version of the SQL. I really don’t know SQL Server. I compile my function in the database and then in my universe I create an object that calls that function appropriately. These are all by po codes and i cannot figure out how to make it stop repeating those duplicate costs. can you help.businessobjectstips.D. 2015 at 4:47 pm Lasech. The Universe contains the first 2 fields only (Key. BO says: “The SQL query has 3 instead of 2 columns. 38. SELECT D. http://www. ) ASSETLIFECYCLESTATUS INNER JOIN ( SELECT * FROM ANA_BASEELEMENT_VW WHERE EXISTS ( SELECT DISTINCT CTM1.TRC = ’285′ and E. SSB says: December 4. but because they are materials and line by line. I assume this needs to be updated on the Universe? No too sure where though. I am 99% sure that Kdsturg5370 is not suggesting that you place that code in Business Objects in any way. when it shows the est labor and act labor for the items it repeats the same dollar amount on every line for each est labor and actual labor costs.TRC).COMPANY FROM CTM_PEOPLE_PERMISSION_GROUPS CTM1 WHERE REMEDY_LOGIN_ID = @VARIABLE(‘BOUSER’) This part of the code specifically WHERE REMEDY_LOGIN_ID = @VARIABLE(‘BOUSER’) I would like to update this to WHERE UPPER(REMEDY_LOGIN_ID) = UPPER(@VARIABLE(‘BOUSER’)) but for all queries.E. 2014 at 7:46 am Can anyone give me some guidance about how to create functions in BO custom SQL? I am not sure I understood the example Kdsturg5370 has posted. not the 3rd field because it is already defined as the second field (TRC) of the record being read.Key . the “Create Function” expression isn’t accepted by BO in my case. i know that in the universe those costs were created as dimensions instead of measures. 39. 37. 36. great tip! Is it possible to update the query generated by a report for all queries? e. 2015 at 5:54 pm Hello. 2014 at 7:14 am Hi SSB. Furthermore. 2015 at 2:01 am Hey Julian. 2015 at 3:13 pm Does the custom SQL webi report bypasses the Universe parameter controls like ”Limit Execution Time’?? 40. it will show with the same name and is impossible to tell them apart. Julian says: December 9. Lasech says: February 11. I’m joining a file to itself and attempting to display the fields of 2 matching records on one line. but in Oracle I have done this before.g.TRC as TRC015 FROM Claim_File D Join Claim_File E on D. 41.com/tips/webintelligence/bypassingtheuniverseusingcustomsql/ 8/9 .KEY = E.TRC as TRC285 . no it is not possible to bypass BO universe level limits with custom SQL.TRC = ’015′ Am I supposed to list the second field twice in the universe? How do I do this? When I try.29/09/2015 Use Custom SQL Bypass BusinessObjects Universe Limits | Business Objects Tips and when i join them into one query and run the report it reports the est and actual costs corretly. Thanks in advance. Julian says: February 24. Bob says: February 10.Key and D. Kdsturg5370 is stating that he/she creates the function directly in their database first and then they call it within a normal SQL. I’m having a problem with custom SQL. Ed says: March 24. com/tips/webintelligence/bypassingtheuniverseusingcustomsql/ Powered by WordPress Theme by HeatMapTheme.businessobjectstips.29/09/2015 Use Custom SQL Bypass BusinessObjects Universe Limits | Business Objects Tips Hope you can help! Cheers! Leave a Reply Your email address will not be published. Required fields are marked * Name * Email * Website Comment You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> Post Comment Notify me of followup comments made on this article via email SiteMap Privacy http://www.com 9/9 .