Skip to Content

Transparent & effective way of creating and maintaining User Exit Variables

Summary

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.

Solution

The picture below illustrates the architecture of the solution:

Architecture

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)

table bexvar

b. Create Table Maintenance Dialog

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

table maintenance

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
INTO   FUNCTION_MODULE
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
EXPORTING
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
IMPORTING
e_t_range     = e_t_range
e_meeht       = e_meeht
e_mefac       = e_mefac
e_waers       = e_waers
e_whfac       = e_whfac
CHANGING
c_s_customer  = c_s_customer.
ENDIF.

The result is a very flexible and transparent include coding.

also published on http://sap-user-blog.com


To report this post you need to login first.

Be the first to leave a comment

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

Leave a Reply