14.01.2020 Views

ABAP_to_the_Future

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

6

The Enhancement Framework and New BAdIs

GET BADI lo_monster_badi

FILTERS

country = yif_vc_monster_handler=>great_britain

monster_type = ld_monster_type_name.

Listing 6.3 Forcing a Constant to Be Passed in to a BAdI Call

Note

Although limiting the possible input values to a filter to hard-coded constants stops the

calling program from passing in incorrect valu es, this approach is not really that useful

most of the time, because you tend to want the freedom to pass a variable in. In fact,

most of this chapter is about avoiding hard-coding of any sort.

The next option for setting a check on filter values is one that may appeal to you:

defining a check via your own program. Ninety-nine times out of 100, a check on

a data element ought to be good enough, but there are always going to be cases in

which your specific needs aren’t handled by the standard system; in effect, what

you have here is a user exit for the process of defining user exits!

As you can see in Figure 6.17, this pr ocess involves choosing a class name and

some information about the filter value data field.

Figure 6.17 Checking a Filter Value via Your Own Program

If you then double-click on the class name you’ve chosen, you’re taken into SE24

to create the class. The important thing is that the system automatically creates a

class that implements the IF_FILTER_CHECK_AND_F4 interface. Then, you just need

to create an implementation of the four methods in that interface, which are as

follows:

왘 SHOW_F4_ICON

Set the returning parameter SHOW_F4_ICON to be ABAP_TRUE, and then you will

be alerting any programmer who wants to choose a filter value while implementing

a BAdI that an (F4) help is available for choosing the filter value.

242

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!