Professional Documents
Culture Documents
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 REALIZE SUMMARIZED DISPLAY OF STOCK VALUES ON STORAGE LOCATION LEVEL
1 Business Scenario
This how to paper fills the gap by providing queries with summarized display of stock values on
storage location level.
OSS note 589024 describes the solution to display stock values on storage location level mainly for
single material numbers. Such a solution cannot be applied to queries that have no drill down on
material number level because individual material prices are not considered.
The following steps describe a solution that considers individual material prices in such queries.
Please note that with this solution also the correct stock value on storage location for a single
material can be realized. This can be used as an alternative to the solution of OSS note 589024.
Also it is possible to apply this solution for reporting stock values on stock type level.
In both cases the following solution has to be changed accordingly.
2 Introduction
Calculating stock values on storage location level is done by virtual key figures using the BADI
"RSR_OLAP_BADI.
At first method "INITIALIZE executes a pre query that selects plant quantities and values of all
materials. With this a price factor for each material on plant level can be calculated that calculates the
storage location value by multiplying it with the storage location quantity (method COMPUTE).
This algorithm follow the R/3 design that evaluation is done on plant level and storage location values
are calculated in the runtime of corresponding reports (see OSS notes 322335 and 543188).
The following steps have to by done (example with Z0IC_C03 that is a copy of Business Content
InfoCube 0IC_C03):
1. Pre query with plant quantity/values of all materials: Z0IC_C03/MAT_PRICE
2. Main query that contains the summarized display of storage location stock values:
Z0IC_C03/VALUE_STORAGE_LOCATION
3. DDIC structure: ZZWREX
4. Function module: ZFM_IM_Z_MATERIAL_PRICE
5. Class: ZCL_IM_Z_MATERIAL_PRICE (BADI RSR_OLAP_BADI)
6. User Exit Include: ZXRSRU01 (User Exit RSR00001)
1. Query Definition
2. Main query that contains the summarized display of storage location stock
values
1. Transaction SE11
DATA:
l_t_mndtry_prptys TYPE g_t_mndtry_prptys,
* l_s_mndtry_prptys TYPE g_s_mndtry_prptys,
CONSTANTS:
* g_c_axis_columns TYPE g_s_axis_info-axis VALUE '000',
g_c_axis_rows TYPE g_s_axis_info-axis VALUE '001'.
* g_c_axis_slicer TYPE g_s_axis_info-axis VALUE '255'.
2. Transaction
SE37
interfaces
3. Transaction
SE37
exceptions
ENDFUNCTION.
5. BADI "RSR_OLAP_BADI"
1. Transaction
SE19
2. Transaction
SE24 class
builder
3. Transaction
SE24 local
class
definitions/types
4. Transaction
SE24
Attributes
if i_s_rkb1d-compid = 'VALUE_STORAGE_LOCATION'.
l_s_chanm-chanm = '0MATERIAL'.
l_s_chanm-mode = rrke_c_mode-read.
append l_s_chanm to c_t_chanm.
l_s_chanm-chanm = '0LOC_CURRCY'.
l_s_chanm-mode = rrke_c_mode-no_selection.
append l_s_chanm to c_t_chanm.
endif.
Endmethod.
APPEND
'SELECT' TO l_t_command_text.
APPEND
'[Measures].MEMBERS ON COLUMNS,' TO l_t_command_text.
APPEND
'NON EMPTY' TO l_t_command_text.
APPEND
'[0MATERIAL].[LEVEL01].MEMBERS ' TO l_t_command_text.
APPEND
'properties member_name ' TO l_t_command_text.
APPEND
'on rows ' TO l_t_command_text.
APPEND
'FROM Z0IC_C03/MAT_PRICE ' TO l_t_command_text.
APPEND
'SAP VARIABLES' TO l_t_command_text.
CONCATENATE
'[0P_PLANT] INCLUDING [0PLANT].[' plant ']' INTO l_s_command_text.
APPEND l_s_command_text TO l_t_command_text.
CLEAR l_s_command_text.
CONCATENATE
'[0PCALMON] INCLUDING [0CALMONTH].[' month ']' INTO
l_s_command_text.
APPEND l_s_command_text TO l_t_command_text.
IF first IS INITIAL.
FREE: l_t_bw_data, t_stock.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
first = 'X'.
ENDIF.
* 6. BADI framework
ENDMETHOD.
endmethod.
1. Implement this * !!! adjust this accordingly to your query definitions !!!
data: l_s_range type rrrangesid.
coding in the if i_s_rkb1d-compid = 'VALUE_STORAGE_LOCATION'.
user exit if i_step = 3.
loop at i_t_var_range into l_s_var_range.
if l_s_var_range-vnam = 'ZZMONTH'.
ZCL_IM_Z_MATERIAL_PRICE=>month = l_s_var_range-low.
elseif l_s_var_range-vnam = 'ZZPLANT'.
ZCL_IM_Z_MATERIAL_PRICE=>plant = l_s_var_range-low.
endif.
endloop.
endif.
endif.
4 Summary
Mandatory entries of query in step 2 are handed over in the user exit of step 6 to the instance of the
ABAP class in step 5. With this entries pre query of step 1 is executed.
All coding parts are using released BAPIs. Coding is as much as possible generic so that changes
due the changed query definitions are rather easy to implement. Coding parts that have to be
adapted are marked with the comment "* !!! adjust this accordingly to your query
definitions !!!".
5 Critical factors
1. Performance
The runtime of the pre query could become critical as in some cases a high volume of data has to be
selected.
If the pre query exeeds a cell size of 999.999 funktion module "ZFM_IM_Z_MATERIAL_PRICE has
to called several time in any case (current technical limitation), for instance for every material group.
Object and source code has to be adapted (see chapter 4).
In every case runtime of such queries are high due to reporting on mass data. Therefore it is
recommended to use pre-calculated queries instead of executing them online.
2. Enhancements
It it is required to report on more than one plant variable restrictions have to be changed accordingly.
Pre query calls should then be realized individual per plant due to performance reasons (see above).
6 Attachments