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.

2

New Language Features in ABAP 7.4

In this example, the first variable just gets the description of the next weapon in

a list of weapons via a functional method call. Then, you read a line of the internal

table of monsters—the syntax here may puzzle you, but it will be covered later in

Section 2.6—and finally you fill a string variable with the system date, formatted

in a human-friendly manner.

You can now use those variables you’ve just declared to fill up the result string.

Thanks to the LET statement, after the statement is over those variables (weapon_

name, etc.) don’t exist any longer, as opposed to being accessible from anywhere

inside the routine like regular variables.

Field Symbols

You can also declare field symbols as well as variables. The type of the variable or field

symbol is dynamically determined by looking at the value that is being passed into it.

2.3 String Processing

The English comedy trio The Goodies once sang:

“String, string, string, string, everybody loves string,

String for your pants, string for your vest!

Everybody knows—string is best!"

Some fairly major changes to string processing were introduced with release 7.02

and 7.4 of ABAP; they are discussed next.

2.3.1 New String Features in Release 7.02

You can replace the CONCATENATE statement with something like LD_THIS = LD_

THAT && LD_THE_OTHER. This definitely saves a bit of room in your code, but

it does not seem to handle the spaces you often want between variables very well.

Much better are the “pipes ” and “curly brackets,” which came in with release

7.02. Instead of the code shown in Listi ng 2.17, you can simplify to the code

shown in Listing 2.18.

CONCATENATE ‘Monster Number’ LD_NUMBER INTO LD_HELPER SEPARATED BY SPACE.

CONCATENATE LD_HELPER LD_STATUS INTO LD_RESULT

SEPARATED BY ‘ / ‘.

Listing 2.17 Building Up a String Using CONCATENATE

96

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

Saved successfully!

Ooh no, something went wrong!