1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 |
*&---------------------------------------------------------------------* *& Report ZFIR0129 *&---------------------------------------------------------------------* *& *&---------------------------------------------------------------------* REPORT ZFIR0129. TABLES:ACDOCA. TYPE-POOLS:ABAP,SLIS,ICON. *---------------------------------------------------------------- *INTERNAL TABLES *---------------------------------------------------------------- TYPES: BEGIN OF I_OUT. INCLUDE STRUCTURE ACDOCA. TYPES: SEL(1) TYPE C, BUDATX TYPE SY-DATUM, TCODE TYPE SY-TCODE, END OF I_OUT. " 输出 DATA:I_ACDOCA TYPE TABLE OF I_OUT WITH HEADER LINE. DATA: FIELDCAT TYPE LVC_T_FCAT WITH HEADER LINE. DATA:GT_BKPF LIKE TABLE OF BKPF WITH HEADER LINE. " *&---------------------------------------------------------------------* *& PROGRAM VARIABLES程序变量 *&---------------------------------------------------------------------* DATA: WA_LAYOUT TYPE LVC_S_LAYO, GT_EVENTS TYPE SLIS_T_EVENT, GS_EVENT LIKE LINE OF GT_EVENTS. DATA: G_GRID TYPE REF TO CL_GUI_ALV_GRID. *&---------------------------------------------------------------------* *& Definition *&---------------------------------------------------------------------* DEFINE FILL_FIELD. CLEAR FIELDCAT. FIELDCAT-FIELDNAME = &1. FIELDCAT-SCRTEXT_L = &2. FIELDCAT-CFIELDNAME = &3. FIELDCAT-OUTPUTLEN = &4. FIELDCAT-EDIT = &5. APPEND FIELDCAT. END-OF-DEFINITION. *---------------------------------------------------------------- * SELECTION-SCREEN *---------------------------------------------------------------- SELECTION-SCREEN: BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001. SELECT-OPTIONS: S_RACCT FOR ACDOCA-RACCT, S_BUDATX FOR ACDOCA-BUDAT, S_BUDAT FOR ACDOCA-BUDAT, S_RBUKRS FOR ACDOCA-RBUKRS, S_USNAM FOR ACDOCA-USNAM . SELECTION-SCREEN: END OF BLOCK B1. *---------------------------------------------------------------- * INITIALIZATION *---------------------------------------------------------------- INITIALIZATION. *---------------------------------------------------------------- * AT SELECTION-SCREEN *---------------------------------------------------------------- AT SELECTION-SCREEN. * PERFORM FRM_AUTHORIZATION_CHECK. *---------------------------------------------------------------- * START-OF-SELECTION *---------------------------------------------------------------- START-OF-SELECTION. PERFORM FRM_GET_DATA. PERFORM FRM_DATA_PROCESS. *---------------------------------------------------------------- *END-OF-SELECTION *---------------------------------------------------------------- END-OF-SELECTION. PERFORM FRM_DISPLAY_DATA. *---------------------------------------------------------------- * *---------------------------------------------------------------- *&---------------------------------------------------------------------* *& Form FRM_GET_DATA *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text * <-- p2 text *----------------------------------------------------------------------* FORM FRM_GET_DATA . SELECT * INTO CORRESPONDING FIELDS OF TABLE I_ACDOCA FROM ACDOCA WHERE RACCT IN S_RACCT AND RBUKRS IN S_RBUKRS AND USNAM IN S_USNAM AND BUDAT IN S_BUDAT . DATA:LV_TIME(15). LOOP AT I_ACDOCA. LV_TIME = I_ACDOCA-TIMESTAMP. I_ACDOCA-BUDATX = LV_TIME+0(8). MODIFY I_ACDOCA. CLEAR:LV_TIME. ENDLOOP. * S_BUDAT FOR ACDOCA-BUDAT, DELETE I_ACDOCA WHERE BUDATX NOT IN S_BUDATX. IF I_ACDOCA[] IS NOT INITIAL. SELECT BUKRS BELNR GJAHR TCODE INTO CORRESPONDING FIELDS OF TABLE GT_BKPF FROM BKPF FOR ALL ENTRIES IN I_ACDOCA WHERE BUKRS = I_ACDOCA-RBUKRS AND BELNR = I_ACDOCA-BELNR AND GJAHR = I_ACDOCA-GJAHR. SORT GT_BKPF BY BUKRS BELNR GJAHR. ENDIF. ENDFORM. " FRM_GET_DATA *&---------------------------------------------------------------------* *& Form FRM_DATA_PROCESS *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text * <-- p2 text *----------------------------------------------------------------------* FORM FRM_DATA_PROCESS . LOOP AT I_ACDOCA ASSIGNING FIELD-SYMBOL(<FS_ACDOCA>). READ TABLE GT_BKPF ASSIGNING FIELD-SYMBOL(<FS_BKPF>) WITH KEY BUKRS = <FS_ACDOCA>-RBUKRS BELNR = <FS_ACDOCA>-BELNR GJAHR = <FS_ACDOCA>-GJAHR. IF SY-SUBRC = 0. <FS_ACDOCA>-TCODE = <FS_BKPF>-TCODE. ENDIF. ENDLOOP. ENDFORM. " FRM_DATA_PROCESS *&---------------------------------------------------------------------* *& Form FRM_DISPLAY_DATA *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text * <-- p2 text *----------------------------------------------------------------------* FORM FRM_DISPLAY_DATA . PERFORM FRM_LAYOUT. PERFORM FRM_FILL_FIELD. PERFORM FRM_BUILD_EVENT. PERFORM FRM_ALV_DISPLAY. ENDFORM. " FRM_DISPLAY_DATA *&---------------------------------------------------------------------* *& Form FRM_LAYOUT *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text * <-- p2 text *----------------------------------------------------------------------* FORM FRM_LAYOUT . CLEAR: WA_LAYOUT."它用来定义ALV报表的整体属性 * WA_LAYOUT-ZEBRA = 'X' ."ZBbra * WA_LAYOUT-DETAILINIT = 'X' . "initial values on detail screen WA_LAYOUT-CWIDTH_OPT = 'X'."优化列宽选项是否设置 * WA_LAYOUT-DETAILTITL = 'Detail Information' ."设置弹出窗口的标题栏 WA_LAYOUT-BOX_FNAME = 'SEL'. * WA_LAYOUT-INFO_FNAME = 'ROWCOLOR'. * WA_LAYOUT-GRID_TITLE = 'Alv grid title test'. ENDFORM. " FRM_LAYOUT *&---------------------------------------------------------------------* *& Form FRM_FILL_FIELD *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text * <-- p2 text *----------------------------------------------------------------------* FORM FRM_FILL_FIELD . REFRESH FIELDCAT. CALL FUNCTION 'LVC_FIELDCATALOG_MERGE' EXPORTING I_STRUCTURE_NAME = 'ACDOCA' CHANGING CT_FIELDCAT = FIELDCAT[]. CLEAR FIELDCAT. FIELDCAT-FIELDNAME = 'BUDATX'. FIELDCAT-SCRTEXT_L = '时戳'. FIELDCAT-CFIELDNAME = ''. FIELDCAT-OUTPUTLEN = '8'. APPEND FIELDCAT. CLEAR FIELDCAT. FIELDCAT-FIELDNAME = 'TCODE'. FIELDCAT-SCRTEXT_L = '事务代码'. FIELDCAT-CFIELDNAME = ''. FIELDCAT-OUTPUTLEN = '20'. APPEND FIELDCAT. * ENDFORM. " FRM_FILL_FIELD *&---------------------------------------------------------------------* *& Form FRM_BUILD_EVENT *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text * <-- p2 text *----------------------------------------------------------------------* FORM FRM_BUILD_EVENT . REFRESH:GT_EVENTS. * CALL FUNCTION 'REUSE_ALV_EVENTS_GET' * EXPORTING * I_LIST_TYPE = 0 * IMPORTING * ET_EVENTS = GT_EVENTS. GS_EVENT-NAME = SLIS_EV_PF_STATUS_SET. GS_EVENT-FORM = 'PF_STATUS'. APPEND GS_EVENT TO GT_EVENTS. CLEAR GS_EVENT. ENDFORM. " FRM_BUILD_EVENT *&---------------------------------------------------------------------* *& Form FRM_ALV_DISPLAY *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text * <-- p2 text *----------------------------------------------------------------------* FORM FRM_ALV_DISPLAY . DATA: IS_VARIANT LIKE DISVARIANT, I_GRID_SETTINGS TYPE LVC_S_GLAY. * I_GRID_SETTINGS-EDT_CLL_CB = 'X'. * IS_VARIANT-VARIANT = P_VARI. CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC' EXPORTING I_CALLBACK_PROGRAM = SY-REPID * I_GRID_SETTINGS = I_GRID_SETTINGS IT_FIELDCAT_LVC = FIELDCAT[] IT_EVENTS = GT_EVENTS * IS_VARIANT = IS_VARIANT I_SAVE = 'A' * I_DEFAULT = 'X' IS_LAYOUT_LVC = WA_LAYOUT * I_GRID_TITLE = 'Alv test-FM' I_CALLBACK_USER_COMMAND = 'USER_COMMAND' TABLES T_OUTTAB = I_ACDOCA EXCEPTIONS OTHERS = 2. ENDFORM. " FRM_ALV_DISPLAY *&---------------------------------------------------------------------* *& Form user_command *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * -->UCOMM text * -->RS_SELFIELD text *----------------------------------------------------------------------* FORM USER_COMMAND USING UCOMM LIKE SY-UCOMM RS_SELFIELD TYPE SLIS_SELFIELD. "#EC CALLED DATA: L_LINE TYPE I, L_INDEX TYPE I. DATA: L_VALID TYPE CHAR01. RS_SELFIELD-REFRESH = 'X'. RS_SELFIELD-COL_STABLE = 'X'. RS_SELFIELD-ROW_STABLE = 'X'. ENDFORM. "user_command *&---------------------------------------------------------------------* *& Form pf_status *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * -->LT_EXTAB text *----------------------------------------------------------------------* FORM PF_STATUS USING LT_EXTAB. "#EC NEEDED SET PF-STATUS 'MENU'."SAPLKKBL STANDARD "SET PF-STATUS 'MENU_01'."SAPLKKBL STANDARD ENDFORM. "PF_STATUS *&---------------------------------------------------------------------* *& Form frm_authorization_check *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text * <-- p2 text *----------------------------------------------------------------------* FORM FRM_AUTHORIZATION_CHECK . ENDFORM. " frm_authorization_check |
暂无讨论,说说你的看法吧