cancel
Showing results for 
Search instead for 
Did you mean: 

How to add a button in a list uibb

Former Member
0 Kudos

Hello Volks,

I need help.

I have to add a Button ( or just events to a button ) to a list uibb dynamically at runtime, which means I can't use the ~get-definition method.

This means I have to do it in ~get-data. I can define my actions there and add them to ct_action_usage but I can't come up with a way

to assign them to the button.

Does anyone have any idea how that might work?

Thanks in advance.

Mike

Accepted Solutions (0)

Answers (2)

Answers (2)

rohit3611
Contributor
0 Kudos

Hi,

Actions in the Toolbar

Firstly, the actions must be defined by the feeder. This is done in the feeder method get_definition,

using parameter et_action_definition. Additionally, the actions must be added to the Toolbar Schema

in the FPM configuration editor to ensure that they appear at runtime.

At runtime, the actions will raise the FPM event ID that has been specified using the attribute ID in parameter et_action_definition.

It is also possible that the action is not rendered in the toolbar of the List ATS UIBB but in the toolbar of the OVP assignment block where the list is embedded. This is done by setting the flag Exposable of parameter et_action_definition to TRUE. It is possible to change properties such as Visibility or Enabled of the toolbar elements in the feeder method get_data using parameter ct_action_usage. It is possible to assign a particular action (corresponding to one entry in et_action_definition) to more than one UI

element in the toolbar. However, when doing so, be aware of the following restriction: In feeder method

GET_DATA it is possible to change properties of the UI elements in the toolbar via parameter

CT_ACTION_USAGE. For actions that have been used more than once, it is only possible to change the Visibility and Enable/Disable properties.

Best regards,

Rohit

Former Member
0 Kudos

Hi Guys,

thanks for the help but I know about that method.

What I need to know is, if there is any way to create the button or better to add a random action to the button when get~data is used.

I do not have all the information's that are required to assign all necassary actions to the button in the get~definition method.

The actions that are avalible should be created in the method get~data and assigned to the button.

I know it is rather unusall but this is what i need to figure out.

Thanks

Michael

harsha_jalakam
Active Contributor
0 Kudos

Hi Micheal,

We can achieve the required functionality in get_data method. First,Create the button and assign it to concerned action ( initially defined in GET_DEFINITION method ) at UIBB configuration. Now in case if you want it hide it at start up ,& have to modify based on a event ,the  visible parameter of the CT_ACTION_USAGE can be used to achieve it.

VISIBLE = CL_WD_UIELEMENT=>E_VISIBLE-NONE. " To hide the UI concerned to method

VISIBLE = CL_WD_UIELEMENT=>E_VISIBLE-VISIBLE." TO show the UI concerned to the method.

In your case , following code will help accordingly. I have changed the visibility of button based on a event, initially I have disable the button and based on certain event I have enabled it again.

data ls_act_def like line of ET_ACTION_DEFINITION.

   ls_act_def-ENABLED = 'X'.

   ls_act_def-ID = 'ADD'.

   ls_act_def-TEXT = 'Add a row'.

   ls_act_def-VISIBLE = CL_WD_UIELEMENT=>E_VISIBLE-NONE.

   append LS_ACT_DEF to ET_ACTION_DEFINITION.

endmethod.

method IF_FPM_GUIBB_LIST~GET_DATA.

IF IV_EVENTID->MV_EVENT_ID EQ  'FETCH_DATA'.

  field-SYMBOLS: <fs_field> like line of CT_ACTION_USAGE.

    loop at CT_ACTION_USAGE ASSIGNING <FS_FIELD>.

      case <FS_FIELD>-ID.

      when 'ADD'. " name of the field

          <FS_FIELD>-VISIBLE = CL_WD_UIELEMENT=>E_VISIBLE-VISIBLE.

            EV_ACTION_USAGE_CHANGED = ABAP_TRUE.

      ENDCASE.

      ENDLOOP.

ENDIF.

endmethod.



Regards,

Harsha