Skip to Content
0
Former Member
Apr 15, 2014 at 01:36 PM

Not Getting all the icons in the Toolbar while using using ALV with OOPS

2991 Views

Hello,

But I am not able to get all the Keys in the toolbar for which i have called the method from class cl_salv_functions_list, by using the following logic.

Though i am getting all except Word Processing, ABC Analysis, Save layout, Information, Get Layout.

FORM ALV_DISPLAY .


data: lr_functions type ref to cl_salv_functions_list, "toolbar

lr_columns type ref to cl_salv_columns,

LI_COLUMNS TYPE REF TO CL_SALV_COLUMNS_TABLE, "columns instance

LI_COL TYPE REF TO CL_SALV_COLUMN_TABLE, "column instance

LR_EVENTS TYPE REF TO CL_SALV_EVENTS_TABLE,

GR_EVENTS TYPE REF TO LCL_HANDLE_EVENTS.


TRY. "method for ALV display

CALL METHOD CL_SALV_TABLE=>FACTORY

EXPORTINg

LIST_DISPLAY = IF_SALV_C_BOOL_SAP=>FALSE

IMPORTING

R_SALV_TABLE = li_alv

CHANGING

T_TABLE = it_po_final.

CATCH CX_SALV_MSG .

message e001(00) with text-011.

ENDTRY.

*calling methods for toolbar

lr_functions = li_alv->get_functions( ).


lr_functions->set_default( abap_true ).

lr_functions->set_print_preview( abap_true ).

lr_functions->set_view_excel( abap_true ).

lr_functions->SET_EXPORT_WORDPROCESSOR( abap_true ).

lr_functions->set_export_localfile( abap_true ).

lr_functions->SET_EXPORT_MAIL( abap_true ).

lr_functions->SET_EXPORT_SEND( abap_true ).

lr_functions->SET_ABC_ANALYSIS( abap_true ).

lr_functions->SET_GRAPHICS( abap_true )

lr_functions->SET_LAYOUT_SAVE( abap_true ).

lr_functions->SET_DETAIL( abap_true ).

lr_functions->SET_LAYOUT_MAINTAIN( abap_true )

*... set the columns technical

lr_columns = li_alv->get_columns( ).

lr_columns->set_optimize( abap_true ).

**get ALV columns

CALL METHOD LI_ALV->GET_COLUMNS "get all columns

RECEIVING

VALUE = LI_COLUMNS.

IF LI_COLUMNS IS NOT INITIAL.

*Get EBELN column

TRY.

LI_COL ?= LI_COLUMNS->GET_COLUMN( 'EBELN' ). "get EBELN columns to insert hotspot

CATCH CX_SALV_NOT_FOUND.

MESSAGE i001(00) with text-012.

ENDTRY.

* Set the HotSpot for ebeln Column


TRY.


CALL METHOD LI_COL->SET_CELL_TYPE "set cell type hotspot

EXPORTING

VALUE = IF_SALV_C_CELL_TYPE=>HOTSPOT.

CATCH CX_SALV_DATA_ERROR .

MESSAGE i001(00) with text-012.

ENDTRY.

ENDIF.

*Register events

*Event handler method for ALV

***handle hotspot click


LR_EVENTS = LI_ALV->GET_EVENT( ). "get event

CREATE OBJECT GR_EVENTS.

SET HANDLER GR_EVENTS->ON_LINE_CLICK FOR LR_EVENTS. "register event handler method

IF li_alv IS BOUND. "calling display method for ALV


li_alv->display( ).


ENDIF.

ENDFORM. " ALV_DISPLAY