2018.03.30 abap屏幕标签保存之前执行过的状态
1 REPORT ZZJX_TEST09. 2 *&---------------------------------------------------------------------* 3 TABLES: T001W,T161,T161T,T024. 4 5 DATA: L_OBJ TYPE REF TO CL_GUI_FRONTEND_SERVICES. 6 DATA: IT_FILE TYPE FILETABLE WITH HEADER LINE. 7 DATA: G_RC TYPE I. 8 DATA: IL_RAW TYPE TRUXS_T_TEXT_DATA. 9 10 11 DATA: G_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE, "字段内表 12 L_LAYOUT TYPE SLIS_LAYOUT_ALV. 13 14 DATA: BEGIN OF GT_UPLOAD OCCURS 0, 15 DATA1(4) TYPE C, 16 DATA2(4) TYPE C, 17 END OF GT_UPLOAD. 18 DATA: BEGIN OF GT_ALV1 OCCURS 0. 19 * INCLUDE STRUCTURE ZMMWERKS1. 20 DATA: STA(4) TYPE C, 21 END OF GT_ALV1. 22 23 DATA: BEGIN OF GT_ALV2 OCCURS 0. 24 * INCLUDE STRUCTURE ZMMWERKS2. 25 DATA: STA(4) TYPE C, 26 END OF GT_ALV2. 27 FIELD-SYMBOLS: <ALV1> LIKE LINE OF GT_ALV1, 28 <ALV2> LIKE LINE OF GT_ALV2. 29 DATA: L_FLAG TYPE I VALUE 1. 30 31 DATA: BEGIN OF L_SIGN, 32 FLAG TYPE I VALUE 1, 33 BUTTON TYPE I VALUE 1, 34 END OF L_SIGN. 35 36 SELECTION-SCREEN BEGIN OF SCREEN 100 AS SUBSCREEN. 37 SELECTION-SCREEN BEGIN OF BLOCK S01 WITH FRAME TITLE TEXT-C01. 38 PARAMETERS: P_RB1 RADIOBUTTON GROUP T1 DEFAULT 'X' USER-COMMAND T1, 39 P_RB2 RADIOBUTTON GROUP T1 . 40 SELECTION-SCREEN END OF BLOCK S01. 41 SELECTION-SCREEN BEGIN OF BLOCK S02 WITH FRAME TITLE TEXT-C02. 42 SELECT-OPTIONS: S_WERKS FOR T001W-WERKS. 43 SELECTION-SCREEN END OF BLOCK S02. 44 SELECTION-SCREEN END OF SCREEN 100. 45 46 SELECTION-SCREEN BEGIN OF SCREEN 200 AS SUBSCREEN. 47 SELECTION-SCREEN BEGIN OF BLOCK S03 WITH FRAME TITLE TEXT-C01. 48 PARAMETERS: P_RB3 RADIOBUTTON GROUP T2 DEFAULT 'X' USER-COMMAND T2, 49 P_RB4 RADIOBUTTON GROUP T2 . 50 SELECTION-SCREEN END OF BLOCK S03. 51 SELECTION-SCREEN BEGIN OF BLOCK S04 WITH FRAME TITLE TEXT-C02. 52 SELECT-OPTIONS: T_WERKS FOR T001W-WERKS, 53 T_BSART FOR T161-BSART MODIF ID M3, 54 T_EKGRP FOR T024-EKGRP MODIF ID M4. 55 SELECTION-SCREEN END OF BLOCK S04. 56 SELECTION-SCREEN END OF SCREEN 200. 57 58 SELECTION-SCREEN BEGIN OF SCREEN 300 AS SUBSCREEN. 59 SELECTION-SCREEN BEGIN OF BLOCK S05 WITH FRAME TITLE TEXT-C01. 60 PARAMETERS: P_RB5 RADIOBUTTON GROUP T3 DEFAULT 'X' USER-COMMAND T3, 61 P_RB6 RADIOBUTTON GROUP T3 . 62 SELECTION-SCREEN END OF BLOCK S05. 63 SELECTION-SCREEN BEGIN OF BLOCK S06 WITH FRAME TITLE TEXT-C02. 64 PARAMETERS: P_FIL1 TYPE RLGRAP-FILENAME MODIF ID M5, 65 P_FIL2 TYPE RLGRAP-FILENAME MODIF ID M6. 66 SELECTION-SCREEN END OF BLOCK S06. 67 68 SELECTION-SCREEN END OF SCREEN 300. 69 70 71 SELECTION-SCREEN: BEGIN OF TABBED BLOCK MYTAB FOR 12 LINES, 72 TAB (25) BUTTON1 USER-COMMAND PUSH1, 73 TAB (25) BUTTON2 USER-COMMAND PUSH2, 74 TAB (25) BUTTON3 USER-COMMAND PUSH3, 75 END OF BLOCK MYTAB. 76 77 INITIALIZATION. 78 BUTTON1 = TEXT-A01. 79 BUTTON2 = TEXT-A02. 80 BUTTON3 = TEXT-A03. 81 MYTAB-PROG = SY-REPID. 82 83 84 IMPORT L_SIGN FROM MEMORY ID 'FLAG'."主要使用内存共享的方式来实现,进入list退出之后保存进去之前的标签 85 CASE L_SIGN-FLAG. 86 WHEN 1. 87 MYTAB-DYNNR = 100. 88 MYTAB-ACTIVETAB = 'PUSH1'. 89 WHEN 2. 90 MYTAB-DYNNR = 200. 91 MYTAB-ACTIVETAB = 'PUSH2'. 92 WHEN 3. 93 MYTAB-DYNNR = 300. 94 MYTAB-ACTIVETAB = 'PUSH3'. 95 ENDCASE. 96 MODIFY SCREEN. 97 FREE MEMORY ID 'FLAG'. 98 99 "为控件页签单击事件, 选择不同页签显示不同子屏幕. 100 101 AT SELECTION-SCREEN. 102 CASE SY-UCOMM. 103 WHEN 'PUSH1'. 104 MYTAB-DYNNR = 100. 105 MYTAB-ACTIVETAB = 'PUSH1'. 106 L_SIGN-FLAG = 1. 107 L_SIGN-BUTTON = 1. 108 WHEN 'PUSH2'. 109 MYTAB-DYNNR = 200. 110 MYTAB-ACTIVETAB = 'PUSH2'. 111 L_SIGN-FLAG = 2. 112 L_SIGN-BUTTON = 2. 113 WHEN 'PUSH3'. 114 MYTAB-DYNNR = 300. 115 MYTAB-ACTIVETAB = 'PUSH3'. 116 L_SIGN-FLAG = 3. 117 L_SIGN-BUTTON = 3. 118 ENDCASE. 119 EXPORT L_SIGN TO MEMORY ID 'FLAG'. 120 121 AT SELECTION-SCREEN OUTPUT. 122 123 LOOP AT SCREEN. 124 CASE SCREEN-GROUP1. 125 WHEN 'M1'. 126 IF P_RB1 IS INITIAL. 127 SCREEN-ACTIVE = '0'. 128 ELSE. 129 SCREEN-ACTIVE = '1'. 130 ENDIF. 131 WHEN 'M2'. 132 IF P_RB2 IS INITIAL. 133 SCREEN-ACTIVE = '0'. 134 ELSE. 135 SCREEN-ACTIVE = '1'. 136 ENDIF. 137 WHEN 'M2'. 138 IF P_RB3 IS INITIAL. 139 SCREEN-ACTIVE = '0'. 140 ELSE. 141 SCREEN-ACTIVE = '1'. 142 ENDIF. 143 WHEN 'M4'. 144 IF P_RB4 IS INITIAL. 145 SCREEN-ACTIVE = '0'. 146 ELSE. 147 SCREEN-ACTIVE = '1'. 148 ENDIF. 149 WHEN 'M5'. 150 IF P_RB5 IS INITIAL. 151 SCREEN-ACTIVE = '0'. 152 ELSE. 153 SCREEN-ACTIVE = '1'. 154 ENDIF. 155 WHEN 'M6'. 156 IF P_RB6 IS INITIAL. 157 SCREEN-ACTIVE = '0'. 158 ELSE. 159 SCREEN-ACTIVE = '1'. 160 ENDIF. 161 ENDCASE. 162 MODIFY SCREEN. 163 ENDLOOP. 164 165 166 AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FIL1. "弹出选择文件对话框 167 CREATE OBJECT L_OBJ. 168 CLEAR IT_FILE[]. 169 CALL METHOD L_OBJ->FILE_OPEN_DIALOG 170 EXPORTING 171 FILE_FILTER = '*.xls;*.xlsx;*.txt' 172 INITIAL_DIRECTORY = 'C:\data' 173 CHANGING 174 FILE_TABLE = IT_FILE[] 175 RC = G_RC. 176 READ TABLE IT_FILE INDEX 1. 177 P_FIL1 = IT_FILE-FILENAME. 178 179 AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FIL2. "弹出选择文件对话框 180 CREATE OBJECT L_OBJ. 181 CLEAR IT_FILE[]. 182 CALL METHOD L_OBJ->FILE_OPEN_DIALOG 183 EXPORTING 184 FILE_FILTER = '*.xls;*.xlsx;*.txt' 185 INITIAL_DIRECTORY = 'C:\data' 186 CHANGING 187 FILE_TABLE = IT_FILE[] 188 RC = G_RC. 189 READ TABLE IT_FILE INDEX 1. 190 P_FIL2 = IT_FILE-FILENAME. 191 192 193 START-OF-SELECTION. 194 195 END-OF-SELECTION. 196 WRITE:/ 'hello'.
F8进去的时候是这样的,出来的时候还是停留在标签3处。