Beruflich Dokumente
Kultur Dokumente
Demonstration
Exercises HelpMe
5
India SAP CoE, Slide 2
Introduction
ALV Grid Control
Purpose Use Challenges
Introduction
Purpose
The common features of report are column alignment, sorting, filtering, subtotals, totals etc. To implement these, a lot of coding and logic is to be put. To avoid that we can use a concept called ABAP List Viewer (ALV).
Introduction
Use provides typical list functions as sorting, filtering, summing, while also gives the opportunity to develop user functions where needed. It presents numerous interfaces like Excel Inplace and Crystal Reports. Using ALV, we can have three types of reports: 1. Simple Report 2. Block Report 3. Hierarchical Sequential Report
Introduction
Challenges To use ALV Grid Functions in a simple manner, sufficient just having experience on Modular programming.
Demonstration
Exercises HelpMe
5
India SAP CoE, Slide 7
Hierarchical Reports
Function module to display ALV List in Hierarchical format: REUSE_ALV_HIERSEQ_LIST_DISPLAY Exporting Parameters: I_CALLBACK_PROGRAM I_CALLBACK_PF_STATUS_SET I_CALLBACK_USER_COMMAND IS_LAYOUT
Hierarchical Reports
Exporting Parameterscontinued
IT_FIELDCAT IT_EVENTS I_TABNAME_HEADER : Internal table name with output data of the highest hierarchy level I_TABNAME_ITEM : Internal table name with output data of the lowest hierarchy level IS_KEYINFO : Structure contains the header and item table field names which link the two tables (shared key)
Hierarchical Reports
Tables T_OUTTAB_HEADER: Header table with data to be output T_OUTTAB_ITEM: Name of the internal table in the program containing the output data of the lowest hierarchy level.
Output
Parameters: All the parameters are optional. This function module display the list with data appended by the above function.
Example
Steps
Step 1 Declare global variables to be used for ALV Grid / List. Step 2 Declare your internal table which is supposed to hold the list data. Step 3 Populate the data to be displayed in the internal table . Step 4 Prepare the field catalog using functional Module REUSE_ALV_FIELDCATALOG_MERGE Step 5 Populate the Event Table , layout Table etc . Step 6 Call the appropriate Function Module REUSE_ALV_LIST_DIAPLAY / REUSE_ALV_GRID_DIAPLAY
Demonstration
Exercises HelpMe
5
India SAP CoE, Slide 32
Demo
Step 1 Global data definition
Demo
Step 2 Global data definition
Demo
Step 4 - Building Field Catalog
Demo
Step 4 Building Field Catalog Manually
Demo
Step 4 Building a field catalog
Pass the internal table/ structure name to get the field catalog
Demo
Step 4 Layout Adjustments
Attributes of Layout
Refer to the attached document
Demo
Step 4 Layout Adjustments
Populating the layout structure as required and pass it to the export parameter IS_LAYOUT
Demo
Step 5 Populating events table
Populating Event table with TOP OF PAGE routine Populating Event table with END OF PAGE routine Populating Event table with user command routine
Demo
Step 5 Populating event table Contd..
The report will contain three forms for the above events: FORM TOP_OF_PAGE: This form will contain the top of page event for the report i.e. header etc Using the function module
REUSE_ALV_COMMENTARY_WRITE the internal table containing the headings for top of page event can be passed to the list output. Also, any logo specific to the report can be passed to the function module. FORM END_OF_PAGE: This form will contain the end of page event for the report i.e. footer etc
FORM USER_COMMAND: This form will contain the desired user command i.e. pick/line selection
Demo
Step 5 Populating event table TOP_OF_PAGE
Example
Demo
Step 5 Populating event table Contd.. User command
Demo
Step 5 Populating event table Contd.. User command Note that the routine ( form ) which would execute after the user command can also be passed to the export parameter I_CALLBACK_USER_COMMANND Note that the routine ( form ) which would execute after the user command can also be passed to the export parameter I_CALLBACK_USER_COMMANND
Demo
Adding new buttons Add new buttons in the application toolbar Pass a name of the routine to the export parameter I_CALLBACK_PF_STATUS_SET . In the Form routine we need to set the new PF-STATUS .This PF-STATUS would be the copy of the PF_STATUS STANDARD of program SAPLSALV . We can add pushbuttons to the newly created PF-STATUS with the proper function codes We can write the functionality for the pushbutton event in the USER_COMMAND routine by making use of the function code .
Demo
Adding new buttons
This form routine name (SET_STATUS) will be passed to parameter I_CALLBACK_PF_STATU S_SET Add the function codes of the newly added buttons to the exclusion list maintained by table type SLIS_EXTAB
Demo
Adding new buttons
Added buttons
Demo
Step 5 Populating event table Contd.
Demo
Step 6 Call the Function for ALV display
Demonstration
Exercises HelpMe
5
India SAP CoE, Slide 51
Exercises
List out all events used in ALV reports
ExercisesContd
Complete the ALV Report development using Function Modules Use the Technical specification below
Demonstration
Exercises HelpMe
5
India SAP CoE, Slide 54
HelpMe
Additional Info
Advantages of ALV Reports Collapse multiple reports into one, drastically cutting down your report development time Save many hours using built-in ALV sorting, subtotaling and filtering capabilities Add conditional structures into your ALV report: No programming required Dynamically reorder column layouts and add/subtract fields
The ALV Grid Control differs from Basis controls in the following respects
Contd
All events are registered as system events when the control is instantiated. If you want to register all events as application events, you must use parameter I_APPL_EVENTS Events DELAYED_CALLBACK or DELAYED_CHANGED_SEL_CALLBACK are registered using method