How to do Remodeling of Infocube using customer exit option
Remodeling is a new feature added in NW04s BI 7.0 version of SAP BW. It enables to change the structure of an Infocube that is already loaded with data.
Using remodeling a characteristic can be simply deleted or added/ replaced with a constant value, value of another InfoObject (in the same dimension), with value of an attribute of another InfoObject (in the same dimension) or with a value derived using Customer exit.
Similarly, a key figure can be deleted, replaced with a constant value or a new key figure can be added and populated using a constant value or a Customer exit.
Assume, you have an InfoCube for Sales which is already loaded with data. Assume, there is an InfoObject ZCUST_DOB which maintains Customer’s date of birth.
The Business requirement is, the InfoCube should contain Age of the customer also. For remodeling of InfoCube with an extra InfoObject for age, first create an InfoObject ZCUST_AGE and start Remodeling process for cube as follows. The new InfoObject ZCUST_AGE added to the cube will be filled by the remodeling rule which will calculate the values based on the values of ZCUST_DOB for each data record.
Select Remodeling option for your InfoCube
Enter the name of the Remodeling Rule and select ‘Create’ button.
Enter Description and click on Transfer button
Click on the add icon to create new remodeling rule.
Select the radio button “Add Characteristic”
Enter/Select the new characteristic (in the box Add Characteristic), dimension of the characteristic needs to be added (in the Dimension box), select the option Customer exit, enter/select the Customer exit and click on Create button.
Click on save button.
Before scheduling this, prepare the Customer Exit class in SE24.
After the following class preparation, Schedule the Remodeling rule by clicking on the Schedule button.
Open another session of SAP window and go to the Class Builder (Tcode SE24)
Enter standard class name CL_RSCNV_CUSTOMER_EXIT as object type and click on COPY button to copy it to your remodeling class.
Enter the name of your Remodeling Class ZCUST_AGE_REMODELING and click continue button. Save it as Local object.
Click on change button to modify the existing logic.
Observe the method and Double click on it to edit the logic of the method.
You have to do changes at the following places in the method based on the InfoObject for which you are remodeling
InfoObject of Customer Date of Birth is ZCUST_DOB. Data already existed for it. InfoObject newly added as part of remodeling process for Customer age is ZCUST_AGE. Data to be calculated in this customer exit.
ASSIGN COMPONENT 'SID_ZCUST_DOB' OF STRUCTURE <l_s_old> TO <l_fillfield>. CALL FUNCTION 'RRSI_SID_VAL_SINGLE_CONVERT' EXPORTING i_iobjnum = 'ZCUST_DOB' : : IF SY-SUBRC <> 0. l_attr = text-001.
RAISE EXCEPTION TYPE cx_rscnv_exception EXPORTING attr1 = 'ZCUST_AGE_REMODELING' attr2 = 'EXIT-1' attr3 = l_attr ENDIF. data age type i. age = (sy-datum - l_input) / 365. l_output = age.
CALL FUNCTION 'RRSI_VAL_SID_SINGLE_CONVERT' EXPORTING i_iobjnm = 'ZCUST_AGE' i_chavl = l_output : : IF SY-SUBRC <> 0. l_attr = text-002.
RAISE EXCEPTION TYPE cx_rscnv_exception EXPORTING attr1 = 'ZCUST_AGE_REMODELING' attr2 = 'EXIT-2' attr3 = l_attr : ENDIF. ENDMETHOD.
Finally save and activate this class.
Schedule your remodeling rule.
Please Note: There may be slight difference in the class name and methods based on the SAP BW version.