INCLUDE
INCLUDE
INCLUDE
TYPES: BEGIN OF ty_mara,
icon TYPE icon_d,
matnr TYPE mara-matnr,
meins TYPE mara-meins,
mtart TYPE mara-mtart,
t_celltype TYPE salv_t_int4_column,
END OF ty_mara.
DATA : lt_celltype TYPE salv_t_int4_column,
ls_celltype TYPE salv_s_int4_column.
DATA: lr_columns TYPE REF TO cl_salv_columns_table,
lr_column TYPE REF TO cl_salv_column_table.
CONSTANTS: gc_true TYPE sap_bool VALUE 'X'.
DATA : gr_layout TYPE REF TO cl_salv_layout,
gr_layout_key TYPE salv_s_layout_key,
ls_layout TYPE salv_s_layout,
lt_layout_info TYPE salv_t_layout_info.
DATA: it_mara TYPE TABLE OF ty_mara,
wa_mara TYPE ty_mara,
it_table TYPE REF TO cl_salv_table.
*----------------------------------------------------------------------*
* start of selection
*----------------------------------------------------------------------*
START-OF-SELECTION.
SELECT matnr
meins
mtart
FROM mara
INTO CORRESPONDING FIELDS OF TABLE it_mara
UP TO 10 ROWS.
END-OF-SELECTION.
LOOP AT it_mara INTO wa_mara.
IF wa_mara-meins = 'EA'.
wa_mara-icon = ICON_CAR.
ELSE.
wa_mara-icon = ICON_FLIGHT.
ENDIF.
MODIFY it_mara FROM wa_mara.
ENDLOOP.
TRY.
cl_salv_table=>factory(
EXPORTING list_display = 'X'
IMPORTING
r_salv_table = it_table
CHANGING
t_table = it_mara ).
CATCH cx_salv_msg.
ENDTRY.
DATA: lr_functions TYPE REF TO cl_salv_functions.
lr_functions = it_table->get_functions( ).
lr_functions->set_all( gc_true ).
lr_columns = it_table->get_columns( ).
lr_columns->set_optimize( gc_true ).
TRY.
lr_column ?= lr_columns->get_column( 'ICON' ).
lr_column->set_icon( if_salv_c_bool_sap=>true ).
lr_column->set_long_text( 'ICON' ).
CATCH cx_salv_not_found.
ENDTRY.
it_table->display( ).
ALSO READ:
- Coloring A Row & Column In ALV Display Using OOPS Concept.
- Create Unique Handle For ALV Layout (Variant).
- Customizing Toolbar In ALV Tree Using ABAP OO.
- Dropdown in ALV Grid Display.
- Dynamic ALV Grid/List Display.
..... Back To Index On ALV List/ Grid Display.
..... Back To MAIN INDEX.
No comments:
Post a Comment