【ABAP】选择屏幕折叠效果

代码部分

*&------------------------------------------------------------*
*&程序名:YH032202                                                *
*&程序描述:        选择屏幕折叠                                          *
*&创建人:         银河舰队                                          *
*&创建时间:                                                  *
*&------------------------------------------------------------*
REPORT yh032202."NO STANDARD PAGE HEADING "LINE-SIZE  80
"LINE-COUNT 65(0)        "MESSAGE-ID
TABLESsscrfields.
DATAg_code TYPE sscrfields-ucomm"FUNCTION CODE
PARAMETERSp_cb0(1TYPE NO-DISPLAY"Close Block 0
            p_cb1(1TYPE 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-SCREENPUSHBUTTON /1(60pushb_o0 "Open Block 00
 USER-COMMAND ucomm_o0 MODIF ID mo0,                        "#EC NEEDED
 PUSHBUTTON /1(60pushb_c0 "Close Block 00
 USER-COMMAND ucomm_c0 MODIF ID mc0.                        "#EC NEEDED
SELECTION-SCREEN BEGIN OF BLOCK b0 WITH FRAME TITLE TEXT-000.
PARAMETERSp_down00 TYPE downloadx AS CHECKBOX MODIF ID mc0.
SELECTION-SCREEN END OF BLOCK b0.
***************** Block 01 *** Report 01
SELECTION-SCREENPUSHBUTTON /1(60pushb_o1 "Open Block 01
 USER-COMMAND ucomm_o1 MODIF ID mo1,                        "#EC NEEDED
 PUSHBUTTON /1(60pushb_c1 "Close Block 01
 USER-COMMAND ucomm_c1 MODIF ID mc1.                        "#EC NEEDED
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE TEXT-001.
PARAMETERSp_rep01 AS CHECKBOX MODIF ID mc1."DEFAULT 'X'.
PARAMETERSp_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 USINGp_cb0 'MC0' space.
      WHEN 'MO0'.
        PERFORM close_block USINGp_cb0 'MO0' 'X' .
      WHEN 'MC1'.
        PERFORM close_block USINGp_cb1 'MC1' space.
      WHEN 'MO1'.
        PERFORM close_block USINGp_cb1 'MO1' 'X' .
      WHEN OTHERS.
        CONTINUE.
    ENDCASE.
  ENDLOOP.
*&---------------------------------------------------------------------*
*& Form close_block
*&---------------------------------------------------------------------*
FORM close_block USING VALUE(i_close_blockLIKE p_cb1
 VALUE(i_modify_idLIKE screen-group1
 VALUE(i_convertTYPE 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.
  CLEARp_cb0,p_cb1 .
ENDFORM"expand_all_blocks

 

效果

给TA买糖
共{{data.count}}人
人已赞赏
ABAPSAP

【ABAP】选择屏幕多标签页

2021-3-22 10:43:00

ABAPSAP

【ABAP】为表维护SM30生成事务代码

2021-3-22 11:09:47

0 条回复 A文章作者 M管理员
    暂无讨论,说说你的看法吧
个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索