cancel
Showing results for 
Search instead for 
Did you mean: 

How to Create dynamic icon in List UIBB toolbar

0 Kudos

Hi I am trying to create a one dynamic icon in list uibb ( without configuring anything from the List Configuration). Is it possible to create a dynamic icon.

I tried with the below options:

1) Created action and assigned to ET_ACTION_DEFINITION for fpm event action.

2) Called a method ADD_BUTTON_ROW and got the button row ref.

3) Called a method ADD_BUTTON_ROW_ELEMENT(Button Type: BT) and passed the above button row ref. in the GET_DEFAULT_CONFIG method.

But button/icon is not getting created.

Is this is correct or should we go ahead with any way to create a icon in list toolbar.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hello Amarnadh,

In ADD_BUTTON_ROW_ELEMENT method, we have a parameter called IS_SPECIAL_PROPERTIES. This structure contains the 'IMAGE_SOURCE' as one of the property.

Fill this structure with this property and pass SPECIAL PROPERTIES parameter while calling ADD_BUTTON_ROW_ELEMENT method.


Sample Code:


data: ls_special_properties type FPMGB_S_SPECIAL_PROPERTIES.

ls_special_properties-image_source = '~Icon/Search'.


io_layout_config->add_button_row_element(

        EXPORTING

          iv_display_type   = 'BT'     " Action Display Type for Toolbar

          iv_index          = 1

          iv_text           = 'Button Text'

        is_special_properties =   ls_special_properties           " Special Properties for UI Elements


      it_element_action = lt_action    " Actions in Configuration

       iv_br_id          = lv_br_id   ). " FPM: Element ID

Hope it will helps you.

Regards,

Naga

Answers (1)

Answers (1)

vaibhav_singh12
Participant
0 Kudos

Can you provide the code from both GET_DEFINITION & GET_DEFAULT_CONFIG?

0 Kudos

Hi Vaibhav,

I have attached both the methods of the code in the attachment.

And I didn't change anything from the configuration level. Is it possible to create an icon from the feeder class itself

vaibhav_singh12
Participant
0 Kudos

Method IF_FPM_GUIBB_LIST~GET_DEFINITION

------------------------------------------------------------------------

  DATA: ls_action TYPE fpmgb_s_actiondef.

  ls_action-id = 'CUSTOM'.

*  ls_action-text = 'Custom'.

  ls_action-enabled = abap_true.

  ls_action-visible = '02'.

  ls_action-imagesrc = '~Icon/Search'.     "I Caps S Caps

*  ls_action-action_type = '0'.

  ls_action-tooltip  = 'Custom Button'.

  APPEND ls_action TO et_action_definition.

Method: IF_FPM_GUIBB_LIST~GET_DEFAULT_CONFIG
---------------------------------------------------------------------------------
  DATA: lv_event TYPE fpm_element_id.
  DATA: lt_action TYPE fpmgb_t_action,
        ls_action TYPE fpmgb_s_action,
        lv_br_id TYPE fpm_element_id.
  DATA: lr_err TYPE REF TO cx_fpm_configuration.


  lv_br_id = io_layout_config->add_button_row( ).
*      Insert new button
  ls_action-event_id = 'CUSTOM'.
  ls_action-index    = 1.

  ls_action-text     = 'Button Text'.

  APPEND ls_action TO lt_action.
  CLEAR ls_action.
  TRY.
      io_layout_config->add_button_row_element(
        EXPORTING
          iv_display_type   = 'BT'     " Action Display Type for Toolbar
          iv_index          = 1

    

          iv_text           = 'Button Text'    " Web Dynpro: Configuration: Translatable Text


          it_element_action = lt_action    " Actions in Configuration
          iv_br_id          = lv_br_id   ). " FPM: Element ID )
    CATCH cx_fpm_configuration INTO lr_err.    " Configuration exceptions
  ENDTRY.

vaibhav_singh12
Participant
0 Kudos

it_element_action = lt_action    " Actions in Configuration

This line should be un-commented as well.

0 Kudos

Made the changes but still didn't worked.

Let me clarify one thing..I haven't created any icons in the toolbar from the configuration.

vaibhav_singh12
Participant
0 Kudos

Yes you do not perform any activity in configuration expect to assign feeder class. I tried your code it works fine for me.

vaibhav_singh12
Participant
0 Kudos

I used the following code with SFLIGHT structure:

METHOD if_fpm_guibb_list~get_definition.
  DATA lt_data TYPE STANDARD TABLE OF sflight.
  FIELD-SYMBOLS <fs_field> like LINE OF et_field_description.

  DATA: ls_action TYPE fpmgb_s_actiondef.
  ls_action-id = 'CUSTOM'.
  ls_action-enabled = abap_true.
  ls_action-visible = '02'.
  ls_action-imagesrc = '~Icon/Search'.
  ls_action-tooltip  = 'Custom Button'.
  APPEND ls_action TO et_action_definition.

  eo_field_catalog ?= cl_abap_tabledescr=>describe_by_data( p_data = lt_data ).

  APPEND INITIAL LINE TO et_field_description ASSIGNING <fs_field>.
  <fs_field>-name = 'CARRID'.
  <fs_field>-visibility = '02'.
ENDMETHOD.

METHOD if_fpm_guibb_list~get_default_config.
  TRY .
      CALL METHOD io_layout_config->add_column
        EXPORTING
          iv_name         = 'CARRID'
          iv_display_type = if_fpm_guibb_constants=>gc_display_type-text_view    " Display Type
          iv_index        = 1
          iv_header       = 'Airline Code'.


    CATCH cx_fpm_configuration.    " Configuration exceptions
  ENDTRY.

  DATA: lv_event TYPE fpm_element_id.
  DATA: lt_action TYPE fpmgb_t_action,
        ls_action TYPE fpmgb_s_action,
        lv_br_id TYPE fpm_element_id.
  DATA: lr_err TYPE REF TO cx_fpm_configuration.


  lv_br_id = io_layout_config->add_button_row( ).
*      Insert new button
  ls_action-event_id = 'CUSTOM'.
  ls_action-index    = 1.
  ls_action-text     = 'Button Text'.
  APPEND ls_action TO lt_action.
  CLEAR ls_action.
  TRY.
      io_layout_config->add_button_row_element(
        EXPORTING
          iv_display_type   = 'BT'     " Action Display Type for Toolbar
          iv_index          = 1
          iv_text           = 'Button Text'    " Web Dynpro: Configuration: Translatable Text
          it_element_action = lt_action    " Actions in Configuration
          iv_br_id          = lv_br_id   ). " FPM: Element ID )
    CATCH cx_fpm_configuration INTO lr_err.    " Configuration exceptions
  ENDTRY.
ENDMETHOD.

Then in component config just assigned feeder class, there should be no actions and field assigned in config, if there are remove them.