Oop Alv Ex01
Oop Alv Ex01
Oop Alv Ex01
START-OF-SELECTION.
SELECT a~kunnr
a~name1
b~vbeln
b~erdat
b~netwr
FROM kna1 AS a INNER JOIN
vbak AS b
ON a~kunnr = b~kunnr
INTO TABLE t_output
WHERE a~kunnr IN s_kunnr.
FORM populate_fcat .
DATA: ls_fcat TYPE lvc_s_fcat.
FORM display_alv .
CREATE OBJECT r_cust_cont
EXPORTING
container_name = 'CUST_CONT'.
A button can be shown on the grid toolbar, allowing the user to save and reuse a layout. The button looks
like this: .
The I_SAVE parameter indicates the options for saving layouts. This parameter can have the
following values:
U Only user specific layouts can be saved
X Only global layouts can be saved
A Both user specific and global layouts can be saved
Space Layouts cannot be saved
FORM display_alv.
DATA: ls_variant TYPE disvariant.
ls_variant-report = sy-repid.
CALL METHOD r_grid->set_table_for_first_display
EXPORTING
is_variant = ls_variant
i_save = 'A'
* I_DEFAULT = 'X'
is_layout = s_layout
CHANGING
it_outtab = t_output
it_fieldcatalog = t_fcat.
ENDFORM.
i_default = X, or Do not mention this parameter in the method call. The default value for this
parameter is X.
If the parameter I_DEFAULT is assigned a value of space, the Manage Layouts screen would look as
below, where the user has no option choose a default layout:
FORM populate_layout .
s_layout-zebra = 'X'.
s_layout-cwidth_opt = 'X'.
s_layout-grid_title = 'Grid title text comes here.'.
ENDFORM.