ABAP 7.4 SAP introduced a lot of inline declarations. Nevertheless in BW world many developments are still written in very old syntax, where some of them are even not supported by the cloud version of ABAP (Steampunk). If you want to check out a modern ABAP statement that can be used in BW then this article is definitely for you. Every example contains a previous and a new version to compare. You can treat this post as a ABAP handbook/guide for BW developers. If you want to check more information how to write a clean ABAP code, check out check this website where is an official guide from SAP.

Moving data from one internal table to another

Move only required records from one table to another:

Previously: put a where into the LOOP

LOOP AT lt_source INTO ls_source WHERE column_a = 'value'.
 APPEND ls_source TO lt_result.
ENDLOOP.

Now: use a VALUE with WHERE

lt_result = VALUE #( FOR ls_source IN lt_source WHERE ( column_a = 'value' ) ( ls_source )).

Fill table with data

Previously: declare a structure and assign separately all values in new lines.

DATA: ls_source type ty_source,
      lt_result type t_ty_result.

ls_source-column_a = 'value'.
ls_source-column_b = 'value_b'.
ls_source-column_c = 'value_c'.

APPEND ls_source to lt_result.

Now: create a table and insert the values in the same time

DATA(lt_result) = VALUE t_ty_result( ( column_a = 'value' column_b = 'value_b' column_c = 'value_c' ) ).

OR insert the value to the existing table

DATA: lt_result type t_ty_result.
INSERT VALUE #( column_a = 'value' column_b = 'value_b' column_c = 'value_c' ) TO lt_result.

Read data from the table

Previously: using READ TABLE

READ TABLE lt_result WITH KEY colum_a = 'value_a' INTO DATA ls_result.

Now: use function and catch exception

TRY.
 ls_result = lt_result[ colum_a = 'value_a' ].
CATCH cx_sy_itab_line_not_found.
ENDTRY.

Pass corresponding data between internal tables

Previously:

MOVE-CORRESPONDING lt_source to lt_result.

Now:

lt_result = CORRESPONDING #( lt_source ).

It can be also nicely used in ABAP OO:

cl_test_class->method(EXPORTING iv_source = CORRESPONDING #(lt_result)).

Union of internal tables

Previously:

LOOP AT lt_table ASSIGING FIELD-SYMBOL(<ls_table>).
 APPEND <ls_table> TO lt_result.
ENDLOOP.

Now:

lt_result = corresponding #(  base ( lt_result )  lt_table ).

Get number of lines in the table

Previously:

DESCRIBE lt_result INTO lv_number_of_entries.

Now:

v_number_of_entries = lines( lt_result  ).

Concatenate strings

Previously:

CONCATENATE lv_string_x 'aaa' lv_string_y INTO DATA(lv_result).

Now:

DATA(lv_result) = |{ lv_string_x } 'aaa' { lv_string_y }|.

Upper case

Previously:

TRANSLATE lv_result TO UPPER-CASE.

Now:

lv_result = to_upper( lv_result  ).

Very similar approach also for:
More

functiondesciption
cmax, cmincharacter-like extreme value functions
condensecondense function
concat_lines_ofconcatenation function
escapeescape function
insertinsert function
matchmatch function
repeatrepeat function
replacereplace function
reversereverse function
segmentsegment function
shift_left, shift_rightshift functions
substring, substringsubstring functions
to_upper, to_lower, to_mixed, from_mixedcase functions
translatetranslate function

More

Table lines

Previously:

DESCRIBE lt_table LINES lv_table_lines.

Now:

lv_table_lines = lines( lt_lines  ).

More

Dynamic variable declarations

Previously: Declare separately variable and assign value to it.

DATA : lv_integer type i.
lv_integer = 1.

Now: Declare and assign value in one line.

DATA(lv_integer) = 1.

It can be also used in the context of the ABAP OO.Note that function modules are not supported.

Previously: You have to declare separately variable lv_integer and then use it in the method.

DATA : lv_integer type i.
cl_test_class->method( IMPORTING ev_integer = lv_integer  ).

Now: You can declare lv_integer directly after method IMPORTING, EXPORTING or RETURNING.

cl_test_class->method( IMPORTING ev_integer = DATA(lv_integer)  ).

Create a new object

Previously: Declare data reference and then create an object

DATA : lro_class type cl_test_class.
CREATE OBJECT lro_class 
   EXPORTING iv_integer = 1.

Now: Create an object without the data declaration by the NEW parameter

DATA(lro_class) = NEW cl_test_class( iv_integer = 1 ).