Modern ABAP

Introduction

(C) Brandeis Consulting

What Is “Modern ABAP”?

  • Everything new since NetWeaver 7.40
  • Many language extensions originally developed for a new, non–backward-compatible platform — the Next Generation ABAP Platform (NGAP)

(C) Brandeis Consulting

Concepts in the New ABAP Syntax

The key paradigm of the new ABAP syntax is:
“Expressions instead of helper variables!”

Statement with Helper Variable

DATA Result TYPE string.

CONCATENATE sy-msgv1
            sy-msgv2
            sy-msgv3
            sy-msgv4 INTO Result.

WRITE Result.

Expression-Oriented

WRITE sy-msgv1 && sy-msgv2 && sy-msgv3 && sy-msgv4.

Purpose of Expressions

Better readability through less code and fewer dependencies

(C) Brandeis Consulting

Expressions

Expressions are everything that appears on the right-hand side of an assignment:

Variable = <expression>.

So, everything that returns a value.

Instead of assigning an expression to a variable, you can also use it directly — in many places throughout your code.

(C) Brandeis Consulting

Examples of Expressions

Expressions you should already know:

  • Literals — '42'
  • Variables — lv_index
  • Methods with RETURNING parameters
  • Operator expressions, e.g. sy-index + 1
  • Offset accesses, e.g. sy-datum+4(2)

Expressions we will cover later in the training:

  • Constructor expressions
  • Function calls
  • String templates
  • Table functions
(C) Brandeis Consulting