Monday, 11 September 2017

ABAP: Variables

Variable is a named memory location used to store a value. Every variable in ABAP must have a type.

How to define a variable?
DATA variable_name TYPE type_name VALUE value_of_the_variable.

                 (OR)
                
DATA variable_name TYPE type_name.
variable_name = value.

Z_HELLO_WORLD
*&---------------------------------------------------------------------*
*& Report Z_HELLO_WORLD
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT Z_HELLO_WORLD.

* Defining Variables
DATA char_var1 TYPE C.
char_var1 = 'a'.

DATA char_var2 TYPE C VALUE 'b'.

Write char_var1.
Write / char_var2.


Note

The name of the variable can be up to 30 characters long

Previous                                                 Next                                                 Home

No comments:

Post a Comment