Examples 05 -  Select Data

<< Click to Display Table of Contents >>

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

Examples 05 -  Select Data

Objective

Creating Report

Result

Source Code

Transaction Code

SE38 - ABAP Editor

Tables

MARA - General Material Data

Support

 

 

Creating Report

1.Create New Program,

Program Name        : YEXAMPLES_05

Title                : Select Data

2.Declare Global Variable

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

*GLOBAL VARIABLE DECRALATION

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

TYPES: BEGIN OF ty_header,

        matkl LIKE mara-matkl,  " Material Group

        matnr LIKE mara-matnr,  " Material Number

      END OF ty_header.

 

* Internal Table Declaration

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

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

 

3.Create Input Screen/Selection

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

*Input Screen/Selection

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

 

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

 

4.Create Main Program

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

*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.Activated and run

6.Finished

 

 

Result

Input Selection

adeb0005

Output

adeb0006

 

Source Code