Skip to Content

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.

                        PIC1.png

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 :

pic 2.png

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.

    pic 3.PNG

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_SAVEChoose Tab Enhancement Implementation and click on Implement Enhancement Spot  ( highlighted ).

                              PIC 4.png

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


                      pic 5.png

                        pic 6.png

    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 .

                                          pic 7.png

  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.

                              Pic 8.png

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.

      PIC 9.png

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.

                    Pic 10.PNG

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.

                       

PIC11.PNG

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.

    PIC12.PNG

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.

Dropbox – Class Methods.pdf

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

To report this post you need to login first.

5 Comments

You must be Logged on to comment or reply to a post.

  1. Navesh Amol

    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).

    (0) 
  2. sathish babu

    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

     

    (0) 

Leave a Reply