You are on page 1of 27

How to Report Data in Alternate Units of Measure

BUSINESS INFORMATION W AREHOUSE

ASAP How to Paper

Applicable Releases: SAP BW 2.0A to 3.5 July 2005


SAP (SAP America, Inc. and SAP AG) assumes no responsibility for errors or omissions in these materials. These materials are provided as is without a warranty of any kind, either express or implied, including but not limited to, the implied warranties of merchantability, fitness for a particular purpose, or non-infringement. SAP shall not be liable for damages of any kind including without limitation direct, special, indirect, or consequential damages that may result from the use of these materials. SAP does not warrant the accuracy or completeness of the information, text, graphics, links or other items contained within these materials. SAP has no control over the information that you may access through the use of hot links contained in these materials and does not endorse your use of third party web pages nor provide any warranty whatsoever relating to third party web pages. mySAP BI How-To papers are intended to simplify the product implementation. While specific product features and procedures typically are explained in a practical business context, it is not implied that those features and procedures are the only approach in solving a specific business problem using mySAP BI. Should you wish to receive additional information, clarification or support, please refer to SAP Professional Services (Consulting/Remote Consulting).

HOW TO REPORT DATA IN ALTERNATE UNITS OF MEASURE

Overview
1 1.1 1.2 1.3 1.4 2 3 3.1 3.2 3.3 3.4 3.5 3.6 3.7 3.8 3.9 3.10 4 5 6 BUSINESS SCENARIO .............................................................................................................2 Key findings....................................................................................................................................... 2 Data Flow Diagram............................................................................................................................ 2 Benefits .............................................................................................................................................. 3 Version History.................................................................................................................................. 3 SOLUTION ................................................................................................................................4 THE STEP-BY-STEP SOLUTION..............................................................................................5 Key Figure for Conversion Factor .................................................................................................... 5 Characteristic Material..................................................................................................................... 6 Characteristic for Alternate Units of Measure ................................................................................. 7 Variable for Alternate Unit of Measure............................................................................................ 9 Formula Variable for Conversion Factor.........................................................................................11 Modification......................................................................................................................................13 User Exit for Variables.....................................................................................................................17 Calculated Key Figures for Conversion ...........................................................................................20 Restricted Key Figure for Input.......................................................................................................22 Create a Query .................................................................................................................................23 PRESENTATION ..................................................................................................................... 24 COMMENTS ............................................................................................................................ 25 APPENDIX............................................................................................................................... 25

2002-05 SAP AMERICA, INC. AND SAP AG

HOW TO REPORT DATA IN ALTERNATE UNITS OF MEASURE

1 Business Scenario
This document describes the how to report data in alternate units of measure. Data is stored in InfoCubes in quantity key figures with the base unit of measure of materials. This data needs to be converted dynamically into an alternate unit of measure, which is specified by the end user at query execution. The goal of this design is to enable flexible and user-friendly reporting in any alternate unit of measure. There is no solution available in the Standard SAP BW releases 2.x and 3.x. Therefore a new solution has been developed. This solution is based on a modification of SAP standard coding.

1.1

Key findings
A dynamic unit conversion as with currencies in BEx context menus is not possible. A calculated key figure with a variable based on it can be used to represent all units of measurement for which conversion factors in the material master exist. At the start of a query, the user enters the alternate unit of measure as a text variable. The system then reads the necessary conversion factors and dynamically converts the quantities into the alternate unit of measure. The solution is based on a small modification of standard SAP code.

1.2

Data Flow Diagram

2002-05 SAP AMERICA, INC. AND SAP AG

HOW TO REPORT DATA IN ALTERNATE UNITS OF MEASURE

1.3

Benefits

Even though the solution might appear to be complex at first, it is very usable and maintainable for the end users. Everything is a one-time setup. Only the conversion factors (InfoObject 0MAT_UNIT) have to be loaded (and maintained on R/3) on a regular basis.

Independent of data model (solution works with any Infocube and query). Low maintenance (one-time setup of calculated key figures which can be reused). Very easy to use (simple input of alternate unit of measure by user). Correct display of unit of measure in query result (important if you want to use result in further calculations). Correct aggregation of converted quantities (totals and subtotals are calculated). Low performance impact (conversion factors are read once from master data table before selection of transaction data). No impact on transaction data (aggregates, InfoSources, update rules, etc.). Can be implemented in SAP BW release 2.0A to 3.5.

1.4

Version History
Initial release of How-to paper. Improved handling of inexistent conversion factors (see section 3.7, include ZXRSRU01). Correction of user exit coding (for example missing ABAP variables). Added reference to SAP note 617048: Unit of measure displayed as ERR in BEx.

January 2003 March 2003 May 2003

November 2004

Changed variable type from text to characteristic value, which allows usage of OLAP cache and also enables the value help for unit of measure. Note: If the old solution with a text variable is already in place, you have to use a different variable name (for example YCAUNIT instead of YTAUNIT). The ABAP coding does not have to be adjusted since the checking routine (I_STEP = 3) will be obsolete. How-to paper is also relevant for SAP BW release 3.5. Added table of contents.

July 2005

Removed obsolete variable validation (I_STEP = 3). Added information to appendix.

2002-05 SAP AMERICA, INC. AND SAP AG

HOW TO REPORT DATA IN ALTERNATE UNITS OF MEASURE

2 Solution
The following objects need to be installed for this solution. With the exception of the modification only standard functionality is used: Key figure: Conversion factor (attribute YUOMCNVF of characteristic 0MATERIAL) Characteristics: Material (0MATERIAL), Alternate Units of Measure (0MAT_UNIT) Variable: Alternate Unit of Measure (YTAUNIT) Formula Variable: Conversion factor (YFCONVF) Modification: Read attributes for formula variables (LRRSVF20) User Exit: Variable Enhancement (ZXRSRU01) Calculated Key Figures for Queries

When a query is executed, then following steps are processed: 1. User enters Alternate Unit of Measure on variable selection screen for variable YTAUNIT. 2. Text variable is being validated in user exit ZXRSRU01. If input is OK, the alternate unit of measure is stored in a global program variable. Otherwise an error message is displayed and the user has to correct the entry. 3. The system starts the query program and reads all values for attribute YUOMCNVF of characteristic 0MATERIAL in order to determine the formula variable YFCONVF. 4. This is the point where the modification is processed. The modification will call the user exit ZXRSRU01 once for each value of 0MATERIAL that is selected in the query. This allows determining the conversion factor based on user input of the alternate unit of measure (instead of using the attribute value from the material master data). The actual value of attribute YUOMCNVF is ignored. 5. In the user exit ZXRSRU01 for each material the conversion factor from the base unit of measure to the alternate unit of measure will be determined from the master data table of characteristic 0MAT_UNIT. If a conversion factor cannot be determined (does not exist or division by zero), it is set to zero. The conversion factors are buffered in memory in order to minimize database selections. 6. The system continues processing the query. The transaction data is selected from the InfoCube. Then the system determines the result of each calculated key figure based on the formula variable.

2002-05 SAP AMERICA, INC. AND SAP AG

HOW TO REPORT DATA IN ALTERNATE UNITS OF MEASURE

3 The Step-By-Step Solution


3.1 Key Figure for Conversion Factor

Create key figure YUOMCNVF for conversion factor.

2002-05 SAP AMERICA, INC. AND SAP AG

HOW TO REPORT DATA IN ALTERNATE UNITS OF MEASURE

3.2

Characteristic Material

Activate InfoObject 0MATERIAL from business content. Add key figure YUOMCNVF as an attribute to InfoObject 0MATERIAL. Note: This attribute can be left empty (initial value) and does not need to be filled with any conversion factor!

2002-05 SAP AMERICA, INC. AND SAP AG

HOW TO REPORT DATA IN ALTERNATE UNITS OF MEASURE

3.3

Characteristic for Alternate Units of Measure

Activate InfoObject 0MAT_UNIT from business content. Load conversion factors from R/3 into InfoObject 0MAT_UNIT. Note: The numerator and denominator attributes need to be filled in the master data table.

2002-05 SAP AMERICA, INC. AND SAP AG

HOW TO REPORT DATA IN ALTERNATE UNITS OF MEASURE

In order to determine the conversion factor from the base unit of measure to an alternate unit of measure the following formula has to be applied.

Conversion Factor =

Numerator (Base UoM) Denominato r (Base UoM) Numerator (Alternate UoM) Denominato r (Alternate UoM)

Quantity (Alternate UoM) = Quantity (Base UoM) * Conversion Factor

2002-05 SAP AMERICA, INC. AND SAP AG

HOW TO REPORT DATA IN ALTERNATE UNITS OF MEASURE

3.4

Variable for Alternate Unit of Measure

Note: The screen shots show the variable wizard of release 3.x. In release 2.x, you have to use transaction RSZV to create variables. Create variable YTAUNIT for characteristic Unit of Measure (0UNIT).

2002-05 SAP AMERICA, INC. AND SAP AG

HOW TO REPORT DATA IN ALTERNATE UNITS OF MEASURE

Optionally, enter a default value.

2002-05 SAP AMERICA, INC. AND SAP AG

10

HOW TO REPORT DATA IN ALTERNATE UNITS OF MEASURE

3.5

Formula Variable for Conversion Factor

Create formula variable YFCONVF.

2002-05 SAP AMERICA, INC. AND SAP AG

11

HOW TO REPORT DATA IN ALTERNATE UNITS OF MEASURE Pick the attribute that was added to Material in chapter 3.2 (YUOMCNVF).

2002-05 SAP AMERICA, INC. AND SAP AG

12

HOW TO REPORT DATA IN ALTERNATE UNITS OF MEASURE

3.6

Modification

Implement modification in program LRRSVF20.


*----------------------------------------------------------------------* ***INCLUDE LRRSVF20 . *----------------------------------------------------------------------* *&---------------------------------------------------------------------* *& Form varchavl_atr_get *&---------------------------------------------------------------------* form varchavl_atr_get using i_t_sid type rrsi_t_sid i_chanm type rsd_iobjnm i_th_var_atr type rro01_th_var_lrech i_srdate type sy-datum i_mostrecent type rsr_mostrecent changing c_th_varchavl type rrsv_th_varchavl. call method l_r_reader->sid_read_master exporting i_readatr = rsdm_c_readatr-specified i_t_req_atr = l_t_req_atr i_date = i_srdate i_mostrecent = i_mostrecent importing e_tx_atr = l_tx_atr changing c_t_chavlinfo = l_t_chavlinfo exceptions others = 1. if sy-subrc <> 0. raise inherited_error. endif. *{ INSERT *** Enhancement Alternate U.o.M. INCLUDE ybw_aunit_enhancement. * *} INSERT PERFORM varchavl_atr_fill USING i_th_var_atr l_tx_atr CHANGING c_th_varchavl. ... endform. " varchavl_atr_get

2002-05 SAP AMERICA, INC. AND SAP AG

13

HOW TO REPORT DATA IN ALTERNATE UNITS OF MEASURE


*----------------------------------------------------------------------* ***INCLUDE YBW_AUNIT_ENHANCEMENT. *----------------------------------------------------------------------* TYPE-POOLS: rrs0. DATA: l_vnam l_s_cob_pro l_s_rkb1d l_periv l_t_var_range l_s_var_range l_t_range l_s_range l_unit l_currency FIELD-SYMBOLS: <l_sx_atr> <l_s_var> <l_s_atr> <l_s_atr_cu>

LIKE TYPE TYPE TYPE TYPE TYPE TYPE TYPE LIKE LIKE

rszglobv-vnam, rsd_s_cob_pro, rsr_s_rkb1d, rro01_s_rkb1f-periv, rrs0_t_var_range, rrs0_s_var_range, rsr_t_rangesid, rsr_s_rangesid, rszglobv-meeht, rszglobv-waers.

TYPE TYPE TYPE TYPE

rsdm_sx_atr, rro01_s_var_lrech, rsdm_s_atr, rsdm_s_atr.

* Loop over all characteristic values LOOP AT l_tx_atr ASSIGNING <l_sx_atr>. * Loop over all variables to be replaced by attributes LOOP AT i_th_var_atr ASSIGNING <l_s_var>. * Fill additional information into pseudo variables REFRESH l_t_var_range. InfoObject (i.e. characteristic) CLEAR l_s_var_range. l_s_var_range-sign = 'I'. l_s_var_range-opt = 'EQ'. l_s_var_range-vnam = '1CHANM'. l_s_var_range-iobjnm = i_chanm. l_s_var_range-low = <l_sx_atr>-chavl. APPEND l_s_var_range TO l_t_var_range. Attribute READ TABLE <l_sx_atr>-t_atr ASSIGNING <l_s_atr> WITH KEY attrinm = <l_s_var>-attrinm. IF sy-subrc <> 0. RAISE x_message. ENDIF. CLEAR l_s_var_range. l_s_var_range-sign l_s_var_range-opt l_s_var_range-vnam l_s_var_range-iobjnm l_s_var_range-low APPEND l_s_var_range

= 'I'. = 'EQ'. = '1ATTRINM'. = <l_s_atr>-attrinm. = <l_s_atr>-attrivl. TO l_t_var_range.

2002-05 SAP AMERICA, INC. AND SAP AG

14

HOW TO REPORT DATA IN ALTERNATE UNITS OF MEASURE


* Unit of measure (only for amounts and quantities) IF ( <l_s_var>-mwkz = 'M' OR <l_s_var>-mwkz = 'Q' ) AND ( <l_s_var>-fixcudim IS INITIAL ). CLEAR l_s_var_range. l_s_var_range-sign = 'I'. l_s_var_range-opt = 'EQ'. l_s_var_range-vnam = '1CUNM'. READ TABLE <l_sx_atr>-t_atr ASSIGNING <l_s_atr_cu> WITH KEY attrinm = <l_s_var>-cunm. IF sy-subrc = 0. l_s_var_range-iobjnm = <l_s_atr_cu>-attrinm. l_s_var_range-low = <l_s_atr_cu>-attrivl. APPEND l_s_var_range TO l_t_var_range. ENDIF. ENDIF. * Key date of query CLEAR l_s_var_range. l_s_var_range-sign l_s_var_range-opt l_s_var_range-vnam l_s_var_range-iobjnm l_s_var_range-low APPEND l_s_var_range

= 'I'. = 'EQ'. = '1DATE'. = '0DATE'. = i_srdate. TO l_t_var_range.

InfoObject properties CALL FUNCTION 'RSD_COB_PRO_GET_ALWAYS' EXPORTING i_iobjnm = i_chanm IMPORTING e_s_cob_pro = l_s_cob_pro EXCEPTIONS infocube_not_found = 1 error_reading_infocatalog = 2 iobjnm_not_found = 3 illegal_input = 4 OTHERS = 5. IF sy-subrc <> 0. MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. ENDIF. l_vnam = <l_s_atr>-attrinm.

2002-05 SAP AMERICA, INC. AND SAP AG

15

HOW TO REPORT DATA IN ALTERNATE UNITS OF MEASURE


* Call variable exit to get virtual attribute CALL FUNCTION 'EXIT_SAPLRRS0_001' EXPORTING i_vnam = l_vnam i_vartyp = rrkg_c_vartyp-formula i_iobjnm = i_chanm i_s_cob_pro = l_s_cob_pro i_s_rkb1d = l_s_rkb1d i_periv = l_periv i_t_var_range = l_t_var_range IMPORTING e_t_range = l_t_range e_meeht = l_unit e_waers = l_currency EXCEPTIONS OTHERS = 1. IF sy-subrc = 0. READ TABLE l_t_range INTO l_s_range INDEX 1. IF sy-subrc = 0. Attribute value <l_s_atr>-attrivl = l_s_range-low. Attribute unit of measure (only for amounts and quantities) IF <l_s_var>-mwkz = 'M' AND <l_s_var>-fixcudim IS INITIAL. <l_s_atr_cu>-attrivl = l_unit. ELSEIF <l_s_var>-mwkz = 'W' AND <l_s_var>-fixcudim IS INITIAL. <l_s_atr_cu>-attrivl = l_currency. ENDIF. ENDIF. ENDIF. ENDLOOP. " variables for attributes ENDLOOP. " characteristic values

* *

2002-05 SAP AMERICA, INC. AND SAP AG

16

HOW TO REPORT DATA IN ALTERNATE UNITS OF MEASURE

3.7

User Exit for Variables

Implement user exit for variables and activate enhancement RSR00001. Note: Be sure to implement the coding into the correct include. Otherwise the solution will not work.
*----------------------------------------------------------------------* ***INCLUDE ZXRSRTOP. *----------------------------------------------------------------------* *** Enhancement: Alternate U.o.M. DATA: g_aunit TYPE /bi0/oimat_unit. *----------------------------------------------------------------------* ***INCLUDE ZXRSRU01. *----------------------------------------------------------------------* *** Enhancement: Alternate U.o.M. DATA: l_s_range TYPE rsr_s_rangesid, l_s_var TYPE rrs0_s_var_range. * l_dummy(72) TYPE c. DATA: l_factor l_factor1 l_factor2 l_msgv1 l_msgv2 l_msgv3 l_material l_base_uom

"delete

TYPE TYPE TYPE LIKE LIKE LIKE LIKE LIKE

f, f, f, sy-msgv1, sy-msgv2, sy-msgv3, /bi0/pmaterial-material, /bi0/pmaterial-base_uom.

"insert "insert "insert

* Called after user input IF i_step = 3. * Get variable for alternative unit entered by user * Validate entry and store as global variable READ TABLE i_t_var_range WITH KEY vnam = 'YTAUNIT' INTO l_s_var. IF sy-subrc = 0. g_aunit = l_s_var-low. insert * >>> delete * TRANSLATE l_s_var-low TO UPPER CASE. "#EC TRANSLANG * CALL FUNCTION 'CONVERSION_EXIT_CUNIT_INPUT' * EXPORTING * input = l_s_var-low * language = sy-langu * IMPORTING * output = g_aunit * EXCEPTIONS * unit_not_found = 1 * OTHERS = 2. * IF sy-subrc <> 0. ** Error: Please enter a valid unit of measure * l_msgv1 = 'Unknown unit of measure:'. * l_msgv2 = l_s_var-low. "insert * l_msgv3 = '. Please enter a valid unit of measure.'. * CALL FUNCTION 'RRMS_MESSAGE_HANDLING' * EXPORTING

2002-05 SAP AMERICA, INC. AND SAP AG

17

HOW TO REPORT DATA IN ALTERNATE UNITS OF MEASURE


* i_class = 'R9' * i_type = 'E' * i_number = '000' * i_msgv1 = l_msgv1 * i_msgv2 = l_msgv2 * i_msgv3 = l_msgv3 * EXCEPTIONS * dummy = 0 * OTHERS = 0. * CALL FUNCTION 'RRMS_MESSAGES_SHOW'. * CALL FUNCTION 'RRMS_MESSAGES_DELETE'. * sy-subrc = 4. * RAISE again. * ENDIF. * <<< delete ENDIF. ENDIF. * Called from "Get Attribute" Function (Modification) * I_VNAM Attribute (not the name of the formula variable) * I_IOBJNM InfoObject * I_T_VAR_RANGE Contains characteristic value, attribute value, * unit of measure, query key date IF i_step = 0 AND i_vnam = 'YUOMCNVF' AND i_iobjnm = '0MATERIAL'. * read material and base uom from variables LOOP AT i_t_var_range INTO l_s_var. CASE l_s_var-iobjnm. WHEN '0MATERIAL'. l_material = l_s_var-low. WHEN '0BASE_UOM'. l_base_uom = l_s_var-low. ENDCASE. ENDLOOP. * get factor for base UoM PERFORM get_factor USING l_material l_base_uom l_factor1. * get factor for alternate UoM PERFORM get_factor USING l_material g_aunit

"change

"#EC *

l_factor2.

* return conversion factor for variable IF l_factor2 <> '0.0'. l_factor = l_factor1 / l_factor2. e_meeht = g_aunit. "insert ELSE. * When the UoM conversion is not maintained, instead of showing 0, the * base UoM with a factor of 1 is used. Therefore, the user sees MIXED * VALUES in the total line and knows right away that there is something * wrong. That way its easier to track inexistent conversion factors. * l_factor = 0. "delete l_factor = 1. "insert e_meeht = l_base_uom. "insert ENDIF.

2002-05 SAP AMERICA, INC. AND SAP AG

18

HOW TO REPORT DATA IN ALTERNATE UNITS OF MEASURE


CLEAR l_s_range. l_s_range-sign = l_s_range-opt = l_s_range-low = APPEND l_s_range

'I'. 'EQ'. l_factor. TO e_t_range. "delete

* e_meeht = g_aunit. ENDIF.

*----------------------------------------------------------------------* ***INCLUDE ZXRSRF01. *----------------------------------------------------------------------* *&---------------------------------------------------------------------* *& Form get_factor *&---------------------------------------------------------------------* * Get conversion factor from /bi0/pmat_unit *----------------------------------------------------------------------* FORM get_factor USING i_material TYPE /bi0/oimaterial i_mat_unit TYPE /bi0/oimat_unit e_factor. TYPES: BEGIN OF ys_mat_unit, material TYPE /bi0/oimaterial, mat_unit TYPE /bi0/oimat_unit, numerator TYPE /bi0/oinumerator, denomintr TYPE /bi0/oidenomintr, END OF ys_mat_unit. DATA: l_s_mat_unit TYPE ys_mat_unit. STATICS: s_t_mat_unit TYPE SORTED TABLE OF ys_mat_unit WITH UNIQUE DEFAULT KEY. CLEAR: l_s_mat_unit, e_factor. READ TABLE s_t_mat_unit INTO l_s_mat_unit WITH KEY material = i_material mat_unit = i_mat_unit. IF sy-subrc <> 0. SELECT SINGLE * FROM /bi0/pmat_unit INTO CORRESPONDING FIELDS OF l_s_mat_unit WHERE material = i_material AND mat_unit = i_mat_unit AND objvers = 'A'. IF sy-subrc = 0. INSERT l_s_mat_unit INTO TABLE s_t_mat_unit. ENDIF. ENDIF. IF l_s_mat_unit-denomintr <> 0. e_factor = l_s_mat_unit-numerator / l_s_mat_unit-denomintr. ENDIF. ENDFORM. " get_factor

2002-05 SAP AMERICA, INC. AND SAP AG

19

HOW TO REPORT DATA IN ALTERNATE UNITS OF MEASURE

3.8

Calculated Key Figures for Conversion

For each basic key figure that should be shown with the alternate unit of measure, create a matching calculated key figure. Note: The solution works only if you build calculated key figures. You must not use the conversion factor (formula variable) directly in structure formulas.

The generic formula for the conversion is: = NODIM( Quantity ) * 'Conversion Factor to Alternative Unit of Measure'

2002-05 SAP AMERICA, INC. AND SAP AG

20

HOW TO REPORT DATA IN ALTERNATE UNITS OF MEASURE

2002-05 SAP AMERICA, INC. AND SAP AG

21

HOW TO REPORT DATA IN ALTERNATE UNITS OF MEASURE

3.9

Restricted Key Figure for Input

To activate the input of the "Alternative Unit of Measure, create one restricted key figure. Restrict the selection for Unit of Measure to the variable that was created in step 3.4.

2002-05 SAP AMERICA, INC. AND SAP AG

22

HOW TO REPORT DATA IN ALTERNATE UNITS OF MEASURE

3.10 Create a Query


Now you can add the calculated key figures and the restricted key figure to the query.

Set the restricted key figure to "Always Hide. It is used only to reference the input variable for Unit of Measure.

2002-05 SAP AMERICA, INC. AND SAP AG

23

HOW TO REPORT DATA IN ALTERNATE UNITS OF MEASURE

4 Presentation
When you execute the query, the user will be prompted for the alternate unit of measure on the variable selection screen.

The unit of measure can be entered or selected using the value help.

The query result will show the quantities converted into the unit of measure entered by the user. If no conversion factor is available (in the master data for 0MAT_UNIT) then the result of the conversion is equal to the original value.

Note: In this example, conversion factors have been maintained only for some materials. Therefore, the some converted values are shown with the original amount and unit of measure.

2002-05 SAP AMERICA, INC. AND SAP AG

24

HOW TO REPORT DATA IN ALTERNATE UNITS OF MEASURE

5 Comments
In BW release 3.x you have to delete the OLAP cache for the queries that use the alternative unit of measure, whenever new conversion factors are loaded! Alternatively, you can deactivate the OLAP cache for those queries (transaction RSRT). The "key to success" is to use a calculated key figure. Anything else like a formula in a structure does not work! Also this calculated key figure must be defined based on the basic key figure of the InfoCube and not based on other restricted or calculated key figures. Note: In order to return to the SAP Standard, simply remove the modification from program LRRSVF20. If the units of measure are displayed as ERR in the result set, please implement SAP note 617048 or the corresponding support pack.

6 Appendix
Here are some hints for debugging in case the query is not showing the expected results: 1. 2. 3. Run transaction RSRT and select your query. Edit Technical Information

Check section OLAP-Relevant Data. Calculation before Aggregation and Attributes in Calculated Key Figures both need to be Y. Otherwise the key figure(s) are not setup correctly. Note: The red/yellow lights are OK and can be ignored.

2002-05 SAP AMERICA, INC. AND SAP AG

25

HOW TO REPORT DATA IN ALTERNATE UNITS OF MEASURE

4. 5. 6.

Go to

Display gen. report

Scroll down to "FORM SELECT_0 ..." In this form routine you should find the following lines: PERFORM VARCHAVL_INIT in program (...) USING '0MATERIAL' L_T_0MATERIAL. LOOP AT I_T_DATA INTO G_S_DATA. If the PERFORM VARCHAVL_INIT does not exist, the query definition is not correct. There is no calculated key figure in this query using the formula variable, which is replaced by the attribute. Check the query definition. If the PERFORM VARCHAVL_INIT exists, put a break-point on that line and run the query (via RSRT). After you entered the query variable on the popup, the system will stop on this line and if you step through the code it will reach the point of the modification. In addition you might want to put another break-point into the user exit for the variable replacement.

7.

8.

2002-05 SAP AMERICA, INC. AND SAP AG

26