Skip to content

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

VALUE - Initial Value for All Types

Other versions: 7.31 | 7.40 | 7.54

Syntax


... VALUE dtype|#( ) ...

Effect

If no parameters are specified, the return value is set to its type-compliant initial value. This is possible for any non-generic data types dtype. The # symbol can stand for appropriate types.


Note

VALUE with pass by value is used only to construct certain complex values (structures, internal tables). VALUE without pass by value, on the other hand, is a general method for creating type-compliant initial values in any operand positions.


Example

Creates a suitable initial structure for a non-optional input parameter of a method.

CLASS c1 DEFINITION. 
  PUBLIC SECTION. 
    TYPES: BEGIN OF t_struct, 
             col1 TYPE i, 
             col2 TYPE i, 
           END OF t_struct. 
    CLASS-METHODS m1 IMPORTING p TYPE t_struct. 
ENDCLASS. 

CLASS c1 IMPLEMENTATION. 
  METHOD m1. 
    ... 
  ENDMETHOD. 
ENDCLASS. 

START-OF-SELECTION. 

  c1=>m1( VALUE #( ) ).