Selecting data from an Infocube using the FM RSDRI_INFOCUBE_READ

Applies to:

SAP Business Intelligence 7.0. For more information, visit the Business Intelligence homepage.

Summary

This document describes how-to use the FM RSDRI_INFOCUBE_READ to select data from any Infocube.

Author(s):    Carlos Basto

Company:    Accenture

Created on:  22 November 2011

Author Bio

Carlos Basto is a Senior Programmer at Accenture. He has been involved in SAP BW Consulting and Support Projects.

 

Table of Contents

  1. 1.            Scenario. 3
  2. 2.            Function Module Parameters. 3
  3. 3.            SAP RSDRI_INFOPROV_READ_DEMO.. 3
  4. 5.            Additional Uses. 7
  5. 6.            Related Content 8

Disclaimer and Liability Notice. 9

 

1. Scenario

Lookup data from an Infocube is needed to support a business rules in the actual environment. This task will be performed by using the FM RSDRI_INFOPROV_READ.

2. Function Module Parameters

First of all, it’s important to understand what parameters this FM has and how to use them.

Parameter Name   What they do?
I_INFOPROV   Technical Name of InfoProvider
I_TH_SFC   Characteristics That Are to Be Returned
I_TH_SFK   Key Figures That Are to Be Returned
I_T_RANGE   Selection Conditions Connected with AND
I_TH_TABLESEL   List of Table Selections
I_T_RTIME   BW Data Manager: Table of Intervals for Non-Cumulatives
I_REFERENCE_DATE   Key Date
I_ROLLUP_ONLY   Cubes: Read Data Only to Rollup? Is Cropped with I_T_REQUID
I_T_REQUID   Optional Selection of Relevant Requests
I_SAVE_IN_TABLE   Save Result in DB Table?
I_TABLENAME   Name of the Results Table
I_SAVE_IN_FILE   Save Result in File?
I_FILENAME   Name of Results File
I_PACKAGESIZE   Size of Returned Data Package
I_MAXROWS   Stops After This Number of Records
I_AUTHORITY_CHECK   Should Access Check Be Executed Read/Write/None
I_CURRENCY_CONVERSION   Convert Currency Key Figures
I_USE_DB_AGGREGATION   Aggregate Run on DB
I_USE_AGGREGATES   (Only InfoCubes): Use Aggregate Yes/No
I_READ_ODS_DELTA   (Only ODS Objects): Should Data Be Read from the ODS Change Log?
I_CALLER   ID of User who Called up Transaction
I_DEBUG   Debugging Mode On/Off
I_CLEAR   Clear Static References

3. SAP RSDRI_INFOPROV_READ_DEMO

More information about using this FM can be found at t-code SE38 with the report RSDRI_INFOPROV_READ_DEMO.

All parts of this FM is explained completely in this report program.

Some global parameters are available for implementing this FM easily.

G_S_DATA = It’s a working area to hold one record as returned by a query one the infocube; the structure /BI*/V2 has a column for every characteristic, navigational attribute and key figure of the related infocube. Please note that the query might only fill a few of those columns that have been requested within the query.

G_T_DATA = an internal table that can hold the result set.

G_S_SFC = description of a characteristic or navigational attribute that is requested by a query.

G_S_SFK = description of a key figure that is requested by a query.

G_S_RANGE = description of a restriction on a characteristic or navigational attribute..

4.    Code Example

 

    TYPEPOOLS: rs, rsdrc.

TYPES:
BEGIN OF gt_s_data,
“Characteristics
plant
(4)          TYPE c,
material
(18)      TYPE c,
base_uom
(3)       TYPE c,
batch
(10)         TYPE c,
calday
(8)         TYPE c,
“Key figures
rectotstck    
TYPE f,
isstotstck    
TYPE f,
END OF gt_s_data.

DATA:
g_s_data       
TYPE gt_s_data,
g_t_data       
TYPE STANDARD TABLE OF gt_s_data
WITH DEFAULT KEY INITIAL SIZE 10000,
g_s_sfc        
TYPE rsdri_s_sfc,
g_th_sfc       
TYPE rsdri_th_sfc,
g_s_sfk        
TYPE rsdri_s_sfk,
g_th_sfk       
TYPE rsdri_th_sfk,
g_s_range      
TYPE rsdri_s_range,
g_t_range      
TYPE rsdri_t_range.

CLEAR g_s_sfc.

g_s_sfcchanm    = ‘0PLANT’.
g_s_sfc
chaalias = ‘PLANT’.
g_s_sfc
orderby  = 0.

INSERT g_s_sfc INTO TABLE g_th_sfc.

CLEAR g_s_sfc.

g_s_sfcchanm    = ‘0MATERIAL’.
g_s_sfc
chaalias = ‘MATERIAL’.
g_s_sfc
orderby  = 0.

INSERT g_s_sfc INTO TABLE g_th_sfc.

CLEAR g_s_sfc.

g_s_sfcchanm    = ‘0BATCH’.
g_s_sfc
chaalias = ‘BATCH’.
g_s_sfc
orderby  = 0.

INSERT g_s_sfc INTO TABLE g_th_sfc.

CLEAR g_s_sfc.

g_s_sfcchanm    = ‘0BASE_UOM’.
g_s_sfc
chaalias = ‘BASE_UOM’.
g_s_sfc
orderby  = 0.

INSERT g_s_sfc INTO TABLE g_th_sfc.

CLEAR g_s_sfc.

g_s_sfcchanm    = ‘0CALDAY’.
g_s_sfc
chaalias = ‘CALDAY’.
g_s_sfc
orderby  = 0.

INSERT g_s_sfc INTO TABLE g_th_sfc.

* For the following key figures should be returned:

CLEAR g_s_sfk.

g_s_sfkkyfnm    = ‘0RECTOTSTCK’.
g_s_sfk
kyfalias = ‘RECTOTSTCK’.
g_s_sfk
aggr     = ‘SUM’.

INSERT g_s_sfk INTO TABLE g_th_sfk.

CLEAR g_s_sfk.

g_s_sfkkyfnm    = ‘0ISSTOTSTCK’.
g_s_sfk
kyfalias = ‘ISSTOTSTCK’.
g_s_sfk
aggr     = ‘SUM’.

INSERT g_s_sfk INTO TABLE g_th_sfk.

*    clear G_T_RANGE.
“This range is the where condition in the selection. Use this to choose what fields “values must the selection comprises.
* Where condition
<span