Step by Step Guide to track manual changes via Integrated Planning ( IP)
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
Valuable Document,Thanks for sharing.
Good One. Thanks
Great work Anindya. We are going to implement this method in our IP scenario to log the changes done by user. Only addition what we will do is perhaps to enhance it such that changes because of planning sequence is also tracked and the name of the planning sequence as well (not only manual changes).
Thanks Navesh Amol I am glad you found this useful .
Hello Anindya
It has been a while that you launched this document and it is still useful, thank you!
I would like to ask you if you had any chance to use "Commenting" solution in IP (starting with 7.4). If yes, how did you enhance the method above?
We use commenting with IP, and above method works ok for comments as well, however comment changes are kept in a seperate table. This causes us a problem when we want to do reporting based on this audit data - because amount tracking and comment tracking are not sharing any common Key Figure. I wonder if it is a technical restriction or is it my bad design since the beginning 🙂
I would like to hear your experience on this and thanks for your time in advance
Regards
SB
Thank you for this guide, this is really helpful !
I just have a question.
How can I add a infobject Timestamp in the DSO which will be a concatenation for the date and the time ?
Thank you again !
Nicolas
Hi,
When the Direct Update DSO to log the changes is created as an Advanced DSO, it's giving short dumps.
However when I create it as a Classic Direct Update DSO, it doesn't short dump but it fails to write the logs. Is it because the Real-Time Info Cube value we define in the Implementation's Filter value has to be an Info Cube and not an Planning ADSO ??
Should all the info objects defined in the Planning Real-time cube also be defined in the Logging DSO or just a sub-set is enough ??
Hi Sreekar,
We have a similar case where we need audit log for updates in our planning ADSO. Did you manage to achieve this ?
Regards,
Sai
Hi Anindya,
I am not able to open dropbox to download the code file, can you please share document here or my email id : pras.cse.2014@gmail.com
Thankd and Regards,
Prashant