Reading InfoCube Data in Update/Transfer Rules
hoW IT IS POSSIBLE TO READ INFOCUBE DATA IN UPDATE / TRANSFER RULE .
below is the detailed expaianation of ur query . hope it will help u out
Many times during the course of our development we need to refer/access data in other data targets in the Update/Transfer rules. It is primarily in the Update rules where we might need to refer to the Data Targetu2019s data to frame our Business logic. It is quite simple to refer to the ODS data as the active data of the ODS resides in a Transparent data table. The real problem arises when we need to refer to the InfoCube data, as the Cube data does not reside in 1 table/view. Though we can write ABAP code and fetch the data but imagine the no. of joins if we need to fetch data from more than 5 dimensions + Fact table.
This Weblog would talk about 3 procedures using which you can access the Infocube data in Update rules:
This function module can be used to fetch the Cube data as an Internal table which can then be used in the Update rules. The function module involves lots of input parameters and it is not easy to use at the first time. Though SAP provides a program RSDRI_INFOPROV_READ_DEMO to explain the parameters I have not found the program much useful.
I shall discuss the common input and the output parameters of the function module.
1. I_INFOPROV - This will hold the Name of the Info Cube from where we need the pull the data.
2. I_T_SFC - This parameter is in the format of Internal Table which holds the Character Info Objects we need to pull from the Source Cube.
3. I_T_SFK - This parameter is also in the format of Internal Table which holds the Key Figure Info Objects which we need to pull from the Source Cube.
4. I_T_RANGE - This is also in the format of Internal Table which holds the Selection criteria for which we need to pull from the Source Cube u2013 For example the Company Code u2013 001 and Fiscal Year Period u2013 001/2006.
5. I_T_REQUID u2013 Selection of cube data based on Request Id.
6. I_SAVE_IN_TABLE u2013 In case you need to save the data in DB table
7. I_REFERENCE_DATE u2013 This holds the current date.
8. I_AUTHORITY_CHECK u2013 This will hold the value u2018Ru2019, which is meant for READ.
9. I_DEBUG u2013 This is for Debugging mode and holds the default value u2018Yu2019.
1. E_T_DATA u2013 This Output Parameter is of internal table format, in which we can mention the output fields (For all the fields mentioned in the Input Parameter, this output parameter will hold the values).
2. E_END_OF_DATA u2013 Once the FM is executed successfully, this output parameter will hold the value u2018Xu2019, means extraction completed successfully.
This is the simplest of the method as you donu2019t need to use any function module or code. You can use an Info-hub on an Info-Cube and the Cube data can be stored in a DB table. Now you can use the DB table in the Update rules to refer to the Cube Data. Using the Info-hub has many advantages like No Coding required, Selections can be defined in the Info-hub (i.e. the fields and the values that you want) but the major disadvantage being that each time the cube is updated the Info-hub needs to extract data from the Cube.
USING QUERY DATA IN ROUTINES:
There are cases where we would like to refer to the Calculated key figures or Restricted key figures in the Update rules or Transfer rules. In such cases both the above options (Info-hub or RSDRI_INFOPROV_READ) would not help as they refer to the base data in the cube and not the query data. For such cases you can use the ABAP program u201CWRITEQUERYu201D in your routine. The WRITEQUERY takes the Query Id as the selection criteria and gives the output in the form of Query report. We take the output of the program into an internal table and then use the internal data for manipulations/transformations in the routines. Though this method is little complex experienced ABAPper should be able to accomplish this.