ABAP顾问
分类:
2010-05-25 11:20:32
REPORT z_barry_test NO STANDARD PAGE HEADING .
TABLES: sscrfields.
DATA: g_code TYPE sscrfields-ucomm. "FUNCTION CODE
INCLUDE
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. "expand_all_blocks