Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member

This document gives the step by step method for implementing BADI for user exit variables in Bex. This is an alternative approach to adding the code in EXIT_SAPLRRS0_001 through CMOD.

Writing codes for user exits in CMOD exit makes it cumbersome and difficult to debug. Besides, if multiple users want to write the code for user exits at the same time, they can’t do so. To overcome this, we can create BADI implementations in Enhancement spot and write a code to call the BADI in EXIT_SAPLRRS0_001.

Go to transaction SE18 and create an enhancement Spot as shown below

Enter description in short text and hit enter

Create BADI definition

Enter a technical name and description for Badi definition and hit enter

Select the option for multiple use and create filter as shown below

Give a technical name and description for the filter and maintain settings as shown below

Before creating the filter, dictionary object ZGLOB_VAR needs to be defined through SE11. ZVAR_NAM is a domain object we created with data type as char and length 30 which should be sufficient to hold the technical name of the variable.

Next, we need to create interface by entering technical name and clicking on change.

Select level as Instance Method and give a name to method and description

 

Under properties tab, enter type groups you need and keep the other tabs unchanged

With this, enhancement spot definition is complete. Next, we create individual implementation for each user exit variable. An e.g is shown below.

Enter technical name and description and hit enter

Next, we create Badi implementation and Implementing Class for the enhancement

The implementation is created. Then, customer exit variable name needs to be assigned to the filter and the corresponding code should be entered in the method of implementing class.

 

Click on filter val and select new combination as shown below

Click on the combination 1 and assign the technical name (ZFDAY in our case) of the customer exit variable to the filter

Then we need to click on Implementing Class, select the method on the right side and say yes

Enter your code in the space

On activation, we will have completed our first implementation. Like this, we can keep adding implementations as and when we create customer exit variables.

In the include of EXIT_SAPLRRS0_001 of our enhancement project in CMOD, we need to add a code to call the BADI as given below

DATA: badi_glob TYPE REF TO ZBW_VAR_BADI_EXIT.

GET BADI badi_glob

  FILTERS

    zglob_var = i_vnam.

CALL BADI badi_glob ->enhance

  EXPORTING

    flt_val       = i_vnam   

    i_vnam        = i_vnam

    i_vartyp      = i_vartyp

    i_iobjnm      = 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

  CHANGING

    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.

14 Comments
Labels in this area