on 02-09-2010 3:22 AM
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 ).
Hi Please reply if you were able to able complete the requirement. I am looking for a similar requirement.
Thanking You,
Regards,
Rahul
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I am not sure which version you are using. I am using 7.01 SP0006.
I am not having these classes in our system
cl_salv_wd_ve_menu
And also the CL_SALV_WD_UIE_LINK_TO_ACTION class doesnot have the set_menu and get_menu methods.
However CL_SALV_WD_UIE_IMAGE, CL_SALV_WD_UIE_TEXT_VIEW does have getter and setter methods, nevertheless they are not working.
hi ,
Refer this code.. Write this code in WDDOINIT method..
DATA lo_cmp_usage TYPE REF TO if_wd_component_usage.
lo_cmp_usage = wd_this->wd_cpuse_alv_table( ).
IF lo_cmp_usage->has_active_component( ) IS INITIAL.
lo_cmp_usage->create_component( ).
ENDIF.
*
DATA lo_interfacecontroller TYPE REF TO iwci_salv_wd_table .
lo_interfacecontroller = wd_this->wd_cpifc_alv_table( ).
*
DATA lo_value TYPE REF TO cl_salv_wd_config_table.
lo_value = lo_interfacecontroller->get_model(
).
lo_value->if_salv_wd_table_settings~set_read_only(
value = abap_false
).
" Link operations
data: lr_col type ref to cl_salv_wd_column,
lr_link1 TYPE REF TO cl_salv_wd_uie_link_to_action. "Link to action type
CALL METHOD lo_value->if_salv_wd_column_settings~get_column
EXPORTING
id = 'MATNR' " Pass the context attribute
receiving
value = lr_col.
CREATE OBJECT lr_link1.
lr_link1->set_text_fieldname( 'MATNR' ).
CALL METHOD lr_col->set_cell_editor
EXPORTING
value = lr_link1.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Just after your "Get ALV component controller" code i.e.
" Get ALV component controller
lr_alv_interfacecontroller = wd_this->wd_cpifc_docs_alv( ).
add the following code:
DATA lr_table_settings TYPE REF TO if_salv_wd_table_settings.
lr_table_settings ?= lr_alv_interfacecontroller.
lr_table_settings->set_read_only( abap_false ).
Try this.
Best Regards,
Loveline Thomas.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sorry, remove the earlier code.
After your code:
" Get ConfigurationModel from ALV Component
wd_this->alv_config_table = lr_alv_interfacecontroller->get_model( ).
Add the following code:
DATA lr_table_settings TYPE REF TO if_salv_wd_table_settings.
lr_table_settings ?= wd_this->alv_config_table .
lr_table_settings->set_read_only( abap_false ).
Best Regards,
Loveline Thomas.
I've added set_read_only( abap_false ) but it does not make any effect. Menu icon is not displayed next to the link. That's what I have now:
" Get ConfigurationModel from ALV Component
wd_this->alv_config_table = lr_alv_interfacecontroller->get_model( ).
" Set some table config properties
lr_table_settings ?= wd_this->alv_config_table.
lr_table_settings->set_visible_row_count( '20' ).
lr_table_settings->set_display_empty_rows( value = abap_false ).
lr_table_settings->set_read_only( abap_false ).
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' ).
CREATE OBJECT lr_link_to_action.
lr_link_to_action->set_text_fieldname( 'TXN_ID' ).
lr_link_to_action->set_tooltip( 'View document source' ).
MENU does not appear for unknown reason
" 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 ).
User | Count |
---|---|
87 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.