Implementing Framework for Customer Exit OLAP Variables
Customer Exit OLAP Variables require ABAP coding which often can be found in a single INCLUDE program ZXRSRU01 as part of legacy Enhancement RSR00001 (a.k.a. Customer Exit EXIT_SAPLRRS0_001). Usually the INCLUDE program becomes bigger and bigger. Moreover, various people and/or project teams are working in the same place. You can imagine that it is dangerous because one programming or transport sequence mistake can destabilize the entire system. The solution is encapsulation of the coding of individual variables and you will need a framework to realize it.
I would like to share via this document detailed technical instructions how to implement such a framework. Please refer to my blog Framework for Customer Exit OLAP Variables for an introduction of the framework and additional information.
Please have a look here to download the attachments.
Step 1: Create Enhancement Spot
SAP Menu: Tools > ABAP Workbench > Utilities > Business Add-Ins > Definition
T/code: SE18
Create Enhancement Spot YBW_OLAP_VAR as shown in the screenshots.
Figure 1: Creating an Enhancement Spot
On the overview screen of the Enhancement Spot you are able to create one or more BAdI Definitions. You have to create the following 4 BAdI Definitions:
- YBW_OLAP_VAR_BEFORE_POPUP – OLAP Customer Exit Variables – Before Popup (i_step = 1);
- YBW_OLAP_VAR_AFTER_POPUP – OLAP Customer Exit Variables – After Popup (i_step = 2);
- YBW_OLAP_VAR_VALIDATION – OLAP Customer Exit Variables – Validation (i_step = 3);
- YBW_OLAP_VAR_AUTHORIZATION – OLAP Customer Exit Variables – Authorization (i_step = 0).
Figure 2: Example of creating a BAdI Definition
Figure 3: Overview of all BAdI Definitions
The settings of all BAdI Definitions are basically the same and will be explained by showing the screenshots for BAdI Definition YBW_OLAP_VAR_BEFORE_POPUP.
Figure 4: Example of BAdI Definition – general settings
Interface IF_RSROA_VARIABLES_EXIT_BADI is reused from standard SAP BAdI RSROA_VARIABLES_EXIT_BADI as part of Enhancement Spot RSROA_VARIABLES_EXIT.
Figure 5: Example of BAdI Definition – Interface
With the Filter only BAdI Definition YBW_OLAP_VAR_VALIDATION has an exception. Processing step 3 (i.e. i_step = 3) is only called once (i.e. not variable dependent). The suggested approach is to define a filter on Query.
Figure 6: Example of BAdI Definition – Filter (1)
Figure 7: Example of BAdI Definition – Filter (2)
Figure 8: Example of BAdI Definition – Filter (3)
Step 2: Implement Standard SAP Enhancement Spot
SAP Menu: Tools > ABAP Workbench > Utilities > Business Add-Ins > Implementation
T/code: SE19
Implement standard SAP Enhancement Spot RSROA_VARIABLES_EXIT as shown in the screenshots.
Figure 9: Creating an Enhancement Implementation (1)
Figure 10: Creating an Enhancement Implementation (2)
Figure 11: Creating an Enhancement Implementation (3)
Figure 12: Enhancement Implementation – general settings
Figure 13: Enhancement Implementation – Implementing Class
Don’t forget to implement method IF_RSROA_VARIABLES_EXIT_BADI~PROCESS. Entering a comment will do for this moment.
Note that you don’t have to create a new filter. The Enhancement Spot Implementation always has to be processed.
Step 3: Maintain Class
SAP Menu: Tools > ABAP Workbench > Development > Class Builder
T/code: SE24
In Step 2 as part of the Enhancement Spot Implementation, Implementing Class YCL_RSROA_VARIABLES_EXIT was created without actual coding. You now have to maintain the class to provide the coding.
Refer to the attached file YCL_RSROA_VARIABLES_EXIT_v1.txt. From here you can quite easily copy & paste the source code.
Step 4: Implement Enhancement Spot
SAP Menu: Tools > ABAP Workbench > Utilities > Business Add-Ins > Implementation
T/code: SE19
This is a recurring action for every new Customer Exit Variable. You have to choose an appropriate BAdI which corresponds to the purpose.
Implement Enhancement Spot YBW_OLAP_VAR as shown in the screenshots.
Figure 14: Creating an Enhancement Implementation (1)
Figure 15: Creating an Enhancement Implementation (2)
Figure 16: Creating an Enhancement Implementation (3)
Figure 17: Enhancement Implementation – general settings
Figure 18: Enhancement Implementation – Implementing Class
Figure 19: Enhancement Implementation – Filter
Refer to the attached file YCL_0FISCPER_C_C_I_0000_v1.txt for an example of the coding in a random implementation.
Hi Sander,
For many of the bw consultants it is difficult to deal with abap coding, I just think that we should know as much as we require and this is something we need to know 🙂 Thank you for sharing this document...
Hi Sander van Willigen ,
This is a wonderful approach and it is a counterpart for not using includes in CMOD. 😉 BUt I am just concerned about the Performance gain with BADI usage. Can you clarify a bit more on this?
Thanks & Regards,
Suman
Hi Suman,
First of all, thanks a lot for your positive feedback. Let me try to reply to your question.
The main motivation for this approach is not performance although all BAdIs are kernel-based (i.e. the latest and fastest enhancement technology available). The rationale is achieving a safer system that is much better/easier to manage and support. I decided to update the introduction part of my blog to better highlight the advantages.
Best regards,
Sander
Hi Sander,
we have this "Raise no_processing" statement earlier that we used to write in CMOD for customer exits.
Now with this enhancement spot, what would be the appropriate statement to write as the older one is giving errors saying as :
"Method IF_RSROA_VARIABLES_EXIT_BADI~P Old exceptions and class-based exceptions cannot be used at the same time".
Any suggestions?
Hi,
Interface IF_RSROA_VARIABLES_EXIT_BADI is reused from standard SAP BAdI RSROA_VARIABLES_EXIT_BADI as part of Enhancement Spot RSROA_VARIABLES_EXIT. In method PROCESS class-based exception CX_RS_ERROR is defined. This exception is catched in the generic coding.
So you have to replace statement RAISE NO_PROCESSING by:
RAISE EXCEPTION TYPE CX_RS_ERROR.
Best regards,
Sander
Hi,
Can any one please provide some sample code for c_check_again parameter.
It's very help full to me.
Hi,
C_CHECK_AGAIN is useful if your scenario is as follows. A Variable has to be appear on the Variable Pop-up so that a user can input values. At the same time, the Variable must be post-processed by the customer-exit. In this case you can define a"customer-exit" Variable which is "ready for input". Write a small piece of coding for i_step = 1 so that the same Variable is processed again in i_step = 2.
Sample code:
CASE vnam.
WHEN <variable_x>.
IF i_step = 1.
c_check_again = 'X'.
ELSEIF i_step = 2.
... "your coding to post-process...
ENDIF.
The user can input on the variable pop-up but setting the parameter C_CHECK_AGAIN to 'X' will trigger the same Variable in i_step = 2. Now your "post-processing" coding will be called.
Best regards,
Sander
Hi! Thank you for this framework. That said, I cannot find the attached "YCL_RSROA_VARIABLES_EXIT_v1.txt" and 'YCL_0FISCPER_C_C_I_0000_v1.txt" Can you please provide a link to these files? or email them to cynarasap@yahoo.com?
Thank You!
Cynara
Hi! Many Thanks for this framework. By the way, as Cynara, I cannot find the following files “YCL_RSROA_VARIABLES_EXIT_v1.txt” and ‘YCL_0FISCPER_C_C_I_0000_v1.txt”
Could you please provide me a link to these files? or email them to jsaby@karamba.fr ?
Cheers!
Jonathan
Hi Jonathan,
Thanks for your positive feedback and sorry for my late reaction. The attachments were lost during migration and cannot be added anymore in the blog.
Please have a look at Q&A https://answers.sap.com/questions/106501/where-can-i-find-attachments-of-blog-implementing-1.html to download the attachments.
Best regards,
Sander
Hi Sander
Thanks for your information and step by step instructions.
I got struck at Step 3, when maintaining code in class YCL_RSROA_VARIABLES_EXIT.
ERROR: ("L_R_BEFORE_POPUP" is not a valid BAdI handle here).
Any suggestions?
Thank You!
Sunil
I think I figured it out.. Thanks for you documentation
Hi all,
does anyone know, if - with the new BAdI approach - the structure I_S_RKB1D is filled in I_STEP = 0 (authorization check)?
At least with the classical approach, I can not see any values in that structure. My goal is to maintain authorization values depending on the query technical name (= I_S_RKB1D-COMPID).
In other I_STEP (e. g. 1 or 2) the structure has values and coding based on those structure components works smoothly.
Best regards,
Philipp Hinnah