Professional Documents
Culture Documents
ALV General Presentation
ALV General Presentation
ALV General Presentation
Benefits
ALV Grid Control provides a set of generic functions (e.g. sorting, filtering) for handling tabular data. It provides a user interface which takes advantage of control technology enabling more operations by mouse and interaction with other controls. (e.g. drag and drop) The user is able to create variants of list output by himself.
Grid List
Data: gt_outtab like ZFI_PAYMENTS occurs 0 with header line. Select * into corresponding fields of table gt_outtab from . Join ...
CALL METHOD GRID1->SET_TABLE_FOR_FIRST_DISPLAY EXPORTING I_STRUCTURE_NAME = ZFI_PAYMENTS ' CHANGING IT_OUTTAB = GT_OUTTAB.
Data
March 20th, 2001
Definition
Interactive functionality
Filtering sorting variants management calculations: (sub-)totals, ABC analysis download in various formats like Excel (incl. pivot table), Word
The functionality is built in and needs to be activated via events (toolbar, menu-button, context menu, usercommand)
Detail
Filter
Sort
Variants
Variant Management
Totals
Sub total
Select column on which you want sub-totals and click the sub-total icon.
Download
Word processing
Spreadsheet
In R/3 4.0 - 4.5 there are ALV templates using call-back technique without controls. Prefix BALV
March 20th, 2001
Step by step
Copy sample program (incl. User Interface and Screens) Create data structure in datadictionary change sample structure to new structure name select_data needs to fill the internal table gt_outtab done improve program by manipulating gs_layout and gt_events
DATA: BEGIN OF gt_outtab OCCURS 0. INCLUDE STRUCTURE zfi_payments. DATA: END OF gt_outtab, perform select_data. CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY' EXPORTING i_callback_program = g_repid i_structure_name = 'zfi_payments' is_layout = gs_layout i_save = g_save is_variant = gs_variant it_events = gt_events[] TABLES t_outtab = gt_outtab EXCEPTIONS program_error = 1 OTHERS = 2.
Typical enhancements
Fieldcatalogue:
set Header,
dynamic (calculated) fields
Get a list of all methods and attributes of the CL_GUI_ALV_GRID class in the class builder SE24
Events:
TOP_OF_PAGE: show title, parameters,.. BEFORE_LINE_OUTPUT: calculate dynamic fields,set icons click/double-click: get detail screens
new Functionality:
depending on application
FORM comment_build USING lt_top_of_page TYPE slis_t_listheader. DATA: ls_line TYPE slis_listheader. * * LIST HEADING LINE: TYPE H CLEAR ls_line. ls_line-typ = 'H'. * LS_LINE-KEY: NOT USED FOR THIS TYPE ls_line-info = 'Payments'(100). APPEND ls_line TO lt_top_of_page. ENDFORM
FORM top_of_page. CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE' EXPORTING i_logo = 'ENJOYSAP_LOGO' it_list_commentary = gt_list_top_of_page. ENDFORM.
FORM eventtab_build USING rt_events TYPE slis_t_event. *"Registration of events to happen during list display DATA: ls_event TYPE slis_alv_event. * CALL FUNCTION 'REUSE_ALV_EVENTS_GET' EXPORTING i_list_type = 0 IMPORTING et_events = rt_events. READ TABLE rt_events WITH KEY name = slis_ev_top_of_page INTO ls_event. IF sy-subrc = 0. MOVE g_top_of_page TO ls_event-form. APPEND ls_event TO rt_events. ENDIF. ENDFORM.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY' EXPORTING i_callback_program = g_repid i_structure_name = 'zfi_payments' is_layout = gs_layout it_events = gt_events[]
Resources
SAP Professional Journal November/December 2000 page 29: Developers Guide to the new Grid Control Sample Reports: BCALV*
Transactions/programs using ALV: VT01N ALV_TREE add deliveries to shipments via Drag and Drop VTRK ALV_TREE changes context_menu depending on cursor position VL02N holds the same control (header/parcel tracking) VTRC ALV_GRID changes data-basis
Redefining the data-dictionary structure: ALV caches the field-catalogue so it needs to be reset, when you change the data-dictionary structure. Run BCALV_BUFFER_DELETE to do so.
Attention: There is a note for the reset buffer program. It does not work for multiple application servers. Workaround: When you cannot delete the buffer, rename the data-dictionary structure.