Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
carlosbasto
Product and Topic Expert
Product and Topic Expert
18,185

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*/V<Infocube>2 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

    TYPE-POOLS: 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_sfc
-chanm    = '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_sfc
-chanm    = '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_sfc
-chanm    = '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_sfc
-chanm    = '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_sfc
-chanm    = '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_sfk
-kyfnm    = '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_sfk
-kyfnm    = '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
*  BETWEEN  199901  AND  299901
*    CLEAR g_s_range.
*
*    g_s_range-chanm    = '0CALDAY'.
*    g_s_range-sign     = rs_c_range_sign-including.
*    g_s_range-compop   = rs_c_range_opt-between.
*    g_s_range-low      = '199901'.
*    g_s_range-high     = '299901'.
*    APPEND g_s_range TO g_t_range.

DATA: g_end_of_data  TYPE rs_bool,
g_first_call  
TYPE rs_bool.

g_end_of_data
= rs_c_false.
g_first_call 
= rs_c_true.

WHILE g_end_of_data = rs_c_false.

CALL FUNCTION 'RSDRI_INFOPROV_READ'
EXPORTING
i_infoprov             
= '0IC_C03'
i_th_sfc               
= g_th_sfc
i_th_sfk               
= g_th_sfk
          i_t_range                     = g_t_range
          i_reference_date        = sy-datum
          i_save_in_table         = rs_c_false
          i_save_in_file          = rs_c_false
i_packagesize          
= 10000
i_authority_check      
= rsdrc_c_authchk-read
IMPORTING
e_t_data               
= g_t_data
e_end_of_data          
= g_end_of_data
CHANGING
c_first_call           
= g_first_call
EXCEPTIONS
illegal_input          
= 1
illegal_input_sfc      
= 2
illegal_input_sfk      
= 3
illegal_input_range    
= 4
illegal_input_tablesel 
= 5
no_authorization       
= 6
illegal_download       
= 8
illegal_tablename      
= 9
OTHERS                  = 11.

IF sy-subrc <> 0.
*        BREAK-POINT.                                       "#EC
EXIT.
ENDIF.

ENDWHILE.


5. Additional Uses

Some parameters can improve the selection in the infocube.

To add information about these functionalities, consider the following examples.

I_ROLLUP_ONLY = RS_C_TRUE

set the selection to bring compressed requests.

I_ROLLUP_ONLY = RS_C_FALSE

Set the selection to bring uncompressed requests.

To crop this selection, the parameter I_T_REQUID can be used. This will filter the requests to be selected.

The table E_T_DATA might save its results in a file or in a table.

To get this functionality, declare I_SAVE_IN_TABLE or I_SAVE_IN_FILE in the importing parameters of the Function Module.

6. Related Content

Read Infoprovider Data

Read data from 0BWTC_C02 via ABAP

RSDRI_INFOPROV_READ_DEMO SAP Report - Demo for using module RSDRI_INFOPROV_READ

  

Disclaimer and Liability Notice

This document may discuss sample coding or other information that does not include SAP official interfaces and therefore is not supported by SAP. Changes made based on this information are not supported and can be overwritten during an upgrade.

SAP will not be held liable for any damages caused by using or misusing the information, code or methods suggested in this document, and anyone using these methods does so at his/her own risk.

SAP offers no guarantees and assumes no responsibility or liability of any type with respect to the content of this technical article or code sample, including any liability resulting from incompatibility between the content within this document and the materials and services offered by SAP. You agree that you will not hold, or seek to hold, SAP responsible or liable with respect to the content of this document.

2 Comments
Labels in this area