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.

1

ABAP in Eclipse

Figure 1.15 Extracting a Method

Next, you will see a box asking for a transport request (if this is not a local object)

and whether you want to activate everything after the extraction is complete. The

final—and perhaps best—part is that before the change is made you see a before

and after comparison, showing what your code will look like after the proposed

change has been made (Figure 1.16). If you do not like the look of what the system

is about to do, then you can cancel.

After the extraction, three changes have b een made. First, a definition of a new

private method has been created (Listing 1.7).

PRIVATE SECTION.

METHODS derive_monster_sanity

IMPORTING

id_monster_madness1 TYPE i.

Listing 1.7 Definition of New Private Method

Next, the block of code you highlighted has been replaced by a method call (Listing

1.8).

ld_monster_madness1 = 25.

ld_monster_madness2 = 50.

ld_monster_madness3 = 100.

derive_monster_sanity( ld_monster_madness1 ).

Listing 1.8 Method Call Replacement

56

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

Saved successfully!

Ooh no, something went wrong!