mayato how to paper df-adb) en

8
[ BEST PRACTICE BI ] mayato how-to papers in the area of business intelligence and customer relationship management Title: Dynamic Filters in the SAP BW Analysis Process Designer [APD] Author(s): André Bukowski Topic: SAP BW Published: March 2008 Managemen t summary In this how-to paper, the author uses the example of a specific scenario to show how dynamic filters can be deployed in the SAP Analysis Process Designer (APD). The APD, which for a long time was hidden away within SAP BW and whose existence was known to only a few experts, has been enjoying increasing popularity in the past few years, because it gives developers and data analysts alike flexible, explorati ve access to data within SAP BW. SAP BW previously lacked a function to parameterize analysis processes for many purposes. Especially for filters, the opportunity to assign them dynamically, in a similar way to the variables in the BEx Analyzer, was sorely missed. This meant that users were time and again forced to set the filter values manually for analysis processes. With Support Package Stack 11 in 2007, SAP provided a new feature that enabled precisely these OLAP variables to be used within the framework of APD f ilters, thus making possible the dynamic use of analysis processes. This how-to paper is designed to show where and how such dynamic filters can typically be used. | HOW-TO PAPER

Upload: abdul-malik

Post on 03-Apr-2018

219 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Mayato How to Paper DF-ADB) En

7/28/2019 Mayato How to Paper DF-ADB) En

http://slidepdf.com/reader/full/mayato-how-to-paper-df-adb-en 1/8

[ BEST PRACTICE BI ]

mayato how-to papers in the area of business intelligence andcustomer relationship management

Title: Dynamic Filters in the SAP BW Analysis Process Designer [APD]

Author(s): André Bukowski

Topic: SAP BW

Published: March 2008

Management summary

In this how-to paper, the author uses the example of a specific scenario to show how dynamic filters can be deployed inthe SAP Analysis Process Designer (APD). The APD, which for a long time was hidden away within SAP BW and whoseexistence was known to only a few experts, has been enjoying increasing popularity in the past few years, because it

gives developers and data analysts alike flexible, explorative access to data within SAP BW. SAP BW previously lacked afunction to parameterize analysis processes for many purposes.

Especially for filters, the opportunity to assign them dynamically, in a similar way to the variables in the BEx Analyzer,was sorely missed. This meant that users were time and again forced to set the filter values manually for analysisprocesses. With Support Package Stack 11 in 2007, SAP provided a new feature that enabled precisely these OLAPvariables to be used within the framework of APD filters, thus making possible the dynamic use of analysis processes.This how-to paper is designed to show where and how such dynamic filters can typically be used.

| HOW-TO PAPER

Page 2: Mayato How to Paper DF-ADB) En

7/28/2019 Mayato How to Paper DF-ADB) En

http://slidepdf.com/reader/full/mayato-how-to-paper-df-adb-en 2/8

2

Prerequisites

The first prerequisite is SAP NetWeaver 2004s BI installation (BW 7.0). Because the use of dynamic filters was madepossible by SAP through a Support Package, the scenario also assumes that your BW system is on SAP NetWeaverSupport Package Stack 11.

Scenario

A bank loads customer account and credit contract data from various source systems into SAP BW, and then storesthem there in DataStore objects (DSOs). The contract data for each contract contains, among other things, informationabout the product group to which a particular contract belongs. This product group identification and a number ofassociated attributes, which are modeled as BW master data, are essential selection criteria and drilldowncharacteristics for contract information in reporting at a later stage. If new product groups are determined for businesspurposes, an organizational process ensures that the product group attributes in SAP BW are maintained manually.To assure data quality, the bank would also like to run periodic checks on the dataset last delivered. These checksdetermine whether one of the source systems delivered new product groups that went unnoticed. The check shouldtake place periodically using an analysis process that analyzes the data from the last 30 days for incidences of newproduct groups. The analysis period is limited using a filter on the Key Date field in the analysis process. So that the filterdoes not have to be set manually every month, the bank wants to deploy a dynamic filter using an OLAP variable.

Implementation

Step 1: Creating the filter variables

First, the filter variables that will be used later in the analysis process are created in the Query Designer. To do this, youstart the BEx Query Designer and open a query on an InfoProvider that contains the characteristic in question – in ourexample, the Key Date characteristic. The query only needs to be opened because the Wizard for creating the variableis integrated into the Query Designer. The query does not actually need to be changed.In the tree structure on the left, you now select the Key Date characteristic to be filtered. When you right-click on theCharacteristic value variables subitem and select New Variable (see Fig. 1), the dialog box opens in which a new variablecan be created. In our case, this is the current date minus 30 days.

Figure 1: Creating variables for the dynamic filter in the BEx Query Designer

Now the name, description, and processing type need to be defined (see Fig. 2). The variables are assigned using thecustomer exit that has yet to be created or that needs to be enhanced (see Step 2).

Page 3: Mayato How to Paper DF-ADB) En

7/28/2019 Mayato How to Paper DF-ADB) En

http://slidepdf.com/reader/full/mayato-how-to-paper-df-adb-en 3/8

3

Figure 2: SAP BW Variables Wizard (Step 1)

[!] Furthermore, a display area must be assigned to the variables. In our example, the variable is a single value (see Fig.3). In this step, it is important that you do not declare the variable as Ready for Input, because this would mean itcannot be used in the dynamic filter.

Figure 3: SAP BW Variables Wizard (Step 2)

Page 4: Mayato How to Paper DF-ADB) En

7/28/2019 Mayato How to Paper DF-ADB) En

http://slidepdf.com/reader/full/mayato-how-to-paper-df-adb-en 4/8

4

Complete the creation of the variable by selecting Exit in the Wizard. You can now find the variable under the Key Date

characteristic:

Figure 4: New variables for the Key Date characteristic

Step 2: Create the customer exit

Once the variable has been created for the dynamic filter, the required ABAP code must be defined so that the variablecan be filled with a value. To do this, switch to Project Management of SAP Enhancements (transaction cmod), selectthe project ZBW_REP, and display the assigned components (choose Components  Display – see also Fig. 5).

Figure 5: Project management of SAP enhancements

Page 5: Mayato How to Paper DF-ADB) En

7/28/2019 Mayato How to Paper DF-ADB) En

http://slidepdf.com/reader/full/mayato-how-to-paper-df-adb-en 5/8

5

Figure 6: Customer exit in project management

In the exit include ZXRSRU01, adjust the ABAP code for the variable as follows:

DATA: L_S_RANGE TYPE RSR_S_RANGESID.

DATA: l_last30 LIKE sy-datum.

CASE I_VNAM.

* THIS IS THE CODING FOR OUR EXIT

WHEN 'ZLAST30'.CLEAR L_S_RANGE.

L_LAST30 = sy-datum – 30.

L_S_RANGE-LOW = L_LAST30.L_S_RANGE-SIGN = 'I'.

L_S_RANGE-OPT = 'EQ'.APPEND L_S_RANGE TO E_T_RANGE.

* OTHER VARIABLES MAY BE SPECIFIED IN THE SAME EXIT

* WHEN…

ENDCASE.

This fills the variable with the required value: In our example, this is the current date minus 30 days.

Step 3: Set up analysis process

The variable has now been created and is filled with the requested date correctly at runtime. Now the actual analysisprocess can be set up (transaction RSANWB). In our example, data from a DSO should first be loaded with contract data– but only contracts with a key date within the last 30 days. For this, a dynamic filter with the variable created(ZLAST30) is used for the contract data. Using this filter means that only the subset of contracts required forsynchronization are made available. At the same time, all the product groups stored in the master data table areimported and added to the contract data using a left outer join against the product groups delivered (and variablyfiltered according to date). Using another filter – this time a static one – those product groups are now selected fromthe join for which no attributes have been maintained in the master data table, and which are thus identified as newproduct groups. The list of these product groups can now be prepared in various ways so that it can be put to furtheruse, for example, by writing a file or a DSO or by creating an error log.The analysis for our example would now look like this:

Page 6: Mayato How to Paper DF-ADB) En

7/28/2019 Mayato How to Paper DF-ADB) En

http://slidepdf.com/reader/full/mayato-how-to-paper-df-adb-en 6/8

6

Figure 7: Analysis process: filtering and join

Step 4: Configure the dynamic filter

In the filter’s characteristics menu, which you can access by double-clicking the applicable filter icon in the APD, youmust first select the field (see Fig. 8). Under Available Fields (on the right), the product group (used in the join) and thekey date (filter criterion) must be selectable. If this is not the case, you must adjust the DSO field selection. In the DSOconfiguration, all fields to be used later must be selected. Because we want the dynamic filter to be applied to the Key 

Date characteristic, it also needs to be transferred from the available fields (on the right) to the fields to be filtered (onthe left).

Figure 8: Filter characteristics – field selection

Page 7: Mayato How to Paper DF-ADB) En

7/28/2019 Mayato How to Paper DF-ADB) En

http://slidepdf.com/reader/full/mayato-how-to-paper-df-adb-en 7/8

7

Now that field selection has been completed, the filter conditions for the key date need to be adjusted. To do this,switch to the Filter Conditions tab page (see Fig. 9).

Figure 9: Filter conditions

Because, in our example, we just want to select contracts that exceed a set key date, only the Selection From field isrelevant in the filter conditions. Using the button directly in front of the field (red arrow), you can now select thevariable you have already defined. In the box that opens (see Fig. 10), select and confirm the variable ZLAST30.1

Figure 10: Selecting the variables for the filter

You can now confirm the filter conditions and the dynamic filter is thus fully configured. When you run the analysisprocess, the filter with the period of the last 30 days is assigned automatically using the variable. This can be verifiedusing the flow trace in the Analysis Process Designer monitor (see Fig. 11).

 1 If your variable does not appear in the selection box, please refer to SAP Note 1077019.

Page 8: Mayato How to Paper DF-ADB) En

7/28/2019 Mayato How to Paper DF-ADB) En

http://slidepdf.com/reader/full/mayato-how-to-paper-df-adb-en 8/8

8

Figure 11: Accessing the monitor for the analysis process

Our result – that is, the new product groups of the last 30 days identified by combining dynamic and static filters in theanalysis process – can now be sent, for example, by e-mail through process chain integration.

Additional notes

In our example above, an alternative simplified approach is possible as a special case by using an existing variable forthe current date and by setting the offset value to -30 (see Fig. 10). The solution presented in this document is moreflexible and also covers more extensive requirements. For example, it would also be possible, within the customer exit,

to read the date of the last check from a table or to determine a period based on the number of work days. User-specific filling of variables based on Customizing or user data is also conceivable.

Checklist

  Create variables (not ready for input) for the dynamic filter in the BEx Query Designer

  Write ABAP code to fill the variable (transaction CMOD)

  Define the analysis process (transaction RSANWB)

 Configure the dynamic filter in the analysis process with variables

  Check the filter in the analysis process using intermediate results and log entries

  Schedule analysis process periodically and establish process for handling new product groups

Further reading

SAP online help on using variables in the APD

More mayato publications