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.

Creating Enhancements 6.2

Figure 6.7 Adding New Global Variables

If you want to go to extremes, you could even replace the standard functions with

your own custom logic. An example of this is shown in Listing 6.1.

CALL FUNCTION 'Z_TOTALLY_DIFFERENT_FUNCTION'

EXPORTING real_input_parameter = real_input_parameter

new_input_paramater = new_input_paramater

IMPORTING real_output_parameter = real_output_parameter

new_output_paramater = new_output_paramater.

RETURN.

Listing 6.1 Replacing Standard Functions with Custom Logic

You could do the same with calls to FORM routines, but it has to be stressed that

this is a last resort. If you do this sort of thing, then you often get the clone problem—in

other words, fixes and enhancements to standard SAP code won’t apply

to the code you are now using.

6.2.2 Object-Oriented Programming

The example discussed thus far only addresses the world of procedural programming,

because the bulk of standard SAP programs are written that way. However,

in reality, you want all new programs to be object-oriented—so it’s important to

understand the same concepts in standard classes. In regard to adding extra

parameters to existing methods in standard SAP classes, the procedure is exactly

the same as it is for the function modules discussed in Section 6.2.1. The result

looks like Figure 6.8.

233

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

Saved successfully!

Ooh no, something went wrong!