Skip to Content
0
Former Member
Feb 09, 2010 at 03:22 AM

Menu for linktoaction control in ALV cell

21 Views

I cannot get menu displayed for linktoaction control added to ALV column. Code used is below. In debugger I could see menu added to linktoaction but it is not displayed in the ALV. Could anyone help.

DATA:

lo_nd_p3_trns TYPE REF TO if_wd_context_node,

lr_alv_component_usage TYPE REF TO if_wd_component_usage,

lr_alv_interfacecontroller TYPE REF TO iwci_salv_wd_table,

lr_table_settings TYPE REF TO if_salv_wd_table_settings,

lr_column_settings TYPE REF TO if_salv_wd_column_settings,

lr_column TYPE REF TO cl_salv_wd_column,

lr_col_header TYPE REF TO cl_salv_wd_column_header.

" Create an instance of ALV component usage if neccesary

lr_alv_component_usage = wd_this->wd_cpuse_docs_alv( ).

IF lr_alv_component_usage->has_active_component( ) IS INITIAL.

lr_alv_component_usage->create_component( ).

ENDIF.

" Get ALV component controller

lr_alv_interfacecontroller = wd_this->wd_cpifc_docs_alv( ).

" Set ALV table data source

lo_nd_p3_trns = wd_context->get_child_node( name = wd_this->wdctx_p3_trns ).

lr_alv_interfacecontroller->set_data( r_node_data = lo_nd_p3_trns ).

" Get ConfigurationModel from ALV Component

wd_this->alv_config_table = lr_alv_interfacecontroller->get_model( ).

lr_column_settings ?= wd_this->alv_config_table.

" Create link to action as a cell editor for 'TXN_ID' field

lr_column = lr_column_settings->get_column( 'TXN_ID' ).

DATA:

lr_link_to_action TYPE REF TO cl_salv_wd_uie_link_to_action,

lr_menu TYPE REF TO cl_salv_wd_ve_menu,

lr_menu_item TYPE REF TO cl_salv_wd_ve_menu_action_item.

" Create link to action

CREATE OBJECT lr_link_to_action.

lr_link_to_action->set_text_fieldname( 'TXN_ID' ).

" Add menu to it

CREATE OBJECT lr_menu

EXPORTING

id = 'mnu_doc'.

CREATE OBJECT lr_menu_item

EXPORTING

id = 'MAI_doc_status'.

lr_menu_item->set_text( value = 'Doc status details' ).

lr_menu_item->set_visible( value = 'X' ).

lr_menu->add_item( value = lr_menu_item ).

CREATE OBJECT lr_menu_item

EXPORTING

id = 'MAI_doc_source'.

lr_menu_item->set_text( value = 'Doc source' ).

lr_menu_item->set_visible( value = 'X' ).

lr_menu->add_item( value = lr_menu_item ).

lr_menu->set_visible( value = 'X' ).

lr_link_to_action->set_menu( value = lr_menu ).

lr_column->set_cell_editor( lr_link_to_action ).