如何修改ovp中button 的状态(ABAP Webdynpro)

 先在ovp中添加一个button,fpm_event_id 属性设置一个值.

 

  constants:
    BEGIN OF gc_toolbar_element_type,
      button TYPE fpm_tb_element_type VALUE 'BU',
      toggle_button TYPE fpm_tb_element_type VALUE 'TB',
      button_choice TYPE fpm_tb_element_type VALUE 'BC',
    END OF gc_toolbar_element_type .

 

  field-symbols:
                 <lv_enabled>    type fpm_enabled,

    <ls_choice_item> type if_fpm_ovp=>ty_s_toolbar_element_sub_item,

     <ls_toolbar_element> type if_fpm_ovp=>ty_s_toolbar_element.

  ** Read toolbar of content area
  try.  

       call method io_ovp->get_toolbar_elements
        exporting
          iv_uibb_primary_attribute = iv_uibb_primary_attribute
        importing
          et_toolbar_element        = lt_toolbar_elements.

 


      loop at lt_toolbar_elements assigning <ls_toolbar_element>.
        lv_update = abap_false.                         "by default no update
        case <ls_toolbar_element>-type.
          when if_fpm_constants=>gc_toolbar_element_type-button. 
*           Process toolbar element type Button
            call method io_ovp->get_toolbar_button
              exporting
                iv_uibb_primary_attribute = iv_uibb_primary_attribute
                iv_toolbar_element_id     = <ls_toolbar_element>-element_id
              importing
                es_toolbar_button         = ls_toolbar_button.
            if ls_toolbar_button-event_id = iv_event_id.
*             Call method that handles the updating of attribut
    assign component 'ENABLED'    of structure ls_toolbar_element to <lv_enabled>.
    if <lv_enabled> <> iv_enabled.
      <lv_enabled> = iv_enabled.
      ev_update = abap_true.
    endif.                                  "iv_enabled <> <lv_enabled>

 

ls_toolbar_element- visibility = iv_text.

 

       element_id TYPE fpm_element_id,
      index TYPE fpm_index,
      text TYPE fpm_text,
      image TYPE fpm_image,
      tooltip TYPE fpm_tooltip,
      hotkey TYPE fpm_hotkey,
      explanation_text TYPE fpm_explanation,
      enabled TYPE fpm_enabled,
      visibility TYPE fpm_visibility,
      alignment TYPE fpm_toolbar_element_alignment,
      has_separator TYPE fpm_add_separator,
      event_id TYPE fpm_event_id,
      event_parameters TYPE fpm_t_parameter,
      action_type TYPE fpm_action_type,
      target_content_area TYPE fpm_target_content_area,
      component TYPE fpm_component_name,
      interface_view TYPE fpm_view_name,
      config_id TYPE wdy_config_id,
      config_type TYPE wdy_config_type,
      config_var TYPE wdy_config_var,

 

 


              if lv_update eq abap_true.
                call method io_ovp->change_toolbar_button
                  exporting
                    iv_uibb_primary_attribute   = iv_uibb_primary_attribute
                    is_toolbar_button           = ls_toolbar_button
                    iv_override_existing_action = abap_true.   "required to set attributes to existing action
              endif.                                "lv_update EQ abap_true

 

   when if_fpm_constants=>gc_toolbar_element_type-toggle_button. 

   when if_fpm_constants=>gc_toolbar_element_type-button_choice. 

              call method io_ovp->get_toolbar_button_choice
              exporting
                iv_uibb_primary_attribute     = iv_uibb_primary_attribute
                iv_toolbar_element_id         = <ls_toolbar_element>-element_id
              importing
                es_toolbar_button_choice      = ls_tb_button_choice
                et_toolbar_button_choice_item = lt_tb_but_choice_item.
            read table lt_tb_but_choice_item with key event_id = iv_event_id
                  assigning <ls_choice_item>. 

           endcase.
      endloop.                                  "lt_toolbar_elements ASSIGNING
    catch cx_fpm_floorplan .
      return.
  endtry.                        

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

入骨影评

谈钱太俗了,点赞即可!谢谢

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值