You are on page 1of 6

1

ABAP PROGRAMMING FOR BEGINNERS & FUNCTIONAL CONSULTANTS

Day 4
ABAP ALV Report
Classical Report Events

Blocks, Parameters, Select Options, Radio Buttons, Check Boxes, Output File Path in Selection Screen

INITIALIZATION

Control Commands (AT NEW, FIRST, LAST ..)

ALV -> ABAP LIST VIEWER=> Sort, Filter, Summation, Download,Change order,Hide Columns

Show ALV Report Output (for Radio Button - ALV) & File Output (for Radio Button - File Output)

Introduction to Eclipse, ADT

Classical Report Events

Classical Report is used to just display Table Data and it consist only of a single list. These are the
Simplest Reports and it is just an output of data using the WRITE statement inside the LOOP.

Blocks, Parameters, Select Options, Radio Buttons, Check Boxes, Output File Path in Selection Screen

SELECT-OPTIONS … OBLIGATORY (Mandatory Field)/ NO-EXTENSION (Suppresses multiple selections)/


NO INTERVALS (Suppresses the Upper Interval Limit).

The declarative statements PARAMETERS and SELECT-OPTIONS are used to generate a standard
selection screen (1000) with input fields. We can cross-check the same by using system-field sy-dynnr.

If you want to pre-assign some values to Selection Screen; make use of INITIALIZATION event and its
triggered only once.

Control Commands (AT NEW, FIRST, LAST ..)

Explain the concepts of Control Commands w.r.t Demo Program Z_ABAP_TRAINING_ALV


Control Break Processing in ABAP Internal Tables.Control break processing is
used to execute a piece of code whenever a specific condition in the data
is detected during the processing of internal table loop.

The following control break statements are available with in LOOP and ENDLOOP.
 AT FIRST / ENDAT
 AT LAST / ENDAT
 AT NEW / ENDAT
 AT END OF / ENDAT
 SUM
 ON CHANGE OF / ENDON

Page | 1 ©https://sapyard.com/ TRAINER'S NOTES


2
ABAP PROGRAMMING FOR BEGINNERS & FUNCTIONAL CONSULTANTS

• The code between AT FIRST and ENDAT is executed only during the first loop pass.
So, it is used to write the headers or some other initialization processing.

• The code between AT LAST and ENDAT is executed only during the last loop pass.
So it is used to write the totals or some report footers.

• Between AT FIRST and ENDAT the work area will not contain any data.
The default key fields are filled with asterisks(*) and the numeric fields are filled with zeros.
The ENDAT restores the contents to the values they had prior to entering the AT FIRST.

Changes to the work area within AT FIRST and ENDAT are lost. The same applies for AT LAST and ENDAT.
AT NEW and ENDAT is used to detect a change in the value of the field between the loop passes.
The field that is specified in AT NEW is called control level.
The code between AT NEW and ENDAT will be executed during the first loop pass and every time the
value of the control level changes or when
any other field left to the control level changes. Between AT NEW and ENDAT all the fields in the
work area that are right to the control level are filled with zeros and asterisks.

Similarly, the code between AT END OF and ENDAT will be executed during the last loop pass
and every time the value of the control level changes or any other field left to the control level changes.

Show ALV Report Output (for Radio Button - ALV) & File Output (for Radio Button - File Output)

ALV stands for ABAP List Viewer. ALV gives us a standard List format and user interface to all our ABAP
reports. ALV is created by a set of standard function modules provided by SAP.

ALV provides a lot of inbuilt functions to our reports and some of the functions are listed below.
• Sorting of records
• Filtering of records
• Totals and Sub-totals
• Download the report output to Excel/HTML
• Changing the order of the columns in the report
• Hide the unwanted columns from the report

Function Module Description


REUSE_ALV_LIST_DISPLAY Display an ALV list
REUSE_ALV_GRID_DISPLAY (Mostly used) Display an ALV grid
REUSE_ALV_COMMENTARY_WRITE Output List header information
REUSE_ALV_VARIANT_F4 Display variant selection dialog box
REUSE_ALV_VARIANT_EXISTENCE Checks whether a variant exists

Page | 2 ©https://sapyard.com/ TRAINER'S NOTES


3
ABAP PROGRAMMING FOR BEGINNERS & FUNCTIONAL CONSULTANTS

REUSE_ALV_FIELDCATALOG_MERGE Create field catalog from dictionary structure or internal


table
REUSE_ALV_EVENTS_GET Use events in ALV

DATA: it_spfli TYPE TABLE OF spfli.

SELECT * FROM spfli INTO TABLE it_spfli.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'


EXPORTING
i_structure_name = 'SPFLI'
TABLES
t_outtab = it_spfli.

 Change the above to REUSE_ALV_LIST_DISPLAY and observe the change


 Also explore the options available on the Toolbar just above the data layout.

Introduction to Eclipse, ADT


Eclipse is SAP’s strategic open source platform for highly integrated design-time and development tools.

The open Eclipse platform offers first-class user experience, powerful platform capabilities and a broad
and vivid eco-system.

We already have a lot of development and administrative tools in Eclipse and latest addition to the family
is ABAP Development Tools for SAP NetWeaver (also known as ABAP in ECLIPSE, or ADT). ADT has been
designed to significantly increase developer’s productivity by making use of the speed and flexibility of
SAP platform.

Page | 3 ©https://sapyard.com/ TRAINER'S NOTES


4
ABAP PROGRAMMING FOR BEGINNERS & FUNCTIONAL CONSULTANTS

Benefits of Eclipse: -
❖ Code Completion
❖ Auto-Insertion
❖ Code Templates
❖ Also includes a highly Invaluable Quick Fix Feature and its highly navigable
❖ Allows you to connect to multiple ABAP systems and provides session failover thus reducing the
impact of lost connections.
❖ It accesses the objects in the SAP repository in the same way as the existing ABAP Workbench
tools.

It follows the same online Development Model as ABAP objects and you cant use the offline model.

Installation of Eclipse & Connecting to backend SAP System

Once we have installed Eclipse, first we need to go to ABAP perspective and then we need to add ABAP
systems as ABAP project here. ABAP project always resembles one system connection.

We can also adjust the properties of specific ADT project in Eclipse as shown below or otherwise Right
Click on ABAP project and click on Properties or select project and press Alt + Enter.

Window-> Preferences -> ABAP Development -> Editors -> Source Code Editors -> Click on See ABAP
Formatters -> Select the Project and then apply the settings.

Shortcut for doing applying Pretty Printer is Shift + F1.

Page | 4 ©https://sapyard.com/ TRAINER'S NOTES


5
ABAP PROGRAMMING FOR BEGINNERS & FUNCTIONAL CONSULTANTS

Add a Favorite Package so that you can work on particular packages on a regular basis and also how to
remove it.

How to identify that as Editor has unsaved changes by checking on asterisk (*).

Quick Access with Ctrl + Shift + A for opening any ABAP development object.

For opening all shortcuts: - Ctrl + Shift + L

Quizzes & Assignments


What are the events in a classical report?

In a Classical Report will you be able to export the report to Excel?


• Yes
• No

What are the two declarative statements which declare Selection Screen objects?
• PARAMETER
• SELECT-OPTIONS
• SELECTION-SCREEN

Which keyword to be added to Selection-Options to suppress multiple selections?

Which event is triggered exactly once and is used to dynamically pre-assign the values to the Selection
Screen?
• INITIALIZATION
• AT SLECTION SCREN-OUTPUT
• AT SELECTION SCREEN
• START-OF-SELECTION

Implement a Selection-Screen by making use of BLOCKS, PARAMETERS, SELECT-OPTIONS, RADIO


BUTTONS, CHECKBOXES, BEGIN OF LINE AND ALSO ADD OBLIGATORY, NO-EXTENSION AND NO
INTERVALS.

What is the Standard Selection Screen number and what is the system-field to check the same?

What does ALV stand for??

What are the commonly used FM’s related to ALV reports that we use on a day-to-day basis? Choose 3
correct ones.
• REUSE_ALV_LIST_DISPLAY
• REUSE_ALV_GRID_DISPLAY
• REUSE_ALV_VARIANT_F4

Page | 5 ©https://sapyard.com/ TRAINER'S NOTES


6
ABAP PROGRAMMING FOR BEGINNERS & FUNCTIONAL CONSULTANTS

• REUSE_ALV_FIELDCATALOG_MERGE

Which function displays the data for the selected row of an ALV grid in a model Dialog Box?
• Search
• Details
• Set Filter

Exercises: -

➢ What is the difference between Classical Report and ALV report?


➢ Explore ALV via OO ALV classes and write a demo program on the same. (Hint: - Make use of
cl_salv_table class) and also explore how to play around with the field Catalog and column texts
and position and all if in case we make use of OO ALV class.
➢ With the conventional ALV by making use of std FM, build a custom Field Catalog by exploring
the options as discussed in class today like selection_text, column_pos, ddictext, output_length
and so on and then pass the same for output and see the behavior. Achieve the same through a
report.

➢ When we use the Print Preview Function in an ALV report i.e. through Ctrl+Shift+F10 the output
appears similar to that of which inbuilt FM of ALV report if we use the common FM as
REUSE_ALV_GRID_DISPLAY for displaying the output?

Page | 6 ©https://sapyard.com/ TRAINER'S NOTES

You might also like