ALV has three implementation methods: cl_salv_table, cl_gui_grid_display, and function, they are reuse_alv_list_display and reuse_alv_grid_display. Currently, functoin is used to implement Alv. In fact, the underlying layer of these two functions is also based on the class cl_gui_grid_display.
Let's take a look at the differences between the two functoin implementations of ALV?
ALV effect implemented with reuse_alv_grid_display
ALV effect implemented by reuse_alv_list_display
In fact, implementing ALV is quite simple, mainly called the two functions. The following describes the implementation steps:
I, Declare the internal table of the content to be displayed and obtain data
Data: it_spfli type table of spfli.
Select * From spfli into Table it_spfli.
II, Call the function of ALV
Call function 'reuse _ alv_list_display'
Exporting
I _structure_name = 'spfli'
Tables
T_outtab = it_spfli.
Note: The function called here is reuse_alv_list_display. If you want to achieve the first effect, you should call
Use reuse_alv_grid_display. The two display effects are different and the operation methods are basically the same.
In this example, two parameters are used to call the function: I _structure_name and
T_outtab. I _structure_name is the structure of the output list, And t_outtab is the content of the output list.
Below are all the source code
Data: it_spfli type table of spfli.
Select * From spfli into Table it_spfli.
Call function 'reuse _ alv_list_display'
Exporting
I _structure_name = 'spfli'
Tables
T_outtab = it_spfli.