COLUMN OPTIMIZE IN OOALV .
In column optimize we basically optimise the space and table look. for this we use class
--->CL_SALV_COLUMNS_TABLE.there are 2 methods inside this class we are going to use that are as follows:
1:get_columns( ).
2:set_optimize( ).
*&---------------------------------------------------------------------*
*& Report ZALVWITHTTOOLBAR
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT ZALVWITHTTOOLBAR.
TYPES:BEGIN OF TY_MARA,
MATNR TYPE MARA-MATNR,
ERNAM TYPE MARA-ERNAM,
END OF TY_MARA.
DATA: IT_MARA TYPE TABLE OF TY_MARA.
SELECT MATNR
ERNAM
FROM MARA INTO TABLE IT_MARA UP TO 20 ROWS.
DATA: OO_ALV TYPE REF TO CL_SALV_TABLE.
*TRY.
CALL METHOD CL_SALV_TABLE=>FACTORY
* EXPORTING
* LIST_DISPLAY = IF_SALV_C_BOOL_SAP=>FALSE
* R_CONTAINER =
* CONTAINER_NAME =
IMPORTING
R_SALV_TABLE = OO_ALV
CHANGING
T_TABLE = IT_MARA
.
* CATCH CX_SALV_MSG .
*ENDTRY.
DATA: LO_FUNCTION TYPE REF TO CL_SALV_FUNCTIONS_LIST.
LO_FUNCTION = OO_ALV->GET_FUNCTIONS( ).
LO_FUNCTION->SET_ALL( ABAP_TRUE ).
DATA:LO_DISPLAY TYPE REF TO CL_SALV_DISPLAY_SETTINGS.
LO_DISPLAY = OO_ALV->GET_DISPLAY_SETTINGS( ).
LO_DISPLAY->SET_LIST_HEADER( VALUE = ' MATERIAL DETAILS').
LO_DISPLAY->SET_STRIPED_PATTERN( VALUE = 'X').
********for optimizing the column width , we are going to use set_optimize method
data:LO_COLUMNS TYPE REF TO CL_SALV_COLUMNS_TABLE.
LO_COLUMNS = OO_ALV->GET_COLUMNS( ). "GETTING THE COLUMNS "
LO_COLUMNS->SET_OPTIMIZE( ). " OPTIMIZING THE COLUMNS
OO_ALV->DISPLAY( ).
In column optimize we basically optimise the space and table look. for this we use class
--->CL_SALV_COLUMNS_TABLE.there are 2 methods inside this class we are going to use that are as follows:
1:get_columns( ).
2:set_optimize( ).
*&---------------------------------------------------------------------*
*& Report ZALVWITHTTOOLBAR
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT ZALVWITHTTOOLBAR.
TYPES:BEGIN OF TY_MARA,
MATNR TYPE MARA-MATNR,
ERNAM TYPE MARA-ERNAM,
END OF TY_MARA.
DATA: IT_MARA TYPE TABLE OF TY_MARA.
SELECT MATNR
ERNAM
FROM MARA INTO TABLE IT_MARA UP TO 20 ROWS.
DATA: OO_ALV TYPE REF TO CL_SALV_TABLE.
*TRY.
CALL METHOD CL_SALV_TABLE=>FACTORY
* EXPORTING
* LIST_DISPLAY = IF_SALV_C_BOOL_SAP=>FALSE
* R_CONTAINER =
* CONTAINER_NAME =
IMPORTING
R_SALV_TABLE = OO_ALV
CHANGING
T_TABLE = IT_MARA
.
* CATCH CX_SALV_MSG .
*ENDTRY.
DATA: LO_FUNCTION TYPE REF TO CL_SALV_FUNCTIONS_LIST.
LO_FUNCTION = OO_ALV->GET_FUNCTIONS( ).
LO_FUNCTION->SET_ALL( ABAP_TRUE ).
DATA:LO_DISPLAY TYPE REF TO CL_SALV_DISPLAY_SETTINGS.
LO_DISPLAY = OO_ALV->GET_DISPLAY_SETTINGS( ).
LO_DISPLAY->SET_LIST_HEADER( VALUE = ' MATERIAL DETAILS').
LO_DISPLAY->SET_STRIPED_PATTERN( VALUE = 'X').
********for optimizing the column width , we are going to use set_optimize method
data:LO_COLUMNS TYPE REF TO CL_SALV_COLUMNS_TABLE.
LO_COLUMNS = OO_ALV->GET_COLUMNS( ). "GETTING THE COLUMNS "
LO_COLUMNS->SET_OPTIMIZE( ). " OPTIMIZING THE COLUMNS
OO_ALV->DISPLAY( ).