ABAP Web dynpro layout动态可见

ABAP Web dynpro layout动态可见

新增的元素设置不可见

ABAP Web dynpro layout动态可见_第1张图片
ABAP Web dynpro layout动态可见_第2张图片
在视图初始化方法中下,获取选中数据,当选中数据不在配置表中,对该视图中容器的子元素显示出来
ABAP Web dynpro layout动态可见_第3张图片
效果图:
ABAP Web dynpro layout动态可见_第4张图片
ABAP Web dynpro layout动态可见_第5张图片
完整代码:

  DATA lo_nd_nod_pay_info TYPE REF TO if_wd_context_node.
  DATA lo_el_nod_pay_info TYPE REF TO if_wd_context_element.
  DATA ls_nod_pay_info TYPE wd_this->element_nod_pay_info.

  DATA: lo_view       TYPE REF TO if_wd_view,
        lo_tc         TYPE REF TO cl_wd_transparent_container,
        lo_lab        TYPE REF TO cl_wd_label,
        lo_inputfield TYPE REF TO cl_wd_input_field.

  lo_nd_nod_pay_info = wd_context->get_child_node( name = wd_this->wdctx_nod_pay_info ).

*  get element via lead selection
  lo_el_nod_pay_info = lo_nd_nod_pay_info->get_element( ).
*  @TODO handle not set lead selection
  IF lo_el_nod_pay_info IS INITIAL.
  ENDIF.

*  get all declared attributes
  lo_el_nod_pay_info->get_static_attributes(
    IMPORTING
      static_attributes = ls_nod_pay_info ).

  IF ls_nod_pay_info IS NOT INITIAL.
    SELECT SINGLE werks FROM ztrecon_werks
      WHERE werks = @ls_nod_pay_info-werks
      INTO @DATA(lv_werks).
    IF sy-subrc <> 0.
      lo_view ?= wd_this->wd_get_api( ).
      IF lo_view IS NOT INITIAL.
        lo_tc ?= lo_view->get_element( id = 'TRANS_01' ).
        IF lo_tc IS NOT INITIAL.
          lo_lab ?= lo_tc->get_child( id = 'TRANS_01_ZQGDH_LBL' ).
          IF lo_lab IS NOT INITIAL.
            lo_lab->set_visible( value = '02' ).
          ENDIF.
          "发票汇率INPUT
          lo_inputfield ?= lo_tc->get_child( id = 'TRANS_01_ZQGDH').
          IF lo_inputfield IS NOT INITIAL.
            lo_inputfield->set_visible( value = '02' ).
          ENDIF.
        ENDIF.
      ENDIF.
    ENDIF.
  ENDIF.

你可能感兴趣的:(WDA,其他)