Data type declaration

*&---------------------------------------------------------------------*
*& Report  ZDATA_TYPE_EXAMPLE
*& Show how variables can be declared.
*&---------------------------------------------------------------------*
REPORT  zdata_type_example.
 
DATA gv_label TYPE string VALUE 'Current date and time is:'. "Assign value direct to the gv_label variable.
DATA gv_date TYPE d VALUE '20110931'. "Assign value directly using VALUE 'YYYYMMDD'.
DATA gv_time TYPE t. "Assign value later.
gv_time = '065959'. "Assing the time(HHMMSS) now.
 
"The output of date and time may be different depending on your settings.
WRITE: gv_label.
NEW-LINE.
WRITE: /'  Date: [', gv_date, ']'. "Forward slash(/) is the same as NEW-LINE.
WRITE: /'  Time: [', gv_time, ']'.
 
"Use LIKE to defined the same data type as another variable(i.e gv_fname).
DATA gv_fname TYPE string VALUE 'Xuan'.
DATA gv_lname LIKE gv_fname VALUE 'Ngo'.
WRITE: /'My name is ', gv_fname, gv_lname, '.'.