09-10-2008 5:19 PM
Dear friends,
Used object oriented abap for the first time in a report and for alv as well.
Objects columns TYPE REF TO cl_salv_columns_table and column TYPE REF TO cl_salv_column_table are used insted of fieldcatalog.
But not able find any property for hotspot. Is this ( column->set_hyperlink_entry( ) ) meant for hotspot ?.
Kindly suggest,
Praveen Lobo
09-10-2008 5:22 PM
For HOTSPOT you need to get the Columns first and than get the Column property and set the HOTSPOT useing the SET_CELL_TYPE.
Like:
*...Columns tables for the HotSpot.........................................
DATA: LO_COLS_TAB TYPE REF TO CL_SALV_COLUMNS_TABLE,
LO_COL_TAB TYPE REF TO CL_SALV_COLUMN_TABLE.
* get Columns object
LO_COLS_TAB = O_ALV->GET_COLUMNS( ).
* Get VBELN column
TRY.
LO_COL_TAB ?= LO_COLS_TAB->GET_COLUMN( 'VBELN' ).
CATCH CX_SALV_NOT_FOUND.
ENDTRY.
* Set the HotSpot for VBELN Column
TRY.
CALL METHOD LO_COL_TAB->SET_CELL_TYPE
EXPORTING
VALUE = IF_SALV_C_CELL_TYPE=>HOTSPOT.
.
CATCH CX_SALV_DATA_ERROR .
ENDTRY.
Regards,
Naimesh Patel
09-10-2008 5:22 PM
For HOTSPOT you need to get the Columns first and than get the Column property and set the HOTSPOT useing the SET_CELL_TYPE.
Like:
*...Columns tables for the HotSpot.........................................
DATA: LO_COLS_TAB TYPE REF TO CL_SALV_COLUMNS_TABLE,
LO_COL_TAB TYPE REF TO CL_SALV_COLUMN_TABLE.
* get Columns object
LO_COLS_TAB = O_ALV->GET_COLUMNS( ).
* Get VBELN column
TRY.
LO_COL_TAB ?= LO_COLS_TAB->GET_COLUMN( 'VBELN' ).
CATCH CX_SALV_NOT_FOUND.
ENDTRY.
* Set the HotSpot for VBELN Column
TRY.
CALL METHOD LO_COL_TAB->SET_CELL_TYPE
EXPORTING
VALUE = IF_SALV_C_CELL_TYPE=>HOTSPOT.
.
CATCH CX_SALV_DATA_ERROR .
ENDTRY.
Regards,
Naimesh Patel
09-11-2008 4:18 AM
using the SET_CELL_TYPE method of the class cl_salv_column_table you can get the hotspot option.
check this sample code...
REPORT ztest_salv.
DATA: alv TYPE REF TO cl_salv_table.
TYPES: BEGIN OF ty_tab,
carrid TYPE sflight-carrid,
connid TYPE sflight-connid,
END OF ty_tab.
DATA: col_tab TYPE REF TO cl_salv_columns_table,
col TYPE REF TO cl_salv_column_table.
DATA: col_ref TYPE salv_t_column_ref,
wa LIKE LINE OF col_ref.
DATA: it_flight TYPE STANDARD TABLE OF ty_tab.
SELECT carrid connid FROM sflight INTO TABLE it_flight
UP TO 10 ROWS.
cl_salv_table=>factory(
IMPORTING
r_salv_table = alv
CHANGING
t_table = it_flight
).
"get all the columns
col_tab = alv->get_columns( ).
col_ref = col_tab->get( ).
"loop each column
LOOP AT col_ref INTO wa.
"Conditionally set the column type as key or non key
IF wa-columnname = 'CARRID'.
col ?= wa-r_column.
col->set_key( abap_true ).
col->SET_CELL_TYPE( 5 ). "5 is for Hotspot
ENDIF.
ENDLOOP.
alv->display( ).
07-01-2023 9:49 PM
09-11-2008 5:46 AM
hi,
go through these links.. will be helpful for u..
http://sap.ittoolbox.com/code/archives.asp?i=10&d=3411&a=s
regards,
preet
09-11-2008 6:18 AM
Hi Praveen,
Please check this link to know how to set HOTSPOT using SALV class's method SET_CELL_TYPE.
In the above link search for HOTSPOT.
Go through this link for sample prog
http://www.sapfans.com/forums/viewtopic.php?p=913440&sid=cb3438c8cdca4c20f56871451b45f498
Hope this would help you.
Good luck
Narin