ABAP-折叠窗口

Posted ricoo

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ABAP-折叠窗口相关的知识,希望对你有一定的参考价值。

1.测试

技术分享图片

技术分享图片

 

2.代码

技术分享图片
  1 *&---------------------------------------------------------------------*
  2 *& Report  ZRICO_TEST24
  3 *&
  4 *&---------------------------------------------------------------------*
  5 *&
  6 *&
  7 *&---------------------------------------------------------------------*
  8 report zrico_test24.
  9 
 10 tables:  sscrfields.
 11 data:  g_code type sscrfields-ucomm.  "FUNCTION CODE
 12 
 13 
 14 parameters: p_cb0(1) type c no-display,   "Close Block 0
 15             p_cb1(1) type c no-display.   "Close Block 1
 16 
 17 selection-screen function key 1."expand all blocks
 18 selection-screen function key 2. "collapse all blocks
 19 
 20 ***************** Block 00 *** Description data file
 21 selection-screen: pushbutton /1(60) pushb_o0         "Open Block 00
 22                     user-command ucomm_o0 modif id mo0,     "#EC NEEDED
 23                   pushbutton /1(60) pushb_c0         "Close Block 00
 24                     user-command ucomm_c0 modif id mc0.     "#EC NEEDED
 25 selection-screen begin of block b0 with frame title text-000.
 26 parameters: p_down00 type downloadx as checkbox modif id mc0.
 27 selection-screen end of block b0.
 28 
 29 ***************** Block 01 *** Report 01
 30 selection-screen: pushbutton /1(60) pushb_o1         "Open Block 01
 31                     user-command ucomm_o1 modif id mo1,     "#EC NEEDED
 32                   pushbutton /1(60) pushb_c1         "Close Block 01
 33                     user-command ucomm_c1 modif id mc1.     "#EC NEEDED
 34 selection-screen begin of block b1 with frame title text-001.
 35 parameters: p_rep01 as checkbox modif id mc1."DEFAULT ‘X‘.
 36 parameters: p_var01 like varid-variant modif id mc1.
 37 selection-screen end of block b1.
 38 
 39 initialization.
 40 
 41 * Close Selection-Screen
 42   p_cb0 = X. p_cb1 = X.
 43 * Set Text & Icon for application bar
 44   concatenate icon_expand: Expand all blocks into sscrfields-functxt_01.
 45   concatenate icon_collapse: Collapse all blocks into sscrfields-functxt_02.
 46 
 47 * Set Text & Icon for Pushbutton
 48   concatenate icon_collapse: Block 00 into pushb_c0,
 49                              Block 01 into pushb_c1 .
 50 
 51   concatenate icon_expand: Block 00 into pushb_o0,
 52                            Block 01 into pushb_o1.
 53 
 54 at selection-screen.
 55   g_code = sscrfields-ucomm.
 56   case g_code.
 57 *Expand all blocks
 58     when FC01.
 59       perform expand_all_blocks.
 60 *Collapse all blocks
 61     when FC02.      "Collapse all blocks
 62       perform collapse_all_blocks.
 63 *Open/close individual block functions
 64     when UCOMM_O0.                   "Open Block 0
 65       clear p_cb0.
 66     when UCOMM_C0.                   "Close Block 0
 67       p_cb0 = X.
 68     when UCOMM_O1.                   "Open Block 1
 69       clear p_cb1.
 70     when UCOMM_C1.                   "Close Block 1
 71       p_cb1 = X.
 72   endcase.
 73 
 74 
 75 at selection-screen output.
 76 *modify screen according predefined screen group
 77   loop at screen.
 78     case screen-group1.
 79       when MC0.
 80         perform close_block using: p_cb0 MC0 space.
 81       when MO0.
 82         perform close_block using: p_cb0 MO0 X  .
 83       when MC1.
 84         perform close_block using: p_cb1 MC1 space.
 85       when MO1.
 86         perform close_block using: p_cb1 MO1 X  .
 87       when others.
 88         continue.
 89     endcase.
 90   endloop.
 91 
 92 
 93 *&---------------------------------------------------------------------*
 94 *&      Form  close_block
 95 *&---------------------------------------------------------------------*
 96 form close_block using  value(i_close_block) like p_cb1
 97                         value(i_modify_id) like screen-group1
 98                         value(i_convert) type char1.
 99   if not i_convert is initial.
100     if i_close_block is initial.
101       i_close_block = X.
102     else.
103       clear i_close_block.
104     endif.
105   endif.
106 
107   if ( screen-group1 = i_modify_id )
108   and ( not i_close_block is initial ).
109     screen-active = 0.
110     modify screen.
111   endif.
112 
113 endform.                    "close_block
114 
115 *&---------------------------------------------------------------------*
116 *&      Form  collapse_all_blocks
117 *&---------------------------------------------------------------------*
118 form collapse_all_blocks.
119   p_cb0 = X.p_cb1 = X.
120 endform.                    "collapse_all_blocks
121 
122 *&---------------------------------------------------------------------*
123 *&      Form  expand_all_blocks
124 *&---------------------------------------------------------------------*
125 form expand_all_blocks.
126   clear: p_cb0,p_cb1  .
127 endform.
View Code

 

以上是关于ABAP-折叠窗口的主要内容,如果未能解决你的问题,请参考以下文章

ABAP 子屏幕上的按钮怎么响应

abap关闭弹出子窗口

可折叠工具栏 - 使片段页脚在 Android 中始终可见

Android折叠屏适配基于AutoSize框架适配折叠屏并兼容多窗口模式

vscode 如何快速把折叠的代码块给注释了?

同时开左右两个SAPGUI编辑器显示同一段ABAP代码