Вы находитесь на странице: 1из 7

BusinessObjects Universe How to Avoid Ambiguous Queries Generation

Applies to:
SAP BusinessObjects Enterprise Universe Designer, Web Intelligence and Desktop Intelligence. For more information, visit the Business Objects homepage.

Summary
This article explains the universe design techniques to avoid the Ambiguous queries in Web Intelligence / Desktop Intelligence. Author: Saminathan Murugaiyan

Company: Accenture Created on: 10 March 2011

Author Bio
Saminathan Murugaiyan is a Senior System Analyst with experience in end-to-end SAP BI/BOBJ implementations across diverse industries such as telecommunication, banking, and healthcare.

SAP COMMUNITY NETWORK 2011 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 1

BusinessObjects Universe How to Avoid Ambiguous Queries Generation

Table of Contents
Introduction ......................................................................................................................................................... 3 Ambiguous Queries ............................................................................................................................................ 3 Avoiding Ambiguous Queries Generation .......................................................................................................... 4 Using an Alias ................................................................................................................................................. 4 Using the Where Clause ................................................................................................................................. 5 Related Content .................................................................................................................................................. 6 Disclaimer and Liability Notice ............................................................................................................................ 7

SAP COMMUNITY NETWORK 2011 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 2

BusinessObjects Universe How to Avoid Ambiguous Queries Generation

Introduction
Ambiguous queries prompt users to choose one query path or another in the reports. Therefore, the end user should know about the contexts to get the right data. Sometimes it becomes incompatible to the user to select the query path every time. This query generation can be avoided by adding the condition in the Where clause or using Alias.

Ambiguous Queries
As per definition from the BusinessObjects universe designer guide, the ambiguous queries occur when a query includes objects that when used together do not give enough information to determine one context or the other. When a query is ambiguous, Web Intelligence displays a dialog box that prompts the user to select one of two contexts. When the user selects a context, the corresponding tables and joins are inserted into the SQL query. In the picture below, No. of Product Types is created with a formula
COUNT(Distinct(SAM_PRODUCT_DIM.PRODUCT_TYPE_CODE))

where the table SAM_PRODUCT_DIM is identified in both contexts Sales and Order. A report can be created with the objects Customer Name and No. of Product Types from the Order class to list the customer names with their ordered product type count for the orders. The Web Intelligence then displays a dialog box that prompts the user to select one of two contexts.

SAP COMMUNITY NETWORK 2011 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 3

BusinessObjects Universe How to Avoid Ambiguous Queries Generation

Avoiding Ambiguous Queries Generation


The dialog box prompt can be avoided by using an Alias or a Where clause. Using an Alias The dialog box prompt can be avoided by defining two aliases for the table SAM_PRODUCT_DIM: one for Sales and another one for Orders. The objects No. of Product Types from the object classes need to be pointed to respected alias table. In this case, if a dimension table is joined with more than two fact tables, at least one alias has to be defined for one context along with the original table. This will make the universe very complex in the Structure view of point.

SAP COMMUNITY NETWORK 2011 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 4

BusinessObjects Universe How to Avoid Ambiguous Queries Generation

Using the Where Clause The join path can be identified with the Where clause by adding the join condition in that clause as below. The table SAM_Order_Fact join condition is added in the Where clause of the object No. of Product Types of Order class. Similarly, the table SAM_Sales_Fact join condition should be added in the where class of the object No. of Product Types of Sales class.

Now, Web Intelligence would not show the prompt, but the report SQL will have duplicated join conditions: one from the join and another one from the Where clause.

This technique helps when the ambiguous query is generated by one or two objects from the same table. Once the join condition is added in the Where clause of the object, the condition-related tables can be tracked by the menu options View Associated Tables or View Associated Objects. These techniques can be used based on the number of objects and the universe design. There are some limitations in both techniques. For example, if aliases are created for each new table, maintenance becomes difficult. In the same way, a join in a Where clause wont be considered by Detect Contexts or aggregate aware incompatibility detection. The best practice is that all joins should be available to the Designer automatic detection tools.

SAP COMMUNITY NETWORK 2011 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 5

BusinessObjects Universe How to Avoid Ambiguous Queries Generation

Related Content
Universe Designer Using Functions, Formulas and Calculations in SAP BusinessObjects Web Intelligence SAP BusinessObjects Desktop Intelligence Access and Analysis Guide For more information, visit the Business Objects homepage.

SAP COMMUNITY NETWORK 2011 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 6

BusinessObjects Universe How to Avoid Ambiguous Queries Generation

Disclaimer and Liability Notice


This document may discuss sample coding or other information that does not include SAP official interfaces and therefore is not supported by SAP. Changes made based on this information are not supported and can be overwritten during an upgrade. SAP will not be held liable for any damages caused by using or misusing the information, code or methods suggested in this document, and anyone using these methods does so at his/her own risk. SAP offers no guarantees and assumes no responsibility or liability of any type with respect to the content of this technical article or code sample, including any liability resulting from incompatibility between the content within this document and the materials and services offered by SAP. You agree that you will not hold, or seek to hold, SAP responsible or liable with respect to the content of this document.

SAP COMMUNITY NETWORK 2011 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 7