The function RSDRI_INFOPROV_READ is released for the customers and can be used to read data from infoproviders. Basically RSDRI_INFOPROV_READ is nothing else then the so called Data Manager which is also used by a query to read the data from the providers. Other applications like SEM and APO are using this function as well. In SE37 you can find a good documentation to this function. The ABAP Report RSDRI_INFOPROV_READ_DEMO contains an example of how the function module can be used.
There is also the function RSDRI_INFOPROV_READ_RFC which is only a wrapper for RSDRI_INFOPROV_READ enabling it to call the function via RFC ( see aslo SAP note 1325900).
Most important paramaters (see also the 'Function Module Documentation' in SE37 in order to get the entire list of parameters):
- I_INFOPROV - technical name of infoprovider
- I_TH_SFC - This internal table contains the list of characteristics / navigation attributes to be returned. Please note that CHAALIAS is the name of the return column (E_T_DATA) for the characteristic values ! If this does not match the program terminates (with sy-subrc=11).
- I_TH_SFK - This internal table contains the list of key figures that are to be returned.
- I_T_RANGE - This internal table contains the list of selection conditions that are linked with a logical AND operator. Conditions with the same CHANM are linked with OR. Please note that you need to use the internal values for selections (filter values), e.g. the value 001 instead of 1 (if the infoobject uses ALPHA conversion).
- I_ROLLUP_ONLY - Should only data that has been rolled up into the aggregates be considered or should the most current data be read? If "I_ROLLUP_ONLY" is set to SPACE, data from requests that are not rolled up yet (open/Yellow request) should be taken into account as well (for the data read). The default setting is I_ROLLUP_ONLY=X.
- E_T_DATA - This internal table defines, on the one hand, the return structure for the data to be read, and on the other hand, it serves as a container for the data that has been read.
- E_END_OF_DATA - This parameter indicates whether the data package returned to E_T_DATA is the last one.
- I_DEBUG - This flag is used to employ a debugging mode. In debugging mode, an executable (local) ABAPReport Z_RSDRI_INFOPROV_READ_DEBUG is generated that simulates the call (see SAP note 302937 )
- I_COMMIT_ALLOWED: if this parameter is set to false the function RSDRI_INFOPROV_READ does not carry out any commits - please see the function module documentation for further details
- E_T_MSG: this internal table contains the error messages; if the calling program does not use this import parameter you need to set a breakpoint in the function RS_EXCEPTION_TO_MESSAGE in order to find out details to errors (please see point 9).
List of Important Points/Common Problems
- Its necessary to define a LOOP until e_end_of_data = 'X'! Otherwise it is not guaranteed that all data records are retrieved (e.g. you only access the F fact table and ommit the E table) and that the system deletes all temporary tables (when used). Afterwards the internal variables are cleared and its possible to call RSDRI_INFOPROV_READ (with new paramters) again.
- A logical read access with RSDRI_INFOPROV_READ can contain more than one physical read access to the database (BWA,HANA). This in general is necessary for MultiProviders (to get the data from the partproviders) but also for 'normal' Infocubes to read the F- and E fact table. Within a single physical read the data is transfered to the calling program in packages (parameter I_PACKAGESIZE). The data of these packages can be processed (within the loop) by the calling program. If this is done by your program, please assure that there are no commits (commit work, or e.g. implicit commit done by an RFC call) in the coding since this would close all data base cursors and lead to a terminatation when the next package is fetched. In the logs you then find error messages like 'invalid cursor specified for database selection' (SM21) or 'Database selection with invalid cursor'.
- RSDRI_INFOPROV_READ_RFC: the RFC function cannot read packagewise, it returns the entire result in one package. The data is automatically wrapped and needs to be unwrapped by using the function RSDRI_DATA_UNWRAP (the result of G_T_RFCDATA is written into G_T_DATA). Please note that G_T_DATA is based on the so called V2-structure (/BIC/V'CUBE'2 -> it has a column for every characteristic, navigational attribute and key figure of the related cube; in case of a SPO, the V2 structure has 2 additional zeros in the technical name: '/BIC/V'...'002) of the infocube ! In case of an ADSO or HCPR which are field based, see the following Example. Please see also the demo report RSDRI_INFOPROV_READ_DEMO for further details.
- RSDRI_INFOPROV_READ may execute a Commit Work (e.g. if new temporary tables need to be created). This means that all cursors are closed, even if they are opened 'with hold' (would survive a DB commit). Temporary tables are created if you have e.g. many selections for a charcteristic in the internal table l_t_range. If you need to avoid such commits please try to simplify the l_t_range by using (e.g.) intervals. With BW73 its also possible to use the parameter I_COMMIT_ALLOWED to avoid commits.
- its not possible to explicilty switch off the usage of the BWA; if this is necessary you can use the following workaround: define the caller (I_CALLER) as a datamart (which per default does not use the BIA; RSDRS_C_CALLER-datamart). In case you set I_USE_AGGREGATES to false, neither aggregates nor BWA indexes nor Hana Column Views(if techically possible) are used.
- For a BW3x system its not possible to call RSDRI_INFOPROV_READ again from RSDRI_INFOPROV_READ. With BW7x this is possible.
- Make sure that all initial values in selections in i_t_range passed over to RSDRI_INFOPROV_READ are correct. Initial values for NUMC Data Types are '0', not space, also for DATS and TIMS data types.
- the physical read accesses are processed in parallel if the package size is less than zero and the parameter I_COMMIT_ALLOWED is true. This implies that the function RSDRI_INFOPROV_READ_RFC always (if possible) uses the execution mode 'parallel' since reading in packages is not supported (I_PACKAGESIZE=-1).
- if you don't have used the import parameter e_t_msg you need to proceed as follows to get the details to errors (RSDRI_INFOPROV_READ terminates with sy_subrc<>0): please set a breakpoint in the function RS_EXCEPTION_TO_MESSAGE (and then just press F7) and check the paramter e_t_msg in order to get more information. E.g. in case the chaalias defined in the structure I_TH_SFC does not match with the corresponding field in E_T_DATA you get the following eror messages:
"E |RS_EXCEPTION 000 |The parameter 'CORRESPONDING_FIELDS-CHAR01' not allowed "
E |RS_EXCEPTION 000 |An exception with the type CX_PARAMETER_INVALID occured "
- In case the function RS_EXCEPTION_TO_MESSAGE returns error messages like the following (example on ORACLE data base)
RS_EXCEPTION ORA-01455: converting column overflows integer datatype
DBMAN 257: 1455
then please check whether the same problems occurs in LISTCUBE (use the same restrictions and put the same infoobjects in the drilldown). If yes, please follow the instructions of SAP note 1557321 (in this case the overflow is not related to the usage of the function RSDRI_INFOPROV_READ). If no, please check the definitions of the key figures in your program in regard to the data type. Normally the data typer P (packed numbers) is used for for key figures (e.g. 0amount TYPE p DECIMALS 2).
- Please don't forget to exit the while loop if the function RSDRI_INFOPROV_READ returns with an error (sy-subrc<>0):
IF sy-subrc <> 0.
In case this coding lines are missing your program may end up in an endless loop.
- A logical read access with RSDRI_INFOPROV_READ can contain more than one physical read access to the database (see point 2). This is called a split. In general splits lead to a result which isn't fully aggregated even when the parameter I_USE_DB_AGGREGATION is set to 'X'. The module RSDRI_AGGREGATE_DATA is useful to aggregate a table E_T_DATA.
- Non-Cumulative Key Figures: Non-cumulative values can also be read using this interface. However, there is the restriction that only the non-cumulatives for the specified times (see I_T_RTIME) can be calculated; Aggregation over time (such as LAST or AVERAGE, for example) cannot be calculated using this interface. Even when the time-reference characteristic is not explicitly requested, a drilldown is inserted internally. Thus it may be that no completely aggregated results are returned.
- if the function returns unexpected values the following proceeding is recommended
- Compare the data of RSDRI_INFOPROV_READ with the output of transaction LISTCUBE when the same restrictions are used and the same infoobjects are drilled down.
- If there is no difference you can use LISTCUBE for the further analysis. E.G you can switch off the usage of Aggregates (or the BWA index / DB optimizer function) by using the button 'Execute&Debug'. Please see also SAP Note 1591837 Point (IV).
- If LISTCUBE displays the correct values please set a breakpoint in the function RSDRC_INFOPROV_READ and change the parameter I_SHOW_REPORT to 'X'. Then you get the SQL statements (BWA/HANA statements) displayed which you can compare with LISTCUBE (setting 'Display SQL Query'). Please note that LISTCUBE does not automatically restrict the infoobject 0REQUID, you get also data from requests displayed which are not availabel for reporting! Hence please always check the restriction regarding 0REQUID in the WHERE clause of the SQL statement. In case you want to switch off the usage of aggregates and the BWA index (for testing purposes) then please set the parameter I_USE_AGGREGATES to false (in the debugger).
- If an aggregate or the BWA index delivers wrong values please rebuild the aggregate/BWA index and search for SAP notes (valid for your support package) in these areas.
- If its difficult to debug the program (which calls RSDRI_INFOPROV_READ) in a dialog session then please proceed as described in SAP note 302937. The generated program Z_RSDRI_INFOPROV_READ_DEBUG can be used for checking the call of the function RSDRI_INFOPROV_READ. It offers similar debug options as LISTCUBE and stops automatically in the debugger right before RSDRI_INFOPROV_READ is called.
- In case data is missing from requests of the F fact table please check the parameter I_ROLLUP_ONLY and the status of the requests in RSA1 (Manage). The default setting is 'X' which means that only requests are taken into account which are released for reporting (already rolled up to aggregates/BWA)! If you want to read the data from all requests (including open/yellow requests from transactional cubes), please use I_ROLLUP_ONLY = ' '.
- It is possible to use a hierarchy node selection in I_T_RANGE. Please be aware that this node restriction is 'resolved' into the relevant leaves by the system. The reason is that RSDRI_INFOPROV_READ does not operate with SIDs which is necessary when dealing with hierachies! Therefore the corresponding field in E_T_DATA is also filled with the key values of the leaves and not with the (negative) SID of the node.
- If the paramter I_USE_DB_AGGREGATION is set to false, the function RSDRI_INFOPROV_READ does not retrieve the data from BWA indexes. The reason is the following: the data base/BWA returns in general much more data when there is no aggregation carried out. Since the BWA is not designed for transferring mass data (actually the RFC interface is the bottleneck, see SAP note 1018798) the system doesn't access the BWA but the data base.
- In the BW Releases before 7.4, the maximum length of a characteristic value is limited to 60 characters. As of Release 7.4 up to 250 characters are possible. In order to achieve this, the domain RSCHAVL was changed from CHAR 60 to SSTRING 1333, please see note 1823174 for further details. This change of the internal ABAP domain may lead to the runtime error PARAMETER_CONVERSION_ERROR in your program after the upgrade in the following situation: you use RSDRI_INFOPROV_READ_RFC to read data from a cube on a system which is still on a release < BW7.4. This issue can be solved by a small change of an internal ABAP type as explained in RSDRI_INFOPROV_READ_RFC & BW7.4.
- Nested calls of the function modules are indicated by error message DBMAN 882. This should be avoided when the function is used in virtual cubes that are used again for example in export data sources or other virtual cubes based on the RSDRI_INFOPROV_READ. See the Workarounds for avoiding this error message.
- Handling of compounded characteristics. SEE EXAMPLE
- If RSDRI_INFOPROV_READ is used for virtual key figures review 2137702 'Query-Handler: Invalid cursor'(SQL error: INVALID_CURSOR). General information to the topic of Virtual Key Figures and Characteristics can be found here.
- Parameter I_CURRENCY_CONVERSION: see also note 2085929 - Virtual Providers & Currency Key Figures
- If you want to run RSRDI_INFOPROV_READ directly in SE37 for testing purposes you get the error: 'Error generating the test frame Message no. FL819'. This is not a bug, the interface definition is not supported in the test environment. You need to create an ABAP program when you want to test this function.
- The function RDSRI_INFOPROV_READ can also retrieve data from a so called QueryProvider('Query as Infoprovider', QPROV), see RSDRI_INFOPROV_READ & QueryProvider.
- Reading from HANA CompositeProviders (HCPR) with the function module RDSRI_INFOPROV_READ and without DB aggregation (when parameter i_use_db_aggregation is false) is only possible if part-provider access (via SQL) is possible. If this is not the case and DB aggregation is false, the error message '_HCPR_PROCESS-1A-' is thrown. A good way to determine if part-provider access is possible is to use the "Display SQL Query" option in LISTCUBE without DB aggregation. If separate SQL statements are shown, turning off DB aggregation is possible. If a TREX statement is shown and the column view of the HCPR is read it is not. Part-provider access is only possible if the HCPR does not use a join operator, there are no HANA models in the HCPR definition and all of the navigation attributes are present in all of the part-providers.
- In case the Infoprovider is a HCPR or ADSO, you need to check whether fields are used instead of Infoobjects. If yes, you can look up the names of the fields for CHAALIAS in the V2 structure by using transaction SE11(Data Type -> Structure). Normally, it is made up from the technical names of the ADSO and the field. Unfortunately, the corresponding transient Infoobjects have a slightly different technical name which e.g. you can find out by checking the name of the fields in transaction LISTCUBE( when using the Technical Names). See discussion below.
- In case a HCPR uses an Ambiguous Join, it is not guaranteed that the data is correct. This is similar to the situation we have when working with LISTCUBE and when retrieving data with a DTP from an HCPR. See note 2556591 for further details. As explained there, in such a case a QueryProvider is needed.
SAP Consulting Notes
- 1823174 BW 7.4 changes and customer-specific programs
- 1828877 Interesting facts about RSDRI_INFOPROV_READ
- 1670016 SP07: Reading a MultiProvider via RSDRI
- 2239766 Invalid cursor in paketed call to RSDRI_INFOPROV_READ_RFC
- 1325900 Turning RSDRI_INFOPROV_READ into RSDRI_INFOPROV_READ_RFC
- 302937 Debugging APO/SEM/CRM read/write interface in BW 3.x, 7.x
- 995951 Analysis/Required infos for wrong values in RSDRI
- 979660 DataStore Objects with attribute-only fields
- 898024 MULTIPROVIDER queries don't provide noncumulative key figures