cancel
Showing results for 
Search instead for 
Did you mean: 

add a button choice on alv toolbar in wda

Mareidem
Explorer
0 Kudos

Hello Experts,

I want add a button choice on alv toolbar. I already insert the choice button indeed I see the button correctly.

Now I want insert the list of action with the following code:

<<

>>

With this code my web-interface retuns this message: "500 SAO INTERNAL SERVER ERROR. ERROR ACCESS via null object reference not possible. (termination rabax_state)". The dump is in "cl_wdr_utilities=>construct_mime_url".

Do you have any ideas? Do you have any examples?

Thanks in advance.

Best Regards,

Marino

Accepted Solutions (1)

Accepted Solutions (1)

Mareidem
Explorer

Hello,

the problem isn't "the line set_image_source". The problem was the order, the correct order is:

<<

CREATE OBJECT lr_button_choice.

     lr_button_choice->set_image_source( 'ICON_CHANGE' ).    "#EC *

     lr_button_choice->set_text( value = 'Modifica' ).

     lr_button_choice->set_tooltip( value = 'Modifica Attributi').


CREATE OBJECT lr_menu_action_item

       EXPORTING

         id = 'MOD_NOTE'." TYPE REF TO cl_salv_wd_menu_action_item.

     lr_menu_action_item->set_text( 'Note').

     lr_button_choice->add_choice( EXPORTING  value = lr_menu_action_item ).

     CREATE OBJECT lr_menu_action_item

       EXPORTING

         id = 'MOD_CONTO'." TYPE REF TO cl_salv_wd_menu_action_item.

     lr_menu_action_item->set_text( 'Conto').

     lr_button_choice->add_choice( EXPORTING  value = lr_menu_action_item ).

     lr_function = wd_this->salv_incassi->if_salv_wd_function_settings~create_function( id = 'MOD')."creating the function for alv button

     lr_function->set_editor( lr_button_choice ).


>>


Thanks very much.

Best Regards,

Marino

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Marino,

Check this below code.

data:  ls_choice TYPE ig_componentcontroller=>element_choice,

          nd_choice TYPE REF TO if_wd_context_node,

nd_choice = nd_my_functions->get_child_node( name = wd_this->wdctx_choice ).

  el_choice = nd_choice->get_element(  ).

ls_choice-wa_value = '01'.

  APPEND ls_choice TO lt_choice.

  nd_choice->bind_table( lt_choice ).

  DATA:lr_button_choice TYPE REF TO cl_salv_wd_fe_button_choice.

  DATA:lr_choice TYPE REF TO cl_salv_wd_menu_action_item.

  lr_function = l_value->if_salv_wd_function_settings~create_function_right( id = 'MYBUTTONCHOICE' ).

  CREATE OBJECT lr_button_choice.

          EXPORTING

            sel_action_item_elementname = 'CHOICE.WA_VALUE'.

  lr_button_choice->set_text( value = 'Filter' ).

  lr_button_choice->set_tooltip( value = 'Filter').

  lr_button_choice->set_sel_action_itm_elementname( 'CHOICE.WA_VALUE' ).

  CREATE OBJECT lr_choice

    EXPORTING

      id = 'CHOICE'. "CREATE OBJECT lr_choice the object id have to refer to name of node.

  lr_choice->set_text( 'Esito Positivo' ).

  lr_choice->set_image_source( value = 'ICON_GREEN_LIGHT').

  lr_button_choice->add_choice( lr_choice ).

  lr_function->set_editor( lr_button_choice ).

Thanks

KH

ramakrishnappa
Active Contributor
0 Kudos

Hi Marino,

Try to comment the line set_image_source and check if everything works fine.

Regards,

Rama

former_member184578
Active Contributor
0 Kudos

Hi,

I guess in the image source you have to provide the web Icon name. using ~Icon/<name>

lr_action_change->set_image_source( value = '~Icon/GreenLed' ).

Regards,

Kiran