0% found this document useful (0 votes)
64 views2 pages

ZRP - P1 Off Off Off: 'Hello World' 'Learning ABAP' 'We Are Learning SAP ABAP' 'We Are Learning SAP ABAP'

The document contains code for two ABAP reports (ZRP_P1 and ZRP_P2) that demonstrate basic ABAP concepts. Report ZRP_P1 contains code to write text to the screen with different colors and formatting. It also defines some data types and variables. Report ZRP_P2 defines a structure for customer data, declares an internal table and work area based on this structure, and uses SELECT to retrieve customer data from the SAP database table KNA1 and display it.

Uploaded by

Farooq Ahmed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
64 views2 pages

ZRP - P1 Off Off Off: 'Hello World' 'Learning ABAP' 'We Are Learning SAP ABAP' 'We Are Learning SAP ABAP'

The document contains code for two ABAP reports (ZRP_P1 and ZRP_P2) that demonstrate basic ABAP concepts. Report ZRP_P1 contains code to write text to the screen with different colors and formatting. It also defines some data types and variables. Report ZRP_P2 defines a structure for customer data, declares an internal table and work area based on this structure, and uses SELECT to retrieve customer data from the SAP database table KNA1 and display it.

Uploaded by

Farooq Ahmed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 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