You are on page 1of 2

*&---------------------------------------------------------------------*

*& Report  ZRP_P1
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT ZRP_P1.

WRITE 'Hello World' COLOR 4 INTENSIFIED off.
NEW-LINE.
WRITE 'Learning ABAP' COLOR 3 INTENSIFIED off.
Skip.
WRITE 'We are Learning SAP ABAP' COLOR 5 INVERSE INTENSIFIED off. NEW-LINE.
WRITE 'We are Learning SAP ABAP' COLOR 5 INVERSE .

Data n1 TYPE c.   " variable
n1 = 'Rohan'.

Types n2 TYPE c.  " n2 is a user defined data types
n2 = 'Rohit'.

data n3 type n2.  " variable to hold the data.

TYPES : BEGIN OF str,
           cno  TYPE c,
           nam1 type c,
           nam2 type c,
        END OF str.

types : BEGIN OF str_kna1,

        END OF str_kna1.

data : BEGIN OF rec_space,
         cno  TYPE C,
         nam1 TYPE C,
         nam2 TYPE C,
        END OF rec_space.

Program 2

*&---------------------------------------------------------------------*
*& Report  ZRP_P2
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT zrp_p2.

TYPES : BEGIN OF ty_kna1,   "---> structure (data types)
          cno   TYPE C LENGTH 10,
          ctry  TYPE C LENGTH 3,
          nam1  TYPE C LENGTH 35,
        END OF ty_kna1.

DATA : wa_kna1 TYPE ty_kna1.  "---> one record space / header/ work area

Data : itab TYPE TABLE OF ty_kna1. "---> internal table

PARAMETERS contry TYPE c LENGTH 3 DEFAULT 'US'.

"---> working like a loop (with or without a condition)
SELECT  kunnr land1 name1     "---> fields of the database table
  from  kna1                  "---> source database table name
*  into  wa_kna1               "---> the destianation field in the Applica
tion server (work area / Internal table)
  into TABLE itab               "---> the destianation field in the Applicat
ion server (work area / Internal table)
*  where land1 = 'IN'.         "---> Data Retrival Condition
  where land1 = contry.         "---> Data Retrival Condition

*ENDSELECT.

*WRITE  : itab.
*WRITE  : wa_kna1-cno, wa_kna1-ctry , wa_kna1-nam1.

LOOP AT itab INTO wa_kna1.
  WRITE  : / wa_kna1-cno, wa_kna1-ctry , wa_kna1-nam1.
ENDLOOP.

You might also like