ABAP-选择屏幕-折叠窗口1

 

*&---------------------------------------------------------------------*
*& Report  ZRICO_TEST24
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
report zrico_test24.

tables:  sscrfields.
data:  g_code type sscrfields-ucomm.  "FUNCTION CODE


parameters: p_cb0(1) type c no-display,   "Close Block 0
            p_cb1(1) type c no-display.   "Close Block 1

selection-screen function key 1."expand all blocks
selection-screen function key 2. "collapse all blocks

***************** Block 00 *** Description data file
selection-screen: pushbutton /1(60) pushb_o0         "Open Block 00
                    user-command ucomm_o0 modif id mo0,     "#EC NEEDED
                  pushbutton /1(60) pushb_c0         "Close Block 00
                    user-command ucomm_c0 modif id mc0.     "#EC NEEDED
selection-screen begin of block b0 with frame title text-000.
parameters: p_down00 type downloadx as checkbox modif id mc0.
selection-screen end of block b0.

***************** Block 01 *** Report 01
selection-screen: pushbutton /1(60) pushb_o1         "Open Block 01
                    user-command ucomm_o1 modif id mo1,     "#EC NEEDED
                  pushbutton /1(60) pushb_c1         "Close Block 01
                    user-command ucomm_c1 modif id mc1.     "#EC NEEDED
selection-screen begin of block b1 with frame title text-001.
parameters: p_rep01 as checkbox modif id mc1."DEFAULT 'X'.
parameters: p_var01 like varid-variant modif id mc1.
selection-screen end of block b1.

initialization.

* Close Selection-Screen
  p_cb0 = 'X'. p_cb1 = 'X'.
* Set Text & Icon for application bar
  concatenate icon_expand: 'Expand all blocks' into sscrfields-functxt_01.
  concatenate icon_collapse: 'Collapse all blocks' into sscrfields-functxt_02.

* Set Text & Icon for Pushbutton
  concatenate icon_collapse: 'Block 00' into pushb_c0,
                             'Block 01' into pushb_c1 .

  concatenate icon_expand: 'Block 00' into pushb_o0,
                           'Block 01' into pushb_o1.

at selection-screen.
  g_code = sscrfields-ucomm.
  case g_code.
*Expand all blocks
    when 'FC01'.
      perform expand_all_blocks.
*Collapse all blocks
    when 'FC02'.      "Collapse all blocks
      perform collapse_all_blocks.
*Open/close individual block functions
    when 'UCOMM_O0'.                   "Open Block 0
      clear p_cb0.
    when 'UCOMM_C0'.                   "Close Block 0
      p_cb0 = 'X'.
    when 'UCOMM_O1'.                   "Open Block 1
      clear p_cb1.
    when 'UCOMM_C1'.                   "Close Block 1
      p_cb1 = 'X'.
  endcase.


at selection-screen output.
*modify screen according predefined screen group
  loop at screen.
    case screen-group1.
      when 'MC0'.
        perform close_block using: p_cb0 'MC0' space.
      when 'MO0'.
        perform close_block using: p_cb0 'MO0' 'X'  .
      when 'MC1'.
        perform close_block using: p_cb1 'MC1' space.
      when 'MO1'.
        perform close_block using: p_cb1 'MO1' 'X'  .
      when others.
        continue.
    endcase.
  endloop.


*&---------------------------------------------------------------------*
*&      Form  close_block
*&---------------------------------------------------------------------*
form close_block using  value(i_close_block) like p_cb1
                        value(i_modify_id) like screen-group1
                        value(i_convert) type char1.
  if not i_convert is initial.
    if i_close_block is initial.
      i_close_block = 'X'.
    else.
      clear i_close_block.
    endif.
  endif.

  if ( screen-group1 = i_modify_id )
  and ( not i_close_block is initial ).
    screen-active = '0'.
    modify screen.
  endif.

endform.                    "close_block

*&---------------------------------------------------------------------*
*&      Form  collapse_all_blocks
*&---------------------------------------------------------------------*
form collapse_all_blocks.
  p_cb0 = 'X'.p_cb1 = 'X'.
endform.                    "collapse_all_blocks

*&---------------------------------------------------------------------*
*&      Form  expand_all_blocks
*&---------------------------------------------------------------------*
form expand_all_blocks.
  clear: p_cb0,p_cb1  .
endform.

转载:https://www.cnblogs.com/ricoo/p/10184244.html

 

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值