Skip to content

ABAP Keyword Documentation →  ABAP − Reference →  Creating Objects and Values →  VALUE - Value Operator →  VALUE - Internal Tables 

VALUE - Operator with LET for Internal Tables

This example demonstrates the value operator VALUE for internal tables with a LET expression.

Other versions: 7.31 | 7.40 | 7.54

Source Code

    TYPES t_date_tab TYPE TABLE OF string  WITH EMPTY KEY.

    cl_demo_output=>display(
      VALUE t_date_tab(
        LET d = date=>get( ) IN
        ( |{ CONV d( d - 1 ) DATE = ENVIRONMENT }| )
        ( |{         d       DATE = ENVIRONMENT }| )
        ( |{ CONV d( d + 1 ) DATE = ENVIRONMENT }| ) ) ).

Description

Constructs an internal table with an elementary row type with type string and fills it with three rows. The result is a table that is given the previous day, today, and the next day (all formatted for the current language environment). Today's date is produced using a method. To make sure that the method is called only once, the return value is assigned to a local helper field in a LET expression.