9–16 Define filters in a query Create restricted key figures and calculated key figures in a query Create new formulas in a query Work with drilldown, currency conversion, ch
Trang 1Chapter 9: Creating Queries
Contents
Overview 9–2
Creating and Saving a New Query 9–3
Defining a Filter in a Query 9–9
Creating Restricted Key Figures 9–10
Creating a New Formula—Percentage Change InfoObject 9–12
Creating a Calculated Key Figure 9–14
Working with BW Queries: Additional Functions 9–16
Define filters in a query
Create restricted key figures and calculated key figures in a query
Create new formulas in a query
Work with drilldown, currency conversion, charts, and other BW query functions
Trang 2Chapter 9: Creating Queries
Overview
Overview
In chapter 8 you learned how to:
< Build a workbook template
< Insert an existing query into a workbook
< Save a workbook to the InfoCatalog Queries define the structure of a workbook in the Business Explorer (BEx) Analyzer In the
previous chapter you learned how to insert Bungee Software’s Sales Analysis query into a workbook With the help of a guided tour, you will now learn how to create the same query
During the query building process, you will learn how to define filters, create restricted key figures, and create calculated key figures Later in the chapter we cover additional features and functions to help you work with BW queries
Enable access to a workbook through the BEx Browser
Enable access to a workbook through the BEx Browser
Create a new query or modify an existing query
Create a new query or modify an existing query
Enhance workbook layout and functionality (optional)
Enhance workbook layout and functionality (optional)
Insert desired query (or queries) into a workbook
Insert desired query (or queries) into a workbook
Create a workbook template (optional)
Create a workbook template (optional)
Before Getting Started
Before you start building a query, it is important to have a clear understanding of the user requirements For instance, Bungee Software executives primarily request sales revenue and gross profit data, grouped by organization, product, customer, and sales employee Thus, the relevant characteristics are Sales Organization, Distribution Channel, Division, Material, Material Group, Customer, and Sales Employee The relevant key figures are Sales Revenue and Gross Profit Users can include key figures and characteristics in one or more queries
You are here
Trang 3Chapter 9: Creating Queries Creating and Saving a New Query
In this example, we separate the sales revenue and the gross profit information into two different queries:
< Sales analysis query (0D_SD_DEMO_Q0001): First, you will learn how to build the sales
analysis query, including the creation of restricted key figures
< Gross profit analysis query (0D_SD_DEMO_Q0002): Next, you will learn to build the
gross profit analysis query, including the creation of calculated key figures
Creating Queries Based on the SAP DemoCube Before you can start creating the queries covered in this chapter, you must make sure that the SAP-delivered DemoCube is available in your BW system
The SAP DemoCube is available with BW Release 1.2B (patch 8) To work with the sample queries shown in this guide, you may need to activate the contents of the SAP DemoCube and upload the data to your system For help activating the SAP DemoCube, see your system administrator Information on the SAP DemoCube can also be found in chapter 11
Now let us return to the BEx Analyzer to start creating the sales analysis query
Guided Tour
Creating and Saving a New Query
1 To create a new query,
choose New from the
Business Explorer toolbar
1
Trang 4Chapter 9: Creating Queries
Creating and Saving a New Query
2 If you are already logged
on to the BW system, jump to step 3 If not, follow the onscreen prompts to log on to the
BW system
4 Choose the InfoCubes for
new query folder to get an
expanded list of the demo cubes
5 Expand the SAP Demo
area and choose the SAP DemoCube
Trang 5Chapter 9: Creating Queries Creating and Saving a New Query
Take a few moments to
familiarize yourself with the
Define query: New query
window You can define
queries simply by dragging
and dropping available
objects (from the left side) to
the Definition area on the
right
7 Expand the SAP
DemoCube InfoCube to view the Key figure and Dimensions folders
Characteristic: A criterion (for example, plant, material, company code, etc.) used to select
data
Dimension: A logical grouping of characteristics
Key Figure: A value you can report on
Free Characteristics: Fields that can be defined to provide values according to whatever
criteria you select
7
Query toolbar: See next page to learn more
You can drag and drop characteristics and key
figures to the Filter, Free
Characteristics, Columns,
and Rows areas,
depending on how you want to set up your
this window
Trang 6Chapter 9: Creating Queries
Creating and Saving a New Query
The Query Toolbar
To help you become familiar with the Query toolbar, the following table shows how the various buttons are used during query definition
Transfer a query to a workbook
Exit the query
Create a new query
Open an existing query
Check the definition of a query
View where a query is used in all workbooks
Switch between displaying or maintaining a query
View the context menu to display the technical names of the fields in Query definition
Open the BEx help file
Trang 7Chapter 9: Creating Queries Creating and Saving a New Query
8 Define Rows: From the
Organization dimension, drag the Company code into the Rows area
9 Define Columns: From
the Key figure folder and the Time dimension, drag Sales Revenue and Calendar Year into the Columns
area
10 Define Free
Characteristics (using drag and drop):
From the Organization dimension, drag Sales organization,
Distribution channel, and Division
From the Customer dimension, drag Sold- to-Party/Industry
From the Sales employee dimension, drag Sales employee
From the Product dimension, drag Material group and Material SAP (Demo)
From the Time dimension, drag Calendar year/quarter
You may want to avoid expanding the tree in the Available objects area unless necessary
Because there are thousands of items available (especially for customers and materials), an expanded listing could take some time to navigate In Release.1.2B, you can have a default setting that only lists the first 100 available objects
Trang 8Chapter 9: Creating Queries
Creating and Saving a New Query
11 Use drag-and-drop to
change the sequence of the InfoObject For instance, to re-position
the InfoObject, Sales Employee in the Free Characteristics area, drag the Sales Employee
InfoObject and drop it at
the Material InfoObject
area
12 The InfoObject Sales
Employee is repositioned after the Material SAP
13 Choose Save
14 In Technical name, enter a
name for the query (for
example, ZDEMO)
15 In Description, enter a
description for the query
(for example, Sales Analysis)
16 Choose OK to exit the
Save query screen
You have now created and
saved a basic query called
Trang 9Chapter 9: Creating Queries Defining a Filter in a Query
Defining a Filter in a Query
You can use filters to show or hide values depending on your needs
1 Expand the
Version dimension
2 Drag 0D_VTYPE into the
Filter area
3 Select 0D_VTYPE,
right-click the mouse and
choose Restrict to restrict
the view of the data (for
example, Actual or Plan
views)
4 To view the actual data,
choose the Single value
tab
5 Click Display to get a
list of possible entries if needed Choose the value
the characteristic, Calendar Year and restricting the value interval year 1997 to 1998
Trang 10Chapter 9: Creating Queries
Creating Restricted Key Figures
7 The result of this query
will show the value type
Actual
You have successfully set a
filter for your query
Creating Restricted Key Figures
Restricted key figures are key figures with restricted values For example, in Columns you
can define the restricted key figures to limit the display of values within a calendar year
instead of using the characteristic, Calendar year to display the value for all available calendar years We will use Sales Revenue to restrict the display to values which fall in
calendar years 1998 and 1997
1 Using the Sales Analysis
query, choose
from the
Available objects area
2 Right-click and select New
restricted key figure
2 1
7
Trang 11Chapter 9: Creating Queries Creating Restricted Key Figures
3 On the Restricted key figure
screen, choose a key
figure (for example, Sales Revenue) from the
Available objects area and drag it into the New restricted key figure folder
in the Definition area
4 From the Time dimension
drag Calendar year to the Definition area
5 Choose a characteristic
(such as Calendar Year),
right-click the mouse, and
choose Restrict
6 We will now define the
restriction for Calendar year to be used for the Sales Revenue key figures
In this example, only entries for 1998 will be shown
Trang 12Chapter 9: Creating Queries
Creating a New Formula—Percentage Change InfoObject
8 Enter the Technical name
and Description of the
restricted key figure
9 You can define how the
number of decimal places will be displayed
10 Use currency conversion
(if needed) to assign the currency in which the workbook values are to be displayed For more information on currency conversion, see chapter
11
11 Choose OK
Repeat steps 1 through 12 to
create the restricted key
figure, 1997 Sales Revenue
12 Drag the restricted key
figures, 1998 Sales Revenue and 1997 Sales Revenue
and drop them into the
Columns area The result
shows the defined 1998 and 1997 sales revenues restricted by the
characteristic, Calendar year
Note: Restricted key figures and calculated key figures are InfoCube dependent
Creating a New Formula—Percentage Change InfoObject
In the Bungee Software Sales Analysis report, there is a % Change column To define
formulas for structure elements in queries, SAP provides five different percent functions
For more information see Tips & Tricks in chapter 11 In the Sales Analysis report, we use the SAP-delivered % Percentage variance function
11
9 8
12
10
Trang 13Chapter 9: Creating Queries Creating a New Formula—Percentage Change InfoObject
1 Using the Sales Analysis
query, choose
2 Right-click Structure and
select New formula
A popup window appears,
where we can define a new
formula (percentage variance
function)
3 Place the cursor in the
Formula area
4 From the Structure
elements folder in the Operands area, choose
1998 Sales Revenue
Double-click 1998 Sales Revenue to move it to the Formula area
5 From the Operators folder
in the Functions area, choose the Percentage functions folders Double- click % Percentage
variance The % symbol
now appears in the
Formula area
6 Repeat step 4 above and
choose the InfoObject,
1997 Sales Revenue
7 Enter a description, %
Change
8 Choose Check to verify
whether the formula is
7
8
9 3
Trang 14Chapter 9: Creating Queries
Creating a Calculated Key Figure
query into a workbook
Using the approach shown in
the preceding pages, you can
also create a query for Gross
Profit Analysis For
illustration purposes, we will
not repeat all the steps to
build such a query, but rather
focus on creating a calculated
key figure
Creating a Calculated Key Figure
Calculated key figure implies that key figures can be calculated based on a formula For example, the gross profit calculation for Bungee Software Inc would be: Sales revenue
minus the cost of goods sold In this section you will see how to create the key figure gross profit
1 Using the Gross Profit
Analysis query of SAP SD DemoCube Workbook,
choose the
Key figure folder from the Available objects area
2 Right-click the mouse and
choose New calculated key figure
2 1
10 13
Trang 15Chapter 9: Creating Queries Creating a Calculated Key Figure
3 Enter a description,
Gross Profit
4 Place the cursor in the
Formula area
5 To define the formula,
first double-click Sales Revenue (in the Operands
8 To check the formula,
choose the Check button
9 Choose OK
10 Enter the Technical name
and Description of the
calculated key figure
11 You can define how the
number of decimal places will be displayed
12 Use the currency
conversion (if needed) to assign the currency in which the workbook values are to be displayed For more information on currency conversion, see chapter
10
12
11
13
Trang 16Chapter 9: Creating Queries
Working with BW Queries: Additional Functions
14 A calculated key figure,
Gross Profit now appears
in the Calculated key figures
folder
15 Drag the calculated key
figure, Gross Profit, and drop it in the Columns area (under Structure)
Calculated Key Figures vs New Formula
The formula that is defined for calculated key figures is InfoCube-dependent That means the calculated key figure is available for every query in that InfoCube You can also define a query-specific formula: To create a query-
specific formula, from the Columns area, choose Then, right-click and choose New formula to define a new formula (similar to steps 3 through 9
in the calculated key figure section above) The formula that is defined under
Structure in the Column/Row area is query-specific
Working with BW Queries: Additional Functions
In the first part of this chapter you saw how simple queries are created The remainder of the chapter is devoted to additional features and functions of BW queries
To help you get more out of BW queries, we will explore the following functions:
< Suppressing the display of repeated text and/or key values
< Disabling the interactive drilldown capability (restricting users from changing saved data in workbooks)
< Selecting filter values for characteristics
< Drilling down or across (slice & dice)
Trang 17Chapter 9: Creating Queries Working with BW Queries: Additional Functions
Suppressing the Display of Repeated Texts and/or Key Values
You can restrict given values from being repeatedly displayed in a list For example, to list
data by company code and sales organization in the Sales Analysis report, the company code
for U.S and Europe is displayed multiple times Follow the steps shown below to keep redundant or repeated text/key values from being displayed
In Queries
1 Using the Gross Profit
Analysis query to suppress repeated display
in a query, choose
Query properties
2 Select the Suppress repeated
texts display option
3 Choose OK
1
2
3
Trang 18Chapter 9: Creating Queries
Working with BW Queries: Additional Functions
In Workbooks
1 To suppress the display of
repeated key values in a workbook field, such as
Company Code, choose the
column where the key
value is located
2 Right-click and choose
Properties
3 From the Display tab
select Suppress repeated key values
4 Choose OK
Refresh Formatting on Data Refresh
This default option guarantees that formatting is adjusted after refreshing updated data To display data more quickly, you can deselect this function
Display Scaling Factors for Key Figures
This function enables the user to display the scaling factor for key figures, for example, displaying $3000000 as $3000 for easier reading
4 3
1
2