Contoh 05 -  Seleksi Data

<< Click to Display Table of Contents >>

Navigation:  All About ABAP Technique > Indonesia > ABAP Tutorial > Contoh - Contoh >

Contoh 05 -  Seleksi Data

Objektif

Creating Report

Result

Source Code

Transaction Code

SE38 - ABAP Editor

Tabel

MARA - Data Material Umum

Support

 

 

Membuat Report (Laporan)

1.Buat Program Baru,

Nama Program        : YEXAMPLES_05

Judul                : Seleksi Data

 

2.Deklarasikan Variabel Global

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

*GLOBAL VARIABLE DECRALATION

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

TYPES: BEGIN OF ty_header,

        matkl LIKE mara-matkl,  " Material Group

        matnr LIKE mara-matnr,  " Material Number

      END OF ty_header.

 

* Deklarasi Internal Table

DATA: gi_header TYPE STANDARD TABLE OF ty_header WITH HEADER LINE.

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

 

3.Buat Input Screen / Seleksi

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

*Input Screen/Selection

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

 

parameters: pa_matkl like mara-matkl default '001'.

 

4.Buat Program Utama

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

*MAIN PROGRAM

*Execute after Input Screen

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

*  Collect Master Material

  SELECT matnr matkl bismt meins

    INTO CORRESPONDING FIELDS OF TABLE gi_header

  FROM mara

  WHERE

    matkl = pa_matkl.

 

*  Display Data to Screen

  LOOP AT gi_header.

    write :  /'|' no-gap,(9)  gi_header-matkl centered,

              '|' no-gap,(18) gi_header-matnr,

              '|' no-gap.

  ENDLOOP.

 

5.Aktivasi (Aktivasi) dan Jalankan (Run)

6.Selesai

 

 

Hasil

Input Seleksi

adeb0005

Output

adeb0006

 

Kode Sintak