Вы находитесь на странице: 1из 14

ABAP List Viewer (ALV)

In this section, we will Explain the concept of ALV Reports The Data Declaration for ALV Reports Database Selection, Event Handling and Form Handling in ALV reports Different Function Modules for displaying ALV reports

ALV can be performed using two ways: 1. Using Function Modules 2. Using Classes and Objects Discussion on this is out of scope of this session

Steps involved in creating a simple ALV report :


1. Define field catalogue internal table which is of type slis_t_fieldcat_alv. This table contains the field attributes. Define Layout structure which is of type slis_layout_alv Define Events internal table which is of type slis_alv_event. This internal table contains all the possible events of ALV. Populating these tables into the Function Module as parameters. These Function Modules are used in displaying the output data. All the definitions of internal tables, structures, and constants are declared in type-pool called SLIS

2. 3.

4.

5.

1. Define Eg :

field catalogue internal table which is of type slis_t_fieldcat_alv


t_ls_fieldcat type slis_t_fieldcat_alv
t_ls_fieldcat-tabname = t_ls_fieldcat-fieldname = t_ls_fieldcat-ref_tabname = t_ls_fieldcat-ref_fieldname = t_ls_fieldcat-seltext_m = t_ls_fieldcat-input = t_ls_fieldcat-outputlen = t_ls_fieldcat-do_sum = t_spfli. scarr . par_reftabname. par_ref_fieldname. par_seltext. par_input. 30. X.

APPEND t_ls_fieldcat.

2. Defining Layout structure which is of type

slis_layout_alv
Eg :
par_ls_layout-zebra = X. par_ls_layout-no_colhead = X. par_ls_layout-no_hotspot = X.

3. Define Events internal table which is of type slis_alv_event


CALL FUNCTION 'REUSE_ALV_EVENTS_GET' EXPORTING I_LIST_TYPE = 0 IMPORTING ET_EVENTS = E03_LT_EVENTS.

4. Important Function Modules


Reuse_alv_list_display - This is the Function Module which prints the data. Reuse_alv_fieldcatalog_merge - This Function Module is used to populate a fieldcatalog which is essential to display the data in ALV. Reuse_alv_events_get - Returns table of possible events for a list type. Reuse_alv_commentary_write - This is used in the Top-of-page event to print the headings and other comments for the list.

Important Function Modules


Reuse_alv_grid_display - A new function in 4.6 version, to display the results in grid rather than as a list. Reuse_alv_hierseq_list_display - To display Hierarchical Sequential display of reports

Calling Function REUSE_ALV_LIST_DISPLAY


CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY' EXPORTING I_CALLBACK_PROGRAM = G_REPID I_STRUCTURE_NAME = 'SFLIGHT' IS_LAYOUT = GS_LAYOUT IT_FIELDCAT = GT_FIELDCAT[ ] IT_SPECIAL_GROUPS = GT_SP_GROUP[ ] I_SAVE = G_SAVE IS_VARIANT = G_VARIANT IT_EVENTS = GT_EVENTS[ ] * IMPORTING * E_EXIT_CAUSED_BY_CALLER = TABLES T_OUTTAB = GT_SFLIGHT.

Calling Function REUSE_ALV_EVENTS_GET


CALL FUNCTION 'REUSE_ALV_EVENTS_GET' EXPORTING I_LIST_TYPE = 0 IMPORTING ET_EVENTS = E03_LT_EVENTS.

Calling Function REUSE_ALV_COMMENTARY_WRITE


refresh GT_LIST_TOP_OF_PAGE. Move H to GT_LIST_TOP_OF_PAGE-typ. Move Materials Display to GT_LIST_TOP_OF_PAGE-info. Append GT_LIST_TOP_OF_PAGE. FORM TOP_OF_PAGE. CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE' EXPORTING IT_LIST_COMMENTARY = GT_LIST_TOP_OF_PAGE. ENDFORM.

Calling Function REUSE_ALV_GRID_DISPLAY


CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY' EXPORTING I_CALLBACK_PROGRAM = G_REPID I_STRUCTURE_NAME = 'SFLIGHT' IS_LAYOUT = GS_LAYOUT IT_FIELDCAT = GT_FIELDCAT[ ] IT_SPECIAL_GROUPS = GT_SP_GROUP[ ] I_SAVE = G_SAVE IS_VARIANT = G_VARIANT IT_EVENTS = GT_EVENTS[ ] * IMPORTING * E_EXIT_CAUSED_BY_CALLER = TABLES T_OUTTAB = GT_SFLIGHT.

Calling Function REUSE_ALV_HIERSEQ_LIST_DISPLAY


CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY' EXPORTING I_CALLBACK_PROGRAM = G_REPID IS_LAYOUT = GS_LAYOUT IT_FIELDCAT = GT_FIELDCAT[ ] IT_SPECIAL_GROUPS = GT_SP_GROUP[ ] I_SAVE = G_SAVE IS_VARIANT = G_VARIANT IT_EVENTS = GT_EVENTS[ ] I_TABNAME_HEADER = G_TABNAME_HEADER I_TABNAME_ITEM = G_TABNAME_ITEM IS_KEYINFO = GS_KEYINFO TABLES T_OUTTAB_HEADER = GT_SCARR T_OUTTAB_ITEM = GT_SPFLI.

Вам также может понравиться