Transparent & effective way of creating and maintaining User Exit Variables
At many SAP BW Systems the User Exit Variable Include is one of the largest programs in the system since everybody is doing the programming for their application directly in the include.
After a couple of years this will cause many problems because such a programming is really in transparent and more complicated than it has to.
The picture below illustrates the architecture of the solution:
In the Include there is only a referencing of the BEx Variable and not the real coding. The coding with the business logic is stored in separate function modules.
Step 1:Create transparent table to store Variables
First we must create a transparent table to store the relationship between the variables and the function modules.
a. Table: ZBW_BEXVAR (Maintenance allowed)
b. Create Table Maintenance Dialog
After the creation of the table maintenance dialog we did some customizing to the screen but this is up to. Our maintenance dialog looks then like this (SM30 -> ZBW_BEXVAR).
Now we have finished our table and the relationship between all user exit variables and the corresponding function modules can be maintained.
Step 2: Include ZXRSRU01
The Include is only used for the execution of the correct function module in respect to the user exit variable.
The first step of the Include is the selection of the correct function module name in respect to the variable:
* select function module for variable
SELECT SINGLE FNAM FROM ZBW_BEXVAR
WHERE VNAM EQ i_vnam AND
ACTIVE EQ ‘X’.
If the select-Statement was successful the correct function module should be executed.
IF SY-SUBRC EQ 0.
CALL FUNCTION FUNCTION_MODULE
i_vnam = i_vnam
i_vartyp = i_vartyp
i_objnm = i_iobjnm
i_s_cob_pro = i_s_cob_pro
i_s_rkb1d = i_s_rkb1d
i_periv = i_periv
i_t_var_range = i_t_var_range
i_step = i_step
e_t_range = e_t_range
e_meeht = e_meeht
e_mefac = e_mefac
e_waers = e_waers
e_whfac = e_whfac
c_s_customer = c_s_customer.
The result is a very flexible and transparent include coding.
also published on http://sap-user-blog.com