首页 > 解决方案 > 在 SALV 全屏上启用/禁用按钮的问题

问题描述

亲爱的,我在下面迫切需要你的帮助。

我从 SALV 创建了一个 ALV,并SALV_STANDARD从标准程序复制了一个 GUI 状态。首先,我添加了 POSTNEW 和 POSTDIFF 两个按钮,一天后我添加了SELECT按钮。

根据用户的选择,我想根据业务需求启用或禁用按钮。

我在一个过程中有这个代码:

  r_alv type reference CL_SALV_TABLE.
  if status_name is not initial and report_name is not initial.
    set pf-status status_name.
    r_alv->set_screen_status(
      pfstatus      =  status_name
      report        =  report_name
      set_functions = r_alv->c_functions_all ).
  endif.

  data: lit_functions_list type salv_t_ui_func,
        lwa_functions_list like line of lit_functions_list.

  r_functions = r_alv->get_functions( ).  "Get Toolbar functions
  lit_functions_list = r_functions->get_functions( ).

  if i_button_name is not initial.
** Now hide the BUTTON
    loop at lit_functions_list into lwa_functions_list.
      if lwa_functions_list-r_function->get_name( ) = i_button_name.
        lwa_functions_list-r_function->set_visible( i_button_visable ).
      endif.
    endloop.
  endif.

变量status_name、和是过程的参数report_name,我认为它们的名称显示了它们所携带的内容。 i_button_namei_button_visable

The internal table lit_functions_list has 60 records and the last 2 have data for the first 2 buttons and this is the reason that I can enable/disable them.
But there is no record with my 3rd button SELECT. Instead there is a record with the button MYFUNCTION which I have already deleted.

Can someone tell me what to do in order to have the 3rd button available in the lit_functions_list?

Can someone tell me why this itab has so many garbages?

Thanks in advance
Elias

标签: abapalv

解决方案


即使我有同样的问题。在我运行报告 BALVBUFDEL 后,它解决了这个问题。
新创建的按钮现在进入功能列表..

lit_functions_list = r_functions->get_functions( ).

推荐阅读