Examples 03 - Complex Types (Structures)

<< Click to Display Table of Contents >>

Navigation:  All About ABAP Technique > English > ABAP Tutorial > Examples >

Examples 03 - Complex Types (Structures)

Objective

Creating Report

Result

Source Code

Transaction Code

SE38 - ABAP Editor

Tables

 

Support

 

 

Creating Report

1.Create New Program,

Program Name        : YEXAMPLES_03

Title                : Complex Types (Structures)

2.Declare Global Variable

*----------------------------------------------------------------------*

*GLOBAL VARIABLE DECRALATION

*----------------------------------------------------------------------*

*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)

 

3.Create Input Screen/Selection

*----------------------------------------------------------------------*

*Input Screen/Selection

*----------------------------------------------------------------------*

parameter p_a like l_wa1-a default 12.

parameter p_b like l_wa1-b default 14.  

 

4.Create Main Program

*======================================================================*

*MAIN PROGRAM

*Execute after Input Screen

*======================================================================*

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.

 

5.Activated and run

6.Finished

 

 

Result

Input Selection

abap_tutorial0003

Output

abap_tutorial0004

 

Source Code