Structures

<< Click to Display Table of Contents >>

Navigation:  All About ABAP Technique > English > ABAP Tutorial > ABAP Data Types > User-Defined Data Types > Complex Types >

Structures

In ABAP, structure is usually called as Workarea or Header Line. In other language program, structure is equal as one dimension array.

 

>> Source Code

*First Style
types : begin of ty_wa,
         a type i,
         b type i,
         hasil type p decimals 2,
      end of ty_wa.
 
Data : l_wa1 type ty_wa.         " Sturcture (Workarea)
 
 
*Second Style
data: begin of l_wa2,
         a type i,
         b type i,
         hasil type p decimals 2,
    end of l_wa2.               " Sturcture (Workarea)
 
 
parameter p_a like l_wa1-a default 12.
parameter p_b like l_wa1-b default 14.
 
START-OF-SELECTION.
l_wa1-a = p_a.
l_wa1-b = p_b.
 
l_wa1-hasil = l_wa1-a / l_wa1-b.
 
write : / 'WA dari variabel A = ', l_wa1-a,
       / 'WA dari variabel B = ', l_wa1-b,
       / 'WA dari variabel Hasil = ', l_wa1-hasil.

>> Display :

Selection Screen

abap_tutorial0003

Result

abap_tutorial0004