ALV General Presentation

You might also like

Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 22

ALV Grid Control

Benefits How does it work - grid list - interactive functions

How to create ALV Grid Controls in 30 minutes


Step by Step about Controls ALV tree

March 20th, 2001

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.

March 20th, 2001

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)

March 20th, 2001

Detail

March 20th, 2001

Filter

March 20th, 2001

Sort

March 20th, 2001

Variants

March 20th, 2001

Variant Management

March 20th, 2001

Totals

Select column which should be totalized. Click Icon.


March 20th, 2001

Sub total
Select column on which you want sub-totals and click the sub-total icon.

March 20th, 2001

Mail

March 20th, 2001

Download

March 20th, 2001

Word processing

March 20th, 2001

Spreadsheet

March 20th, 2001

How to create an ALV in 30 minutes


There are sample programs which are good templates for new programs. Prefix BCALV For lists use BCALV_FULLSCREEN_DEMO which encapsulates ABAP-Objects in a function module. For controls within dynpros use the other templates.

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.

March 20th, 2001

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

set Toolbar, context-menu, Variants:


default variant

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

March 20th, 2001

Example add top-of-page event


* sample from ZFI_PAYMENT_LIST

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[]

March 20th, 2001

Controls are screen independent


Controls can be reused in different screens (e.g. VTRK is reused in VL03N) or can be docked to other dynpros. (e.g. SEU)

March 20th, 2001

ALV Tree control


The ALV tree provides a similar program interface like ALV Grid. Sample ALV-Trees: Transaction VTRK SEU navigation which is docked to other Controls.

March 20th, 2001

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.

March 20th, 2001

You might also like