What if you could reformat a standard ABAP list as easily as a Microsoft Excel spreadsheet? Many R/3 users are not aware that the report development using ABAP List Viewer(ALV), which comes standard with R/3(since version 4.5X), lets you come very close to doing just that. Unlike a standard ABAP list, ALV provides the end-user the flexibility to individually customize the data output.Many traditional developers are under the impression that ALV is a complicated and difficult tool to understand and use until they started using. It really saves lot of time and system resources. This document is intended for the users who want to quickly convert ABAP lists to ALV format. A template was provided as a part of this paper which can be used to considerably reduce the amount of time toless than 30 minutes to convert each ABAP list to ALV format. However there are some restrictions that are outlined in this paper. Using this template, you can also run ALV reports in the background unlike the standard examples provided by SAP with the only exception that you will not have all ALV features like sorting are available from spool.
About the author
Kasi Murthy is a senior ABAPconsultant working with Tata Consultancy Services (TCS), India. Kasi has over 8 years of SAP R/3 experience specializing in ABAP development. Kasi has spent last 5 years managing SAP R/3 offshore onsite development projects successfully. He can be reached at firstname.lastname@example.org for any clarifications about this white paper.
What does ALV do for you?
ALV Grid Control is SAP’s graphicallist-viewing tool and is similar in look and feel to Microsoft Excel. ALV’s broad functionality lets you emphasize, hide, and reformat list items; add graphic elements; and generally make any ABAP list display a more powerful communications tool. ALV functionality lets users: Apply typical list functions like summing, sorting and filtering without extra programming effort. Add response to user action byclicking on display line Define and save custom output settings both at user level and global level. Export list to other applications like excel. Create totals and sub-totals without additional programming effort. Create and share output templates. SAP provides a set of ALV function modules that can be used to output a report. This set of ALV functions is used to enhance the readability andfunctionality of any report output. Cases arise in sap when the output of a report contains columns extending more than 255 characters in length. In such cases, this set of ALV functions can help choose selected columns and arrange the different columns from a report output and also save different variants for report display. This is a very efficient tool for dynamically sorting and arranging the columnsfrom a report output. The report output can contain up to 90 columns in the display with the wide array of display options. The standard system provides functions that allow the user to sort, filter, and sum data in tables. Depending on the application, the ALV Grid Control includes additional application-specific functions and hides functions available in the standard system. The SAP List Viewer(ALV) standardizes the use of lists in the SAP System.
The commonly used ALV functions used for this purpose are; 1. REUSE_ALV_VARIANT_DEFAULT_GET 2. REUSE_ALV_VARIANT_F4 3. REUSE_ALV_VARIANT_EXISTENCE 4. REUSE_ALV_EVENTS_GET 5. REUSE_ALV_COMMENTARY_WRITE 6. REUSE_ALV_FIELDCATALOG_MERGE 7. REUSE_ALV_LIST_DISPLAY 8. REUSE_ALV_GRID_DISPLAY 9. REUSE_ALV_POPUP_TO_SELECT
How you call thisfunction in your report?
After completion of all the data fetching from the database and append this data into an Internal Table. Say I_ITAB. Then use following function module.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY' EXPORTING I_CALLBACK_PROGRAM = 'PROGRAM NAME' I_STRUCTURE_NAME = 'I_ITAB' I_DEFAULT = 'X' I_SAVE = 'A' TABLES T_OUTTAB = I_ITAB. IF SY-SUBRC 0. WRITE: 'SY-SUBRC: ', SY-SUBRC ....