You are currently viewing Classical Reports In SAP ABAP

Classical Reports In SAP ABAP

The purpose of a report is to read data from the database and write it out. It consists of only two screens i.e. Selection Screen and Output Screen.

Selection Screen: The first screen is called the selection screen. It contains input fields allowing the user to enter criteria for the report. For example, the report may produce a list of sales for a given date range, so the date range input fields would appear on the report’s selection screen.

Output Screen: The second screen is the output screen. It contains the list. The list is the output from the report, and usually does not have any input fields.

 There are 7 types of Reports in SAP ABAP:-

  1. Classical
  2. Interactive
  3. Logical Database
  4. ABAP query
  5. ALV Reports (ALV stands for ABAP List Viewer)
  6. Report Writer/Report Painter
  7. Views (There are different types of views also)

In different organizations different types of reports are used to show records or data. But In this article we will discuss about classical reports.

 Classical Reports: Classical Reports are the most simple reports. Programmers first learn this to learn SAP Technology. It is just the output of data using WRITE statement in the loop. Now we will learn how to create a Classical Report step by step.

Step-1: To make a classical report type t-code – > se38 in the textbox as shown in following screen

Step-2: Type the name of your report as shown below I am giving ZBILL_CLS_REPORT . Now click on create button.

Step 3: Now type the title of your report. Title is small description of Report. For example, here I am showing records of bills so I am giving title Bill Report. Select the attribute type Executable Program.

Step 4: Now click on save button and type package then click on save button

Step 5: Now choose the workbench request.

Step 6: Now click on tick button shown in the following screen.

Step 7: It will display the Editor screen where you can write your code.

Source Code

REPORT  ZBILL_CLS_REPORT.

REPORT  ZBILL_REPORT.

DATA : WA_BILL TYPE ZBILL. " WORK AREA OR STRUCTURE
DATA : IT_BILL TYPE ZBILL OCCURS 0.  " INTERNAL TABLE

SELECT * INTO CORRESPONDING FIELDS OF TABLE IT_BILL FROM ZBILL ORDER BY DOC_ID. " SELECT DATA FROM DATABASE TABLE AND PUT INTO INTERNAL TABLE.
       LOOP AT IT_BILL INTO WA_BILL. " LOOP START
         AT FIRST.  "---CONTROL BREAK STATEMENT, DISPLAY ONLY ONE TIME, BREAK THE LOOP FOR COLUMN HEADING.
           WRITE: /3 'Document Id',
                   20 'Bill Number',
                   35 'Description',
                   70  'Date',
                   90  'Quantity',
                   110  'Amount (RS.)'.
           ULINE. " FOR UNDERLINE
           SKIP.  "FOR BLANK LINE.
          ENDAT.
         WRITE: /3   WA_BILL-DOC_ID,
                 20 WA_BILL-BILNO,
                 35 WA_BILL-BILDESC,
                 70 WA_BILL-BILDATE,
                 80  WA_BILL-QUANTITY,
                 100 WA_BILL-AMOUNT.
         AT LAST. "---CONTROL BREAK STATEMENT, DISPLAY ONLY ONE TIME
           SKIP.
           WRITE: /40 '~~~~~~~ End Of Bills Display ~~~~~~~'.
         ENDAT.
      ENDLOOP

Out Put:

 

Dinesh Kumar Bansal

Dinesh Kumar Bansal is an Indian Software Developer, who is working on ASP.Net, MS-SQL, SAP-ABAP technologies from last one year. His Basic Principle of developing software is, “You have to clear about, what do you want to do, how can it be done”. He always says that development can be done with a cool & fresh mind.

Leave a Reply