HOTSPOT IN ALV USING OOABAP.
simple example to show how to get hotspot in the alv using ooabap.
*&---------------------------------------------------------------------*
*& Report ZOOALVWITHHOTSPOT
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT ZOOALVWITHHOTSPOT.
TYPES: BEGIN OF TY_MARA ,
MATNR TYPE MARA-MATNR,
MTART TYPE MARA-MTART,
MBRSH TYPE MARA-MBRSH ,
MEINS TYPE MARA-MEINS,
END OF TY_MARA.
DATA: IT_MARA TYPE TABLE OF TY_MARA.
DATA: WA_MARA TYPE TY_MARA.
***CREATING OBJECT THAT REFERNCES CL_SALV_TABLE
DATA: Oo_ALV TYPE REF TO CL_SALV_TABLE.
* FOR HOTSPOT WE NEED TO GET THE COLUMNS AS WELL AS SINGLE COLUMN ON WHICH WE WILL APPLY HOTSPOT
DATA: LT_COLUMNS TYPE REF TO CL_SALV_COLUMNS_TABLE .
**FOR PARTICULAR COLUMN ******************
DATA: LT_COL TYPE REF TO CL_SALV_COLUMN_TABLE.
SELECT MATNR
MTART
MBRSH
MEINS
FROM MARA INTO TABLE IT_MARA UP TO 30 ROWS.
*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.
***************NOW CALL THE METHOD TO GET THE PARTICULAR COLUMN ,
*WE USE GET_COLUMN TO GET THE PARTICULAR FIELD NAME.***
CALL METHOD OO_ALV->GET_COLUMNS
RECEIVING
VALUE = LT_COLUMNS
.
*****WE got the columns now getting that particular column **********
IF LT_COLUMNS IS NOT INITIAL.
LT_COL ?= LT_COLUMNS->GET_COLUMN('MATNR')."FIELD ON WHICH YOU WANT THE HOTSPOT"
CALL METHOD LT_COL->SET_CELL_TYPE
EXPORTING
VALUE = IF_SALV_C_CELL_TYPE=>HOTSPOT
.
ENDIF.
OO_ALV->DISPLAY( ). "DISPLAYING THE ALV"