ABAP Classical Report with Programming Example


Report is a presentation of data in an organized structure. Many database management systems include report writer that enables you to design and generate reports. SAP applications support report
creation.

SAP ABAP Classical Reports are the most basic ABAP reports that contain both selection screen and an output screen. Classical reports are executed based on events, and not executed on a line-by-line basic. In simple language “It’s nothing but to display the entire information in single list”.



Events in classical reports : -

1. Initialization
2. At selection-screen
3. At selection-screen on
4. Start-of-selection
5. End-of-selection
6. Top-of-page
7. End-of-page

Initialization: -
It’s an event which is triggered before displaying the selection-screen.
USE: - it’s used to provide the default values to the selection-screen.

At Selection-Screen: -
It’s an event which is triggered after provide the input to the screen & before leaving the selection-screen.
USE: - This is used to validate the given input.

At Selection-Screen On: -
It’s an event which is triggered at the selection-screen based on particular input field.
USE: - This is used to validate the particular input field.
SYNTAX: - AT SELECTION-SCREEN ON  <parameter name>. “Validate an input parameter

Start-Of-Selection: -
It’s an event which is triggered after leaving the selection-screen & before display the output.
USE: - This is used to fetch the data from data base & place into internal table.

End-Of-Selection: -
It’s an event which is triggered after completion of the logic.
USE: - This is used to display the output.

Top-Of-Page: -
It’s an event which is triggered of the top of the each page.
USE: - It’s used to display the header information.

End-of-page: -
It’s an event which is triggered of the end of each page.
USE: - It’s used to display the footer information.

Some more events in classical report: -
1. At selection-screen output
2. At selection-screen on value-request
3. At selection-screen on help-request

At Selection-Screen Output: -
It’s an event which is triggered at the selection-screen based on the user action.
USE: - This is used to modify the selection-screen.

At Selection-Screen On Value-Request: -
It’s an event which is triggered at the time of click on F4 button.
USE: - This is used to provide the list of possible values to the input variables.
SYNTAX:-  At selection-screen on value-request for <parameter name>.  “input search help for a parameters

At Selection-Screen On Help-Request: -
It’s an event which is triggered at the time of click on F1 button.
USE: - This is used to provide the help document to the input variable
At selection-screen output is the first triggering event in the selection-screen.
SYNTAX:- At Selection-Screen On Help-Request For <parameter name>. “Input (F1) help for a input parameters


Process flow of events: -











SYNTAX EXAMPLE OF CLASSICAL REPORT

*&---------------------------------------------------------------------*
*&
*& Report:-  ZSAN_CUSTOMER
*& Author:-  Sangeeta yadav
*&
*&---------------------------------------------------------------------*

REPORT  ZSAN_CUSTOMER.
tables: kna1.

data: begin of itab occurs 0,
             ort01 type kna1-ort01,
             land1 type kna1-land1,
             telfx type kna1-telfx,
             name1 type kna1-name1,
             regio type kna1-regio,
             pstlz type kna1-pstlz,
             telf1 type kna1-telf1,
             stras type kna1-stras,
             end of itab.


selection-screen begin of block block1 with frame title text-001.
select-options: s_name1 for kna1-name1.
select-options: s_stras for kna1-stras.
select-options: s_ort01 for kna1-ort01.
select-options: s_regio for kna1-regio.

selection-screen end of block block1.


START-OF-SELECTION.
  SELECT
  kna1~ort01
  kna1~land1
  kna1~telfx
  kna1~name1
  kna1~regio
  kna1~pstlz
  kna1~telf1
  kna1~stras
  INTO CORRESPONDING FIELDS OF TABLE itab
  FROM kna1 where ort01 in s_ort01.


WRITE: 'Name' COLOR 35 'Add' COLOR 53 'City' COLOR 65 'State' COLOR ,
73 'Country' COLOR ,81'Pin' COLOR ,92'phone' COLOR 100'Fax' COLOR 1.
uline.

loop at itab.
write : / itab-name1,33 sy-vline, 35 itab-stras, 50 sy-vline,  53 itab-ort01, 62  sy-vline,
 65 itab-regio, 70 sy-vline, 73 itab-land1, 77 sy-vline, 81 itab-pstlz, 87 sy-vline, 95 itab-telf1,
97 sy-vline,  100 itab-telfx.
endloop.


SELECTION SCREEN














OUTPUT SCREEN





THANKS.


No comments:

Post a Comment