在前面的模板是单窗口操作的主从窗口模板的代码模板,这人例子模板多窗口穿透显示主从数据的一人代码模板。
此模板主要用于有多人窗口需要穿透显示,并且第个窗口 上可有自定义的输入框、文本等控件及OO ALV等数据显示控件。
例子中涉及到三级主从表穿透显示,一共三人窗口,
1.实现效果
2.创建程序
主程序
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 |
*&********************************************************************* *& PROGRAM NAME : ZMM001 *& Module Name : *& Apply Author : *& Author : *& Started on : 2021-07-15 *& Transaction : ZMM001 *& Program type : Report *& Program ID : ZMM001 *& Program Description : 报表 *&*&******************************************************************* *& REVISION LOG * *& * *& LOG# DATE AUTHOR DESCRIPTION * *&********************************************************************* REPORT zMM001 MESSAGE-ID ztr202. INCLUDE zMM001_top. INCLUDE zMM001_alv_event. INCLUDE zMM001_sel. INCLUDE zMM001_pbo. INCLUDE zMM001_pai. INCLUDE zMM001_form. INCLUDE zMM001_f01. INCLUDE zMM001_f02. |
INCLUDE ZMM001_TOP
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 |
*&---------------------------------------------------------------------* *& 包含 Zmm001_TOP *&---------------------------------------------------------------------* TABLES:ztrs_report_0011_list. *&---------------------------------------------------------------------* *& 包含 ALV全局变量 *&---------------------------------------------------------------------* DATA: go_docker_100 TYPE REF TO cl_gui_docking_container, go_alv_100 TYPE REF TO cl_gui_alv_grid, gt_fcat_100 TYPE lvc_t_fcat, gt_out_100 TYPE TABLE OF ztrs_report_0011_list, gS_out_100 TYPE ztrs_report_0011_list. DATA: go_customer_200 TYPE REF TO cl_gui_custom_container, go_alv_200 TYPE REF TO cl_gui_alv_grid, gt_fcat_200 TYPE lvc_t_fcat, gt_out_200_all TYPE zlttr_report_0011_use_item, gt_out_200 TYPE zlttr_report_0011_use_item, gs_out_200 TYPE LINE OF zlttr_report_0011_use_item. DATA: go_customer_300 TYPE REF TO cl_gui_custom_container, go_alv_300 TYPE REF TO cl_gui_alv_grid, gt_fcat_300 TYPE lvc_t_fcat, gt_out_300_all TYPE zlttr_report_0011_detail_item, gt_out_300 TYPE zlttr_report_0011_detail_item, gs_out_300 TYPE LINE OF zlttr_report_0011_detail_item. *&---------------------------------------------------------------------* *& 屏幕全局变量 *&---------------------------------------------------------------------* "屏幕全局变量 DATA:ok_code TYPE sy-ucomm. DATA:gv_code TYPE sy-ucomm. DATA:gs_use TYPE ztrs_report_0011_use, gs_detail TYPE ztrs_report_0011_detail. *&---------------------------------------------------------------------* *& 其他全局变量 *&---------------------------------------------------------------------* "通用检查类 DATA:go_check TYPE REF TO zcl_tr2_check_common. DATA:gt_list TYPE TABLE OF ztrs_report_0011_list. |
INCLUDE ZMM001_ALV_EVENT
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 |
*&---------------------------------------------------------------------* *& 包含 ZMM001_ALV_EVENT *&---------------------------------------------------------------------* *&---------------------------------------------------------------------* *& CLASS DEFINITION *&---------------------------------------------------------------------* *&---------------------------------------------------------------------* *& Class zcl_alv_hander_100 *&---------------------------------------------------------------------* CLASS zcl_alv_hander_100 DEFINITION. PUBLIC SECTION. METHODS: hand_double_click FOR EVENT double_click OF cl_gui_alv_grid IMPORTING e_row e_column. ENDCLASS. *&---------------------------------------------------------------------* *& Class zcl_alv_hander_200 *&---------------------------------------------------------------------* CLASS zcl_alv_hander_200 DEFINITION. PUBLIC SECTION. METHODS: hand_double_click FOR EVENT double_click OF cl_gui_alv_grid IMPORTING e_row e_column, handle_data_changed FOR EVENT data_changed OF cl_gui_alv_grid IMPORTING er_data_changed. ENDCLASS. *&---------------------------------------------------------------------* *& Class zcl_alv_hander_300 *&---------------------------------------------------------------------* CLASS zcl_alv_hander_300 DEFINITION. PUBLIC SECTION. METHODS: hand_double_click FOR EVENT double_click OF cl_gui_alv_grid IMPORTING e_row e_column. ENDCLASS. *&---------------------------------------------------------------------* *& CLASS IMPLEMENTATION *&---------------------------------------------------------------------* *&---------------------------------------------------------------------* *& Class zcl_alv_hander_100 *&---------------------------------------------------------------------* CLASS zcl_alv_hander_100 IMPLEMENTATION. METHOD hand_double_click. PERFORM alv_double_click_100 USING e_row e_column. ENDMETHOD. ENDCLASS. *&---------------------------------------------------------------------* *& Class zcl_alv_hander_200 *&---------------------------------------------------------------------* CLASS zcl_alv_hander_200 IMPLEMENTATION. METHOD hand_double_click. PERFORM alv_double_click_200 USING e_row e_column. ENDMETHOD. METHOD handle_data_changed. PERFORM fm_data_changed_200 USING er_data_changed. PERFORM fm_refresh_alv_200 USING go_alv_200. ENDMETHOD. ENDCLASS. *&---------------------------------------------------------------------* *& Class zcl_alv_hander_300 *&---------------------------------------------------------------------* CLASS zcl_alv_hander_300 IMPLEMENTATION. METHOD hand_double_click. PERFORM alv_double_click_300 USING e_row e_column. ENDMETHOD. ENDCLASS. DATA:go_event_100 TYPE REF TO zcl_alv_hander_100, go_event_200 TYPE REF TO zcl_alv_hander_200, go_event_300 TYPE REF TO zcl_alv_hander_300. |
INCLUDE ZMM001_SEL
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 |
*&---------------------------------------------------------------------* *& 包含 ZTRR00011_SEL *&---------------------------------------------------------------------* SELECTION-SCREEN BEGIN OF BLOCK BLK1 WITH FRAME TITLE TEXT-101. SELECT-OPTIONS:S_BUKRS FOR ZTRS_REPORT_0011_LIST-BUKRS OBLIGATORY, S_FACORG FOR ZTRS_REPORT_0011_LIST-FAC_ORG, S_IF_NO FOR ZTRS_REPORT_0011_LIST-IF_NO, S_DATUM FOR SY-DATUM NO-EXTENSION NO INTERVALS. SELECTION-SCREEN END OF BLOCK BLK1. SELECTION-SCREEN BEGIN OF BLOCK BLK2 WITH FRAME TITLE TEXT-200. SELECTION-SCREEN BEGIN OF LINE. PARAMETERS: P_CHK10 AS CHECKBOX DEFAULT 'X'."贷款合同 SELECTION-SCREEN COMMENT (30) TEXT-201. PARAMETERS: P_CHK20 AS CHECKBOX DEFAULT 'X'."保函 SELECTION-SCREEN COMMENT (30) TEXT-202. PARAMETERS: P_CHK30 AS CHECKBOX DEFAULT 'X'."内保外贷 SELECTION-SCREEN COMMENT (30) TEXT-203. SELECTION-SCREEN END OF LINE. SELECTION-SCREEN BEGIN OF LINE. PARAMETERS: P_CHK40 AS CHECKBOX DEFAULT 'X'."开立银票 SELECTION-SCREEN COMMENT (30) TEXT-204. PARAMETERS: P_CHK50 AS CHECKBOX DEFAULT 'X'."信用证 SELECTION-SCREEN COMMENT (30) TEXT-205. SELECTION-SCREEN END OF LINE. SELECTION-SCREEN END OF BLOCK BLK2. INITIALIZATION. PERFORM PF_INIT. START-OF-SELECTION. PERFORM GET_DATA. CALL SCREEN 0100. *&---------------------------------------------------------------------* *& Form PF_INIT *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text * <-- p2 text *----------------------------------------------------------------------* FORM PF_INIT . S_DATUM = VALUE #( SIGN = 'I' OPTION = 'LE' LOW = SY-DATUM ). APPEND S_DATUM. ENDFORM. |
INCLUDE ZMM001_PBO
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 |
*&---------------------------------------------------------------------* *& 包含 ZMM001_PBO *&---------------------------------------------------------------------* *&---------------------------------------------------------------------* *& Module STATUS_0100 OUTPUT *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* MODULE STATUS_0100 OUTPUT. SET PF-STATUS 'STATUS_100'. SET TITLEBAR 'TITLE' WITH TEXT-T01. ENDMODULE. *&---------------------------------------------------------------------* *& Module STATUS_0200 OUTPUT *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* MODULE STATUS_0200 OUTPUT. SET PF-STATUS 'STATUS_200'. SET TITLEBAR 'TITLE' WITH TEXT-T02. ENDMODULE. *&---------------------------------------------------------------------* *& Module STATUS_0300 OUTPUT *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* MODULE STATUS_0300 OUTPUT. SET PF-STATUS 'STATUS_300'. SET TITLEBAR 'TITLE' WITH TEXT-T03. ENDMODULE. *&---------------------------------------------------------------------* *& Module INIT_ALV_0100 OUTPUT *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* MODULE INIT_ALV_0100 OUTPUT. DATA: LT_EXCLUDE TYPE UI_FUNCTIONS, LS_VARIANT TYPE DISVARIANT, LS_LAYOUT TYPE LVC_S_LAYO. IF GO_ALV_100 IS INITIAL. PERFORM FRM_EXCLUDE_TB_FUNCTIONS CHANGING LT_EXCLUDE. PERFORM FRM_SET_FIELDCAT USING '1'. CREATE OBJECT GO_DOCKER_100 "创建ALV容器 EXPORTING REPID = SY-REPID DYNNR = '0100' SIDE = CL_GUI_DOCKING_CONTAINER=>DOCK_AT_LEFT "容器贴屏幕左边 EXTENSION = CL_GUI_CONTROL=>WS_MAXIMIZEBOX "容器宽度 STYLE = CL_GUI_CONTROL=>WS_CHILD "可选参数,设置容器是否可用手动拖动大小 EXCEPTIONS CNTL_ERROR = 1 CNTL_SYSTEM_ERROR = 2 CREATE_ERROR = 3 LIFETIME_ERROR = 4 LIFETIME_DYNPRO_DYNPRO_LINK = 5 OTHERS = 6. CREATE OBJECT GO_ALV_100 EXPORTING I_PARENT = GO_DOCKER_100. LS_LAYOUT-CWIDTH_OPT = 'X'. LS_LAYOUT-SEL_MODE = 'A'. LS_VARIANT-REPORT = SY-REPID. CALL METHOD GO_ALV_100->SET_TABLE_FOR_FIRST_DISPLAY EXPORTING IS_LAYOUT = LS_LAYOUT IT_TOOLBAR_EXCLUDING = LT_EXCLUDE I_SAVE = 'U' IS_VARIANT = LS_VARIANT CHANGING IT_FIELDCATALOG = GT_FCAT_100 IT_OUTTAB = GT_OUT_100. CREATE OBJECT GO_EVENT_100. SET HANDLER GO_EVENT_100->HAND_DOUBLE_CLICK FOR GO_ALV_100. CALL METHOD GO_ALV_100->SET_TOOLBAR_INTERACTIVE. ELSE. GO_ALV_100->GET_FRONTEND_LAYOUT( IMPORTING ES_LAYOUT = LS_LAYOUT ). LS_LAYOUT-CWIDTH_OPT = 'X'. GO_ALV_100->SET_FRONTEND_LAYOUT( IS_LAYOUT = LS_LAYOUT ). CALL METHOD GO_ALV_100->REFRESH_TABLE_DISPLAY EXCEPTIONS FINISHED = 1 OTHERS = 2. IF SY-SUBRC <> 0. MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO INTO DATA(MSGTEXT) WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. ENDIF. ENDIF. ENDMODULE. *&---------------------------------------------------------------------* *& Module INIT_ALV_0200 OUTPUT *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* MODULE INIT_ALV_0200 OUTPUT. CLEAR:LS_LAYOUT. IF GO_ALV_200 IS INITIAL. PERFORM FRM_EXCLUDE_TB_FUNCTIONS CHANGING LT_EXCLUDE. PERFORM FRM_SET_FIELDCAT USING '2'. CREATE OBJECT GO_CUSTOMER_200 EXPORTING CONTAINER_NAME = 'CONTAINER_200'. CREATE OBJECT GO_ALV_200 EXPORTING I_PARENT = GO_CUSTOMER_200. LS_LAYOUT-CWIDTH_OPT = 'X'. LS_LAYOUT-SEL_MODE = 'A'. LS_VARIANT-REPORT = SY-REPID. CALL METHOD GO_ALV_200->SET_TABLE_FOR_FIRST_DISPLAY EXPORTING IS_LAYOUT = LS_LAYOUT IT_TOOLBAR_EXCLUDING = LT_EXCLUDE I_SAVE = 'U' IS_VARIANT = LS_VARIANT CHANGING IT_FIELDCATALOG = GT_FCAT_200 IT_OUTTAB = GT_OUT_200. CREATE OBJECT GO_EVENT_200. SET HANDLER GO_EVENT_200->HAND_DOUBLE_CLICK FOR GO_ALV_200. SET HANDLER GO_EVENT_200->HANDLE_DATA_CHANGED FOR GO_ALV_200. CALL METHOD GO_ALV_200->SET_TOOLBAR_INTERACTIVE. CALL METHOD GO_ALV_200->REGISTER_EDIT_EVENT EXPORTING I_EVENT_ID = CL_GUI_ALV_GRID=>MC_EVT_MODIFIED. CALL METHOD GO_ALV_200->REGISTER_EDIT_EVENT EXPORTING I_EVENT_ID = CL_GUI_ALV_GRID=>MC_EVT_ENTER. ELSE. GO_ALV_200->GET_FRONTEND_LAYOUT( IMPORTING ES_LAYOUT = LS_LAYOUT ). LS_LAYOUT-CWIDTH_OPT = 'X'. GO_ALV_200->SET_FRONTEND_LAYOUT( IS_LAYOUT = LS_LAYOUT ). CALL METHOD GO_ALV_200->REFRESH_TABLE_DISPLAY EXCEPTIONS FINISHED = 1 OTHERS = 2. IF SY-SUBRC <> 0. MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO INTO MSGTEXT WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. ENDIF. ENDIF. ENDMODULE. *&---------------------------------------------------------------------* *& Module INIT_ALV_0300 OUTPUT *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* MODULE INIT_ALV_0300 OUTPUT. CLEAR:LS_LAYOUT. IF GO_ALV_300 IS INITIAL. PERFORM FRM_EXCLUDE_TB_FUNCTIONS CHANGING LT_EXCLUDE. PERFORM FRM_SET_FIELDCAT USING '3'. CREATE OBJECT GO_CUSTOMER_300 EXPORTING CONTAINER_NAME = 'CONTAINER_300'. CREATE OBJECT GO_ALV_300 EXPORTING I_PARENT = GO_CUSTOMER_300. LS_LAYOUT-CWIDTH_OPT = 'X'. LS_LAYOUT-SEL_MODE = 'A'. LS_VARIANT-REPORT = SY-REPID. CALL METHOD GO_ALV_300->SET_TABLE_FOR_FIRST_DISPLAY EXPORTING IS_LAYOUT = LS_LAYOUT IT_TOOLBAR_EXCLUDING = LT_EXCLUDE I_SAVE = 'U' IS_VARIANT = LS_VARIANT CHANGING IT_FIELDCATALOG = GT_FCAT_300 IT_OUTTAB = GT_OUT_300. CREATE OBJECT GO_EVENT_300. SET HANDLER GO_EVENT_300->HAND_DOUBLE_CLICK FOR GO_ALV_300. CALL METHOD GO_ALV_300->SET_TOOLBAR_INTERACTIVE. ELSE. GO_ALV_300->GET_FRONTEND_LAYOUT( IMPORTING ES_LAYOUT = LS_LAYOUT ). LS_LAYOUT-CWIDTH_OPT = 'X'. GO_ALV_300->SET_FRONTEND_LAYOUT( IS_LAYOUT = LS_LAYOUT ). CALL METHOD GO_ALV_300->REFRESH_TABLE_DISPLAY EXCEPTIONS FINISHED = 1 OTHERS = 2. IF SY-SUBRC <> 0. MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO INTO MSGTEXT WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. ENDIF. ENDIF. ENDMODULE. |
INCLUDE zMM001_pai
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 |
*&---------------------------------------------------------------------* *& 包含 ZTRR00011_PAI *&---------------------------------------------------------------------* *&---------------------------------------------------------------------* *& Module USER_COMMAND_0100 INPUT *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* MODULE user_command_0100 INPUT. CLEAR:gv_code. gv_code = ok_code. CASE gv_code. WHEN 'BACK' OR 'EXIT'. LEAVE TO SCREEN 0. WHEN 'CANCEL'. LEAVE PROGRAM. WHEN OTHERS. ENDCASE. ENDMODULE. *&---------------------------------------------------------------------* *& Module USER_COMMAND_0200 INPUT *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* MODULE user_command_0200 INPUT. CLEAR:gv_code. gv_code = ok_code. CASE gv_code. WHEN 'BACK' OR 'EXIT'. LEAVE TO SCREEN 0. WHEN 'CANCEL'. LEAVE PROGRAM. WHEN 'SAVE'. PERFORM PF_SAVE_200. WHEN OTHERS. ENDCASE. ENDMODULE. *&---------------------------------------------------------------------* *& Module USER_COMMAND_0300 INPUT *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* MODULE user_command_0300 INPUT. CLEAR:gv_code. gv_code = ok_code. CASE gv_code. WHEN 'BACK' OR 'EXIT'. LEAVE TO SCREEN 0. WHEN 'CANCEL'. LEAVE PROGRAM. WHEN OTHERS. ENDCASE. ENDMODULE. |
INCLUDE ZMM001_FORM
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 |
*&---------------------------------------------------------------------* *& 包含 ZTRR00011_FORM *&---------------------------------------------------------------------* *&---------------------------------------------------------------------* *& Form FRM_EXCLUDE_TB_FUNCTIONS *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * <--P_LT_EXCLUDE text *----------------------------------------------------------------------* FORM FRM_EXCLUDE_TB_FUNCTIONS CHANGING PT_EXCLUDE TYPE UI_FUNCTIONS. INSERT CL_GUI_ALV_GRID=>MC_FC_CHECK INTO TABLE PT_EXCLUDE. INSERT CL_GUI_ALV_GRID=>MC_FC_REFRESH INTO TABLE PT_EXCLUDE. INSERT CL_GUI_ALV_GRID=>MC_FC_LOC_CUT INTO TABLE PT_EXCLUDE. INSERT CL_GUI_ALV_GRID=>MC_FC_LOC_COPY INTO TABLE PT_EXCLUDE. INSERT CL_GUI_ALV_GRID=>MC_FC_LOC_COPY_ROW INTO TABLE PT_EXCLUDE. INSERT CL_GUI_ALV_GRID=>MC_FC_LOC_APPEND_ROW INTO TABLE PT_EXCLUDE. INSERT CL_GUI_ALV_GRID=>MC_FC_LOC_DELETE_ROW INTO TABLE PT_EXCLUDE. INSERT CL_GUI_ALV_GRID=>MC_FC_LOC_INSERT_ROW INTO TABLE PT_EXCLUDE. INSERT CL_GUI_ALV_GRID=>MC_FC_LOC_PASTE INTO TABLE PT_EXCLUDE. INSERT CL_GUI_ALV_GRID=>MC_FC_LOC_PASTE_NEW_ROW INTO TABLE PT_EXCLUDE. INSERT CL_GUI_ALV_GRID=>MC_FC_PRINT INTO TABLE PT_EXCLUDE. INSERT CL_GUI_ALV_GRID=>MC_FC_INFO INTO TABLE PT_EXCLUDE. ENDFORM. *&---------------------------------------------------------------------* *& Form ALV_DOUBLE_CLICK_100 *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * -->P_E_ROW text * -->P_E_COLUMN text *----------------------------------------------------------------------* FORM ALV_DOUBLE_CLICK_100 USING VALUE(PS_ROW) TYPE LVC_S_ROW VALUE(PS_COL) TYPE LVC_S_COL. DATA: L_INDEX TYPE INT4. L_INDEX = PS_ROW-INDEX. READ TABLE GT_OUT_100 INTO GS_OUT_100 INDEX L_INDEX. CHECK SY-SUBRC = 0. PERFORM PF_SHOW_200. ENDFORM. *&---------------------------------------------------------------------* *& Form ALV_DOUBLE_CLICK_200 *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * -->P_E_ROW text * -->P_E_COLUMN text *----------------------------------------------------------------------* FORM ALV_DOUBLE_CLICK_200 USING VALUE(PS_ROW) TYPE LVC_S_ROW VALUE(PS_COL) TYPE LVC_S_COL. DATA: L_INDEX TYPE INT4. L_INDEX = PS_ROW-INDEX. READ TABLE GT_OUT_200 INTO GS_OUT_200 INDEX L_INDEX. CHECK SY-SUBRC = 0. PERFORM PF_SHOW_300. ENDFORM. *&---------------------------------------------------------------------* *& Form ALV_DOUBLE_CLICK_300 *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * -->P_E_ROW text * -->P_E_COLUMN text *----------------------------------------------------------------------* FORM ALV_DOUBLE_CLICK_300 USING VALUE(PS_ROW) TYPE LVC_S_ROW VALUE(PS_COL) TYPE LVC_S_COL. ENDFORM. *&---------------------------------------------------------------------* *& Form FRM_SET_FIELDCAT *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * -->P_0063 text *----------------------------------------------------------------------* FORM FRM_SET_FIELDCAT USING VALUE(P_TYPE). DATA: LT_FIELDCAT TYPE LVC_T_FCAT, LS_FIELDCAT TYPE LINE OF LVC_T_FCAT. DATA: L_TEXT TYPE CHAR10. DATA(STRU_NAME) = SWITCH DD02L-TABNAME( P_TYPE WHEN '1' THEN 'ZTRS_REPORT_0011_LIST' WHEN '2' THEN 'ZTRS_REPORT_0011_USE_ITEM' WHEN '3' THEN 'ZTRS_REPORT_0011_DETAIL_ITEM' ). CALL FUNCTION 'LVC_FIELDCATALOG_MERGE' EXPORTING I_STRUCTURE_NAME = STRU_NAME CHANGING CT_FIELDCAT = LT_FIELDCAT EXCEPTIONS INCONSISTENT_INTERFACE = 1 PROGRAM_ERROR = 2 OTHERS = 3. IF SY-SUBRC <> 0. MESSAGE E104. ENDIF. CASE P_TYPE. WHEN '1'. LOOP AT LT_FIELDCAT INTO LS_FIELDCAT. CASE LS_FIELDCAT-FIELDNAME. WHEN 'BANK_IND_T'. LS_FIELDCAT-NO_OUT = 'X'. WHEN 'FAC_ORG_T'. WHEN 'USED_QUOTA'. L_TEXT = '已使用额度'. LS_FIELDCAT-COLTEXT = L_TEXT. LS_FIELDCAT-SCRTEXT_L = L_TEXT. LS_FIELDCAT-SCRTEXT_M = L_TEXT. LS_FIELDCAT-SCRTEXT_S = L_TEXT. WHEN OTHERS. CONTINUE. ENDCASE. MODIFY LT_FIELDCAT FROM LS_FIELDCAT. ENDLOOP. GT_FCAT_100 = LT_FIELDCAT. WHEN '2'. LOOP AT LT_FIELDCAT INTO LS_FIELDCAT. CASE LS_FIELDCAT-FIELDNAME. WHEN 'ADJUSE_CURR'."调整金额,可编辑 LS_FIELDCAT-EDIT = 'X'. WHEN 'USED_QUOTA'. L_TEXT = '已使用额度'. LS_FIELDCAT-COLTEXT = L_TEXT. LS_FIELDCAT-SCRTEXT_L = L_TEXT. LS_FIELDCAT-SCRTEXT_M = L_TEXT. LS_FIELDCAT-SCRTEXT_S = L_TEXT. WHEN OTHERS. CONTINUE. ENDCASE. MODIFY LT_FIELDCAT FROM LS_FIELDCAT. ENDLOOP. GT_FCAT_200 = LT_FIELDCAT. WHEN '3'. GT_FCAT_300 = LT_FIELDCAT. WHEN OTHERS. ENDCASE. ENDFORM. *&---------------------------------------------------------------------* *& Form GET_DATA *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text * <-- p2 text *----------------------------------------------------------------------* FORM GET_DATA . PERFORM FM_GET_100."得到抬头数据。 PERFORM FM_GET_200." PERFORM FM_GET_300." *按明细更新 PERFORM FM_UPDATE_200. PERFORM FM_UPDATE_100. PERFORM FM_UPDATE_TEXT."更新文本。 ENDFORM. *&---------------------------------------------------------------------* *& Form PF_SHOW_200 *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text * <-- p2 text *----------------------------------------------------------------------* FORM PF_SHOW_200 . *按选择的数据筛选。 GT_OUT_200 = GT_OUT_200_ALL. DELETE GT_OUT_200 WHERE NOT IFA_NO = GS_OUT_100-IFA_NO. MOVE-CORRESPONDING GS_OUT_100 TO GS_USE. GS_USE-QUOTA = GS_OUT_100-APPL_CURR + GS_OUT_100-LOWRISK_CURR." 间融额度 SORT GT_OUT_200 BY IFA_NO FSC_NR. CALL SCREEN 0200. ENDFORM. FORM PF_SHOW_300 . *按选择的数据筛选。 GT_OUT_300 = GT_OUT_300_ALL. DELETE GT_OUT_300 WHERE NOT ( IF_NO = GS_OUT_200-IF_NO AND FSC_NR = GS_OUT_200-FSC_NR ) . MOVE-CORRESPONDING GS_OUT_200 TO GS_DETAIL. SORT GT_OUT_300 BY IF_NO FSC_NR. CALL SCREEN 0300. ENDFORM. |
INCLUDE ZMM001_F01
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 |
*&---------------------------------------------------------------------* *& 包含 Zmm001_F01 *&---------------------------------------------------------------------* FORM FM_GET_100. ENDFORM. FORM FM_GET_200. ENDFORM. FORM FM_GET_300. ENDFORM. FORM FM_UPDATE_200. *按明细更新200 ENDFORM. FORM FM_UPDATE_100. ENDFORM. *&---------------------------------------------------------------------* *& Form FM_UPDATE_TEXT *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text * <-- p2 text *----------------------------------------------------------------------* FORM FM_UPDATE_TEXT . ENDFORM. FORM GET_KURSF USING PV_FOREIGN_WAERS TYPE WAERS PV_LOCAL_WAERS TYPE WAERS PV_KURSF TYPE UKURSP. DATA:LS_EXCH_RATE TYPE BAPI1093_0. CALL FUNCTION 'BAPI_EXCHANGERATE_GETDETAIL' EXPORTING RATE_TYPE = 'M' FROM_CURR = PV_FOREIGN_WAERS TO_CURRNCY = PV_LOCAL_WAERS DATE = SY-DATUM IMPORTING EXCH_RATE = LS_EXCH_RATE. IF LS_EXCH_RATE IS NOT INITIAL. PV_KURSF = LS_EXCH_RATE-EXCH_RATE. ENDIF. ENDFORM. |
include ZTRR00011_F02
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 |
*&---------------------------------------------------------------------* *& 包含 ZTRR00011_F02 *&---------------------------------------------------------------------* *&---------------------------------------------------------------------* *& Form PF_SAVE_200 *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text * <-- p2 text *----------------------------------------------------------------------* FORM PF_SAVE_200 . COMMIT WORK. CALL METHOD GO_ALV_100->REFRESH_TABLE_DISPLAY EXCEPTIONS FINISHED = 1 OTHERS = 2. IF SY-SUBRC <> 0. MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO INTO MSGTEXT WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. ENDIF. ENDFORM. *&---------------------------------------------------------------------* *& Form FM_DATA_CHANGED_200 *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * -->P_ER_DATA_CHANGED text *----------------------------------------------------------------------* FORM FM_DATA_CHANGED_200 USING UO_DATA_CHANGED TYPE REF TO CL_ALV_CHANGED_DATA_PROTOCOL. DATA: LS_OUT_200 TYPE LINE OF ZLTTR_REPORT_0011_USE_ITEM. LOOP AT UO_DATA_CHANGED->MT_MOD_CELLS ASSIGNING FIELD-SYMBOL(<LS_MOD_CELL>). CASE <LS_MOD_CELL>-FIELDNAME. WHEN 'ADJUSE_CURR'."调整金额 CHECK <LS_MOD_CELL>-VALUE IS NOT INITIAL. TRANSLATE <LS_MOD_CELL>-VALUE TO UPPER CASE. CONDENSE <LS_MOD_CELL>-VALUE NO-GAPS. READ TABLE GT_OUT_200 ASSIGNING FIELD-SYMBOL(<ITEM>) INDEX <LS_MOD_CELL>-ROW_ID. IF CL_ABAP_MATCHER=>MATCHES( PATTERN = '^(-?[0-9]\d*(\.\d*[0-9])?)|(-?0\.\d*[0-9])$' TEXT = <LS_MOD_CELL>-VALUE ) = ABAP_TRUE. * WRITE '数字'. ELSE. <LS_MOD_CELL>-VALUE = <ITEM>-ADJUSE_CURR. * WRITE '非数字'. RETURN. ENDIF. *更新100 READ TABLE GT_OUT_100 ASSIGNING FIELD-SYMBOL(<HEAD>) WITH KEY IFA_NO = <ITEM>-IFA_NO BINARY SEARCH. IF SY-SUBRC <> 0 . CONTINUE. ENDIF. WHEN OTHERS. ENDCASE. ENDLOOP. ENDFORM. *&---------------------------------------------------------------------* *& Form FM_REFRESH_ALV_200 *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * -->P_GCL_ALVGRID text *----------------------------------------------------------------------* FORM FM_REFRESH_ALV_200 USING ICL_ALVGRID TYPE REF TO CL_GUI_ALV_GRID. DATA: LS_STBL TYPE LVC_S_STBL, LR_GRID TYPE REF TO CL_GUI_ALV_GRID.. "稳定刷新 LS_STBL-ROW = ABAP_TRUE. "基于行的稳定刷新 LS_STBL-COL = ABAP_TRUE. "基于列稳定刷新 * CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR' "得到当前屏幕上的ALV的句柄 * IMPORTING * e_grid = icl_alvgrid. * CALL METHOD ICL_ALVGRID->REFRESH_TABLE_DISPLAY EXPORTING IS_STABLE = LS_STBL. ENDFORM. |
3.创建TITLE
标题代码:TITLE
标题:&
4.创建GUI状态
创建三个GUI状态,
5.创建窗口
创建三人窗口,
6.完整代码下载
隐藏内容需要支付:¥3
任何问题请联系yan252@163.com
任何问题请联系yan252@163.com