Scenario :
In our project we are using statistical method to calculate number of products left at a customer location considering their past sales( cumulative) and natural retirement with time. To calculate the retirement we are using statistical density function to predict retirement over time. To get the current product base we are subtracting predicted retirement from total sales over time.
Now, as this prediction might not give 100% correct values ( in fact it will never give ) , business wants to update the "Current Product Base" in case that information is available via field intelligence i.e. from the sales representative.
For example row 1 , our model is predicting "Current Product Base" for customer C1 as of April-2015 for Product P1 is 50 . However, my sales representative knows it is exactly 60 . So, he/she updated this value to 60 manually. We used Integrated Planning functionality in BW to achieve that. Now, we want to capture who changed the values and when the changes were made.
Step By Step Procedure :
1. Create Direct Update DSO to log the changes:
We logged the changes in a Direct Update DSO. So first we need to create some characteristics relevant for logging and then create a Direct Update DSO.
We have used 0DATE0 , 0TIME , ZUSERNM( to hold user information ) and ZSAVEID to log the changes. Created a DSO with 0DATE, 0TIME, ZUSERNM , ZSAVEID these as the key fields together with other characteristics relevant for business.
InfoObjects Settings :
Now , we will create a DSO and change the Type of Data Store Object to " Direct Update" from the settings. We shall use all our business key and above mentioned 4 characteristics as the key of DSO.
In the Data fields of DSO , you can include all the Key Figures which are supposed to be manually updated. For case our scenario it is actual value of product base.
2. Create Enhancement Spot Implementation to log the changes in DSO :
Now , we shall implement an Enhancement Spot which will do the job of logging manual update. Every time user updates the value in real time cube, system will generate an Save Id and push that to our DSO along with user name, date and time.
Go to Transaction SE18 , choose Enhancement Spot RSPLS_LOGGING_ON_SAVE . Choose Tab Enhancement Implementation and click on Implement Enhancement Spot ( highlighted ).
Put the name of your implementing class and description and then choose OK . Select suitable Package and then fill the below screen with BAdi name and class name and choose BAdi definition
Now we have to work on two things 1 ) Implementation Class and 2 ) Filter
Let us work with implementation class first . A class will have methods which will do the actual work for us. We have to put our code in those methods.
Double click on the implementation class of the BAdi definition .
It shall bring the below screen and you would be able to see the methods for the implementation class. We have to put our code inside these methods. Please check the attachment for the code with comments. You need very minimum adjustment to the code to adapt it for your scenario.
a) IF_RSPLS_LOGGING_ON_SAVE~LOG_DEFINED :
Here we need to define for which Real Time Cube logging is activated . Assign the cube name to i_infocube_name parameter. Additionally I put my name , so that changes by my user id only would be logged as of now. Later on we shall comment out second statement.
b) IF_RSPLS_LOGGING_ON_SAVE~LOG_STRUCTURE :
This method will give us the structure of the data which will be logged. In our case it will provide me the structure of the DSO where I am storing the log. Please check the appendix for code adjustment with all relevant comments for understanding .
c) IF_RSPLS_LOGGING_ON_SAVE~LOG_WRITE :
This method actually writes the data to Direct Update DSO in a structure defined in method 2.
Here we need to mention for which Real Time Cube we want to log the changes and where ( in our case it is Direct Update DSO) . It could also be a DB table.
d) IF_RSPLS_LOGGING_ON_SAVE~LOG_DEFINED_DB :
This method you can use to write it the log to Database Table if you are using HANA as DB
e) IF_RSPLS_LOGGING_ON_SAVE~LOG_WRITE_DB:
This method you can use to write it the log to Database Table if you are using HANA as DB
For our case , we are tracking the changes in DSO, so , we did not use method 4 or 5 . Still , we activated these two ( d and e) method ,otherwise BAdi activation was throwing error.
**** Please check attached document for complete code
Once we put all our code in respective method , we need to fill Filter for this BAdi implementation. Double click on the filter area and put your Real Time Cube name.
3. Login to Planning workbook and Update Values :
Now, we need to login to our planning workbook and manually adjust the number of Product Base and then save it in real time cube.
Note , we have changed Actual Product Base for first 4 rows and save them in the planning cubes .
We will check our Direct Update DSO to see if our BAdi has logged all those changes and the user id who changed it.
As we can see , it logged my user id and date, time and save id for the change I did. If you want to update to some other target only the last changed time and change by user , you can read only the latest record by sorting with time .
Please find complete codes in link ( dropbox) , just need to adjust the portion highlighted.
Debug Tips : If you face any problem, please set external breakpoints inside the methods one by one and debug.
For some more detail, please check How to... Log Changes in Plan Data when using the SAP BW Planning Applications Kit
Cheers
Anindya
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
6 | |
4 | |
4 | |
4 | |
4 | |
3 | |
3 | |
3 | |
2 | |
2 |