Child pages
  • Customer Exit to Restrict a Characteristic with Values Containing Certain Pattern
Skip to end of metadata
Go to start of metadata


Explanation of how to create Customer Exit code that can be used for restricting a characteristic with some values containing a certain pattern


In BW Queries very often there is a requirement to restrict a characteristic with some values to get the correct result. Let us say we have a requirement where we need to restrict the query to only those Departments for which the Department ID starts with D1 or D2. This will be very simple task when there are a limited number of Departments IDs starting with D1 or D2, but what if there are many Departments whose ID starts with D1 or D2 for example.

This can be achieved using a Customer Exit Variable.  Following are the steps you need to perform to restrict the characteristic with values having certain pattern.

1: Create a New Variable (say ZVAR_DEPT) on the Characteristic Department with following properties.

       Type of Variable:          Characteristic Value.
       Process By:                     Customer Exit.
       Variable Represents: Multiple Single Values.
       Variable Entry is:          Mandatory, Non-Input and cannot be changed in Query Navigation    

2: Restrict the Characteristic with the variable ZVAR_DEPT.

3: Go to Transaction SE37 and enter "EXIT_SAPLRRS0_001". In the next screen double click on "ZXRSRU01", this will take you to the screen where you can define Customer exit code for Global Variables in Reporting.

4: Include the following code in the Customer Exit code.

        IF I_STEP = 1.


          CLEAR: L_S_RANGE.
          L_S_RANGE-SIGN = 'I'.
          L_S_RANGE-OPT = 'EQ'.
          LOOP AT ITAB1.
            L_S_RANGE-LOW = ITAB1-DEPT_ID.
          CLEAR L_S_RANGE.

Related Content

Related Documents

Customer Exit Page on

Using Customer Exit Variables in BW or BI Reports Part - 1 

How to use Customer Exit Variables in BW Reports: Part 2


Related Notes:


  1. Former Member

    a question on customer exit about EXIT_SAPLRRS0_001 related to i_step = 0 (Authorization check).
    I have two InfoObjects: 0WS_CAT and 0WSCATQ. The last one has a compounding that is 0WS_CAT.

    In the exit: I need to check the 0WS_OBSFLAG (a simple flag attribute) to determine if the entries in 0WSCATQ Master data are valid or no.

    If I found that the entry is valid I add the value to the e_t_range export table in this way:

    if ( i_step = 0 ).
    l_s_range-sign = 'I'.
    l_s_range-opt = 'EQ'.
    l_s_range-low = '00000001'.
    append l_s_range to e_t_range.

    The problem is the compound, how can specify the value key for the export table?
    For example ... in the table I have three entries:
    0001 00000001 #
    0002 00000001 X
    0003 00000001 #

    The valid entries are:
    0001 00000001 #
    0003 00000001 #

    How can specify '0001' or '0003'? Because if I assign only the value '00000001' to l_s_range-low then the entries valid in the authorization for 0WS_CATQ are three and not two.

    Regards, Roberto

  2. Unknown User (vybrzzr)

    EXcellent document. I appriciate your effort and input for making excellent document.