Skip to Content
Author's profile photo Torsten Kessler

New BAdI RSROA_VARIABLES_EXIT_BADI (7.3)

This blog has only been translated into English, the original blog can be found here: http://eKessler.de

For examination and manipulation of exit variables previously only available extension RSR00001 (Customer Exit Global Variables in Reporting), transaction SMOD, available. Can use the function module EXIT_SAPLRRS0_001 here at run time (execution time of a report) using ABAP programming accessed the variable values, and these are adjusted if necessary. The function block EXIT_SAPLRRS0_001 calls the include ZXRSRU01 which is in the customer namespace.

As part of the processing must be made next to the name of the variable (I_VNAM) nor the execution time (I_STEP). This double nesting quickly leads to confusing and unstructured code. Typical approaches are here:
■ · Using two Nested CASE (I_VNAM and I_STEP) instruction
■ · Combination of CASE (I_VNAM) and IF ELSEIF (I_STEP) instructions
■ · Outsourcing of source code through the use of includes, function modules, dynamic, dynamic method calls in ABAP OO classes
■ · …

With BW 7.3, SAP delivers the BAdI RSROA_VARIABLES_EXIT_BADI (BADI to fill variables). The BAdI is the Customer upstream exit, that is, the calls the BAdI customer exit on. Figure 1.1 shows the call sequence and using the BAdI’s in combination with Customer Exits and BAdI implementations by the customer.

19-07-2013 18-40-04_en.png

Figure 1.1 BAdI RSROA_VARIABLES_EXIT_BADI call and use

The standard SAP processing process variables determined by the GET BADI command all active BAdI implementations.

In the BAdI RSROA_VARIABLES_EXIT_BADI is a filter-based BAdI. When object filter the BAdI uses the info object to which the variable is based that is currently processed.

Note: In I_STEP 3, we have no clear variable and thus no clear info object name. The BAdI is called in the I_STEPs 0, 1 and 2 for each variable. A variable is always based on a feature. In I_STEP 3 all variables in the current report are available in the form of a table parameter. If the BAdI implementation is to be used for processing in I_STEP 3 of the filter by the value IOBJNM must be expanded =”.

The BAdI class that returns all active implementations, first determines all active implementations of the BAdI and additionally ensures that the filter values ​​for the BAdI implementation consistent with the currently processed values.

Then an instance of each active implementation generates and invoked with the command CALL BADI method IF_RSROA_VARIABLES_EXIT_BADI ~ PROCESS of individual implementations.

SAP delivers BAdI definition directly with the default implementation SMOD_EXIT_CALL. This implementation is active and has a filter combination IOBJNM =” OR IOBJNM <>”. The filter combination is selected such that the BAdI I_STEP implementation for all (0, 1, 2 and 3) is considered to be active. The default BAdI implementation has the task of the customer exit (function block) EXIT_SAPLRRS0_001 RSR00001 call the extension, see Figure 1.1. Of the customer exit is only called when the component in the extension is active.

It is recommend not to mix the use of and BAdI customer exit.

The interface of the BAdI method PROCESS interface is identical to the interface of the function module EXIT_SAPLRRS0_001 the customer exit. This means that the source code of the customer exit can be fully adopted, this will reduce the migration effort.

Note: Migration is not needed! The customer exit persists. The BAdI, SAP an additional concurrent object-oriented way for the processing of exit variables. Advantage of the BAdI variant against the customer exit is better structuring and management of the implementations.

In the BAdI RSROA_VARIABLES_EXIT_BADI is a new BAdI BAdI technology, ie, the BAdI is organized in an enhancement spot.

In the following, I will briefly point out the steps that are necessary to create an implementation for a variable. For example, I have a variable (ZTKE_FISCPER) is applied based on the characteristic 0FISCPER. The variable is of type customer exit and has as a selection option selection option.

To create a BAdI BAdI implementation of the new technology, there are several ways.
1.about the BAdI definition (transaction SE18)
2.Use the BAdI implementation (transaction SE19)
3.Über the ABAP Workbench (transaction SE80)

For 3 We need as entry the name of the development package which we have not first. For 1) and 2) we only need the name of the BAdI definition. Since we have only the first name of the BAdI definition (RSROA_VARIABLES_EXIT_BADI) we recommend the route via the SE18, see Figure 1.2.

RSROA_VARIABLES_EXIT_BADI_01_en.png

Figure 1.2 Creating a new BAdI implementation step 1

To display the BAdI definition of the view automatically switches to the SE18 and SE80 there opens the enhancement spot RSROA_VARIABLES_EXIT. By clicking on (see marking in Figure 1.2.), A new BAdI implementation can be created.

A BAdI implementation can not be created directly within a BAdI definition. This, first you have to create an enhancement implementation. Figure 1.3 shows in (1) the dialog for selecting an enhancement implementation. After selecting the extension implementation can be created within this BAdI implementation, see (2).

RSROA_VARIABLES_EXIT_BADI_02_en.png

Figure 1.3 Creating a new BAdI implementation – Step 2

(3) shows the definition of the filter values ​​in the newly created BAdI implementation.

Then, the implementation of the method can be PROCESS, see (1) in Figure 1.4.

RSROA_VARIABLES_EXIT_BADI_03_en.png

Figure 1.4 Creating a new BAdI implementation – Step 3

After deployment is completed needs to be ensured that all of the objects concerned are active. The following objects must be activated:
■ ABAP OO class
■ BAdI implementation
■ Enhancement Implementation

When activating the ABAP OO classes must be taken to ensure that the entire class is active. Active only when a method declaration and the definition of the method but not the ABAP class activates itself. So I recommend when activating the class level to change (Goto è class definition).

After everything is set, the behavior of variables with a BEx query be tested.

Additional information on the topic can be SAP ABAP Programming Course for SAP NetWeaver BW. The course shows the most important locations on where to get (or woman) in the context of an SAP NetWeaver BW system in contact. This also includes the upstream SAP source system with a.

The course is held by me in the form of a work shop that is here is the participants not only my knowledge and experience available but also that of other participants.

Assigned Tags

      24 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Kenneth Murray
      Kenneth Murray

      Has anyone found any official SAP Documentation on this other than a blog?

      Why wouldn't SAP Document this?

      I find it strange that SAP wouldn't document something like this for it's extremely large developer base. I did a Google search on the sap.com domain and come up basically empty.

      Author's profile photo Harshit Pandey
      Harshit Pandey

      Hi Kenneth Murray sir

      Have you got any this in this regards , as i am also facing same problem .

      Their is no documentation in this regards .

      I want some help in using one of  RSROA Enhancement Spots BADI i.e. RSROA_OLAP_BADI  BADI's function IF_EX_RSROA_OLAP_BADI~COMPUTE_TABLE

      Have you got any help in this regards ............ 😕

      Author's profile photo Torsten Kessler
      Torsten Kessler
      Blog Post Author

      Hi,

      for the OLAP BAdI for virtual characteristics see the note 1717880 - Virtual Key Figures & Characteristics . Here are some information about virtual CHA and KYF.

      Further in the note are some links to the SAP help portal like http://help.sap.com/saphelp_nw70ehp3/helpdata/en/ac/ef1f43daac9a448f0150a02e3a7aba/content.htm?frameset=/en/44/ec2c673a2e65fbe10000000a1553f7/frameset.htm

      here you will find some information about sample implementation:

      The following ODS objects for the utilities industry, delivered in the context of SAP Business Content, contain examples of virtual characteristics and key figures:

      InfoProviders

      Virtual InfoObjects

      ODS Object Inventory Statistics Prepayment Counter

      Technical name: 0UCS_DS02

      Virtual characteristics:

      VKF key figure area consumption debt

      VKF key figure area consumption debt rate

      VKF key figure area non consumption debt

      VKF key figure area non consumption debt rate

      DataStore object Payment Scheme

      Technical name: 0UCS_DS03

      Virtual key figure

      Number of payments

      Hope this helps a little bit.

      Otherwise I explain the most important BAdI's and Exits in the SAP education course PDEBWP - BW Backend and Programming (currently only in Germany available, sorry)

      https://training.sap.com/shop/course/pdebwp-bw-backend-und-programming-classroom-001-de-de/

      BR

      Torsten

      Author's profile photo Torsten Kessler
      Torsten Kessler
      Blog Post Author

      Hi,

      I've spoken with the product management and noted the lack of documentation.
      The corresponding developer was informed.
      I hope he will submit the documentation asap.

      Otherwise I think this blog delivere the most important information to implement the necessary code to handle an exit variable.

      BR

      Torsten

      Author's profile photo Harshit Pandey
      Harshit Pandey

      Thanks Mr. Torsten Kessler for your immediate response

      I will go through the links you have provided 🙂

      Thanks & Regards

      Harshit

      Author's profile photo Raf Boudewijns
      Raf Boudewijns

       

      Hello Torsten,
      first of all thanks for your explanation!
      I just checked the official documentation on BW7.5 (see this link) and it still refers to the "old way" of working (even though the HANA code check shows this user exit as "depreciated"). Does that mean the developer didn't have time to update it yet (in the past 3 years)?
      Kind regards,
      Raf

      Author's profile photo Viren Pravinchandra Devi
      Viren Pravinchandra Devi

      Hi Torsten,

      Thanks for sharing the info.

      I could not understand what you mean by "It is recommend not to mix the use of and BAdI customer exit." sentence.

      Do you mean it is not advisable to use BAdi method for writing query variable code? We also came across snote 2120102 - Problems with customer exit variables & 2036773 - Variable values for other BAdI implementations deleted from the BAdI implementation  L_RSROA_VAR_SMOD .

      Are these notes applicable for customer BAdi codes and when we implement only BAdi implementation?

      Thanks,

      Viren

      Author's profile photo Torsten Kessler
      Torsten Kessler
      Blog Post Author

      Hi,

      no what I mean with mix BAdI and Exit coding is, do not use both.

      Do not implement the BAdI RSROA_VARIABLES_EXIT_BADI and in parallel the customer Exit EXIT_SAPLRRS0_001.

      In that case it is easy to loose the control where the variable value would be set (BAdi or Exit) and it could be happen that to different implementation for one variable are available.

      Therefore I recommend to use a clear policy BAdI or Exit.

      From a technical perspective it is possible to implement both in parallel.

      Regards

      Torsten

      Author's profile photo Lakshminarasimhan N
      Lakshminarasimhan N

      Hi, Where can i get the list of BADI's available for use within the BW  system? Is there any table for the same?

      Author's profile photo Torsten Kessler
      Torsten Kessler
      Blog Post Author

      Hi,

      there are some way's available.

      1. Visit the education course PDEBWP. This course provides an overview about enhancements option in BW and you will get a list with all BAdI's (classic and new one) and all customer Exits.

      2. Goto SPRO => SAP NetWeaver => Business Warehouse => Enhancements

      3. Goto SE18 and search for all Enhancement Spots starting with RS*

      Use option 3. with care not all RS* enhancements must be related to the BW. So by using option 3. please read the BAdI documentation.

      Regards

      Torsten

      Author's profile photo Thomas Neugebauer-Spreng
      Thomas Neugebauer-Spreng

      Hello dear professionals,

      how is the BADI concept to be implemented for TEXT variables wich are obviously not bound to an infoobject? Steeing the filter to '*' did not get me very far.

      Thanks for your help!

      Author's profile photo Torsten Kessler
      Torsten Kessler
      Blog Post Author

      Hi,

      for a text variable the filter IOBJNM is set to "1TEXT".

      But in case you use the same filter value as the SAP default implementation SMOD_EXIT_CALL ( IOBJNM = '' OR IOBJNM <> '') the BAdI implementation should be called.

      This filter combination IOBJNM equal emtpy or IOBJNM not equal empty is always true and ensure that this implementation would be always been called (presupposed the implementation is active!)

      Regards

      Torsten

      Author's profile photo Thomas Neugebauer-Spreng
      Thomas Neugebauer-Spreng

      Hello Torsten Kessler,

      thank you very much, "1TEXT" did the Job for me.

      Kind regards, Thomas

      Author's profile photo Manjunatha Matam
      Manjunatha Matam

      Hi Torsten,

      Using RSROA_VARIABLES_EXIT_BADI can we work on below scenario?

      On top of multiprovider we have one Info cube and one Info object(ZRUN_PD). In Infocube we have transaction data and in Info object(ZRUN_PD) we have few records  e.g 10 records like M, DR, Y, W etc.

      Note: In Infocube don’t have data related to Info object(ZRUN_PD).

      In Query along with “sales organization” for Info object(ZRUN_PD) also selection variable created.

      E.g.

      Input selection:

      sales organization

      1000

      ZRUN_PD  

      M

        Based on selected value of ZRUN_PD Info object dates has to calculate. Like above we selected “M” (ZRUN_PD) so we have to take dates from previous date to last 30 days data.

      Like that based on ZRUN_PD selected value dates has to calculate and pull the data.

      Author's profile photo Torsten Kessler
      Torsten Kessler
      Blog Post Author

      Hi,

      If I understand your request right you'll filter your data by sales org and by date.

      And the date value depents on the ZRUN_PD input value, right?

      You can define a non-input-ready variable for your date InfoObject.

      This variable would be processed in Step 2.

      Here you can use the value from ZRUN_PD and set the value for the non-input-ready date variable.

      For the processing steps check:

      Everything you always wanted to know about the processing of customer exit variables, but ...

      Regards

      Torsten

      Author's profile photo Manjunatha Matam
      Manjunatha Matam

      Hi Torsten,

      Thanks for the reply. You understand correctly here i have issue with report output, because it showing blank. The report is created on top of multiprovider and under this we have info cube and master info object(ZRUN_PD). In info cube we have transaction data and in master info object(ZRUN_PD) added few values like M(Monthly), Q(Quarter), Y(Year), RP(run period) etc.

      After executing customer exit code. it's taking selection value as below:

      Sales org 1020
      Date 01.10.2015 30.10.2015
      ZRUN_PD M

      ZRUN_PD field maintained separately(Not included in Info Cube) added in multi provider and it do not have transaction data in cube due to this it showing blank in report.


      My requirement is after executing customer exit code. it should take as below selection:

      Sales org 1020
      Date 01.10.2015 30.10.2015


      In my requirement ZRUN_PD master info object want to use as just user input not as selection field.

      I hope you understand my issue. It's very help full to me if i get solution.

      Thanks,

      Manjunatha.

      Author's profile photo Torsten Kessler
      Torsten Kessler
      Blog Post Author

      Hi,

      you can use the parameter E_CHECK_AGAIN for your ZRUN_PD variable to reset the selected value after your processing.

      Therefore set the flag E_CHECK_AGAIN  for your variable ZRUN_PD in I_STEP=1.

      Than you can first use the value from ZRUN_PD to set your date value and than you can clear it.

      I'd described that in my blog:

      Everything you always wanted to know about the processing of customer exit variables, but ...

      Torsten

      Author's profile photo Manjunatha Matam
      Manjunatha Matam

      Hi Torsten,

      Thanks for your valuable information. As per your document created BADI and written logic but not able to use E_CHECK_AGAIN parameter advantage.

      It is very help full to me if you provide a sample code related to E_CHECK_AGAIN parameter.

      Tnx,

      Manjuanath.

      Author's profile photo Torsten Kessler
      Torsten Kessler
      Blog Post Author

      Hi,

      just set the export or changing parameter E_CHECK_AGAIN or C_CHECK_AGAIN to 'X' in the processing of I_STEP = 1 for the variable.

      If you are using the Customer Exit it is an export variable (E_CHECK_AGAIN) and if you are using the BAdI it is a changing parameter (C_CHECK_AGAIN).

      The sample below first init the "ready for input" variable ZTKE_CDATE with the current date and set the flag c_check_again to 'X'.

      By default a ready for input variable could not be changed after the variable dialog. That means by default customer input could not be changed. But in case the CHECK_AGAIN flag is set in I_STEP = 1 the variable would be handled as a non input variable and processed in I_STEP 2.


      Now the flag is set in I_STEP 1 and we will processing the I_STEP 2 for this variable.

      Here I set a fix default value in my example.


        CASE i_step.
        
      WHEN 1.
           IF i_vnam = 'ZTKE_CDATE'.
             ls_range
      -sign = 'I'.
             ls_range
      -opt  = 'EQ'.
             ls_range
      -low  = sy-datum.
            
      append ls_range to c_t_range.

        

             c_check_again = 'X'.
           
      ENDIF.

         WHEN 2.
          
      IF i_vnam = 'ZTKE_CDATE'.
             ls_range
      -sign = 'I'.
             ls_range
      -opt  = 'EQ'.
             ls_range
      -low  = '20170101'.
            
      append ls_range to c_t_range.
          
      ENDIF.
       

         WHEN OTHERS.
      ENDCASE.

      Hope this will help a bit.

      Regards

      Torsten

      Author's profile photo Alexander Kutz
      Alexander Kutz

      Another really good working solution with an own implementation (old exits can stay untouched): http://scn.sap.com/community/business-explorer/blog/2013/04/08/bex-userexits-reloaded

      Author's profile photo Torsten Kessler
      Torsten Kessler
      Blog Post Author

      Hi,
      yes this is by sure a good approach / solution, but keep the BW/4HANA roadmap in mind.

      The hook (include) is in a BW/4HANA system not longer used by the Customer Exit. That means you must use the SAP standard BAdI instead of the Customer Exit. Than you have use a BAdI to call a BAdI.

      I recommend to use the SAP BAdI directly to stay close to the SAP BW roadmap.

      Torsten

      Author's profile photo Lakshminarasimhan N
      Lakshminarasimhan N

      Very nice one. Thanks...

      Author's profile photo Soren Hansen
      Soren Hansen

      Hi Torsten

       

      Thanks for the BLOG. A quick quesiton: In the old processing of variable the function module "RRMX_MESSAGE_HANDLING" could be used to send meaningful information to the end-user. In BW/4 this function module is not available (as mentioned above).

       

      Has this been replaced by class based message and exception handling so that I would throw the exception CX_RS_ERROR with PREVIOUS = "my exception" or is there a hidden germ that can help getting information to the end users?

      Thanks

      Søren Hansen

      Author's profile photo Torsten Kessler
      Torsten Kessler
      Blog Post Author

      Hi,

      do you mean RRMS_MESSAGE_HANDLING?

      This function module is still available.

       

      Torsten