SAP动态树程序Dialog ALV报表

更新时间:2024-05-01 09:44:02 阅读量: 综合文库 文档下载

说明:文章内容仅供预览,部分内容可能不全。下载后的文档,内容与下面显示的完全一致。下载之前请确认下面内容是否您想要的,是否完整无缺。

SAP动态树程序Dialog ALV报表

--Author:SUNZK QQ:1131341075 微信:DreamSunlight88

REPORT ZFIR_1027.

INCLUDE ZFIR_1027_TOP.

INCLUDE ZFIR_1027_CLS.

INCLUDE ZFIR_1027_SEL.

INCLUDE ZFIR_1027_O01.

INCLUDE ZFIR_1027_I01.

INCLUDE ZFIR_1027_F01.

*&---------------------------------------------------------------------*

*& 包含 ZFIR_1026_TOP

*&---------------------------------------------------------------------*

TYPE-POOLS:KKBLO .

TABLES:T001,T012K,TCJ_POSITIONS ,ZFIT1011 , SSCRFIELDS,BKPF,ISELLIST,TCJ_DOCUMENTS.

TYPES: BEGIN OF TY_TAB .

INCLUDE TYPE ZFIT1011 . TYPES: BANKA TYPE BNKA-BANKA , HBKID TYPE T012K-HBKID , BCJNR TYPE T012K-BCJNR, ZJLB TYPE CHAR20 , \资金类别 KHHT TYPE CHAR20 , \开户行描述

QCZHYE TYPE FDBL_DE_S ,\期初帐户余额 (2015-05-01)

SRZJ_01 TYPE FDBL_DE_S , \运维收入

SRZJ_02 TYPE FDBL_DE_S , \咨询&技术服务收入 SRZJ_03 TYPE FDBL_DE_S , \软件收入 SRZJ_04 TYPE FDBL_DE_S , \培训收入 SRZJ_05 TYPE FDBL_DE_S , \备用金收入 SRZJ_06 TYPE FDBL_DE_S , \其他收入

SRZJ_07 TYPE FDBL_DE_S , \运营资金—昆明(收) SRZJ_08 TYPE FDBL_DE_S , \运营资金—上海(收) SRZJ_09 TYPE FDBL_DE_S , \利息收入

SRZJ_10 TYPE FDBL_DE_S , \其他货币资金 SRZJ_11 TYPE FDBL_DE_S , \筹资收入 SRZJ_12 TYPE FDBL_DE_S , \借款

SRZJ_13 TYPE FDBL_DE_S , \归还借款(收) SRZJ_14 TYPE FDBL_DE_S , \提取差旅费(收) SRZJ_15 TYPE FDBL_DE_S , \提取备用金(收) SRZJ_16 TYPE FDBL_DE_S , \退款 SRZJ_17 TYPE FDBL_DE_S , \保证金 SRZJ_18 TYPE FDBL_DE_S , \一般户备用金 SRZJ_19 TYPE FDBL_DE_S , \运营资金—北京(收) SRZJ_XJ TYPE FDBL_DE_S , \收入小计

ZCZJ_01 TYPE FDBL_DE_S ,\报销款

ZCZJ_02 TYPE FDBL_DE_S ,\租房合同—领导租房 ZCZJ_03 TYPE FDBL_DE_S ,\工资 ZCZJ_04 TYPE FDBL_DE_S ,\预借差旅费 ZCZJ_05 TYPE FDBL_DE_S ,\预借报销款 ZCZJ_06 TYPE FDBL_DE_S ,\其他预借款 ZCZJ_07 TYPE FDBL_DE_S ,\合同付款

ZCZJ_08 TYPE FDBL_DE_S ,\培训费(员工福利) ZCZJ_09 TYPE FDBL_DE_S ,\培训费 (对公free) ZCZJ_10 TYPE FDBL_DE_S ,\办公室装修费 ZCZJ_11 TYPE FDBL_DE_S ,\办公室房租 ZCZJ_12 TYPE FDBL_DE_S ,\转款手续费 ZCZJ_13 TYPE FDBL_DE_S ,\采购软件 ZCZJ_14 TYPE FDBL_DE_S ,\软件服务费 ZCZJ_15 TYPE FDBL_DE_S ,\其他库存采购支出 ZCZJ_16 TYPE FDBL_DE_S ,\工资(代发) ZCZJ_17 TYPE FDBL_DE_S ,\社保四险/医保险 ZCZJ_18 TYPE FDBL_DE_S ,\公积金 ZCZJ_19 TYPE FDBL_DE_S ,\残保金 ZCZJ_20 TYPE FDBL_DE_S ,\个人所得税 ZCZJ_21 TYPE FDBL_DE_S ,\工会经费

ZCZJ_22 TYPE FDBL_DE_S ,\社保代理/劳务派遣费 ZCZJ_23 TYPE FDBL_DE_S ,\差旅费 ZCZJ_24 TYPE FDBL_DE_S ,\机票款

ZCZJ_25 TYPE FDBL_DE_S ,\所得税(含汇算清缴) ZCZJ_26 TYPE FDBL_DE_S ,\增值税 ZCZJ_27 TYPE FDBL_DE_S ,\附加税 ZCZJ_28 TYPE FDBL_DE_S ,\印花税

ZCZJ_29 TYPE FDBL_DE_S ,\一般户备用金(机票款,支) ZCZJ_30 TYPE FDBL_DE_S ,\租房预借款 ZCZJ_31 TYPE FDBL_DE_S ,\车位租金 ZCZJ_32 TYPE FDBL_DE_S ,\电费(办公室)

ZCZJ_33 TYPE FDBL_DE_S ,\水费(办公室) ZCZJ_34 TYPE FDBL_DE_S ,\其他租赁费(办公室) ZCZJ_35 TYPE FDBL_DE_S ,\采购固定资产 ZCZJ_36 TYPE FDBL_DE_S ,\保险费 ZCZJ_37 TYPE FDBL_DE_S ,\购办公用品 ZCZJ_38 TYPE FDBL_DE_S ,\其他 ZCZJ_39 TYPE FDBL_DE_S ,\律师费

ZCZJ_40 TYPE FDBL_DE_S ,\运营资金—上海(支) ZCZJ_41 TYPE FDBL_DE_S ,\运营资金—昆明(支) ZCZJ_42 TYPE FDBL_DE_S ,\支取备用金 ZCZJ_43 TYPE FDBL_DE_S ,\支取差旅费 ZCZJ_44 TYPE FDBL_DE_S ,\其他服务费 ZCZJ_45 TYPE FDBL_DE_S ,\服务费(支) ZCZJ_46 TYPE FDBL_DE_S ,\保证金

ZCZJ_47 TYPE FDBL_DE_S ,\归还借款(支) ZCZJ_48 TYPE FDBL_DE_S ,\奖金 ZCZJ_49 TYPE FDBL_DE_S ,\利息支出 ZCZJ_50 TYPE FDBL_DE_S ,\付支付宝备用金 ZCZJ_51 TYPE FDBL_DE_S ,\运营资金-北京(支)

ZCZJ_XJ TYPE FDBL_DE_S ,\支出小计 QMYE TYPE FDBL_DE_S ,\支出小计 ZHJ TYPE FDBL_DE_S .\合计 TYPES: END OF TY_TAB .

DATA:BEGIN OF GT_TCJ_POSITIONS OCCURS 0 . INCLUDE TYPE TCJ_POSITIONS .

DATA: TRANSACT_NAME TYPE TCJ_TRANS_NAMES-TRANSACT_NAME , * NUM TYPE CHAR4 ,

* ORT01 TYPE T001-ORT01 ,

HBKID TYPE T012K-HBKID , \帐号 * FUNAC TYPE T012K-FUNAC , \资金性质 * FUNACT TYPE ZFIE1002-FUNACT , \资金性质描述 ACATR TYPE T012K-ACATR , \资金类别明细 ACATRT TYPE ZFIE1002-ACATRT , \账户性质描述 * TEXT1 TYPE T012T-TEXT1 , \银行账户描述 BANKA TYPE BNKA-BANKA , \银行账户描述 CLASS TYPE CHAR20 .

* CSHYE TYPE FAGL_BALANCE_LINE-DEBIT, * QCYE TYPE FAGL_BALANCE_LINE-DEBIT, * CSHRQ TYPE BKPF-BUDAT DATA:END OF GT_TCJ_POSITIONS .

\

------

* ALV实列

DATA: GC_ALVGRID100 TYPE REF TO CL_GUI_ALV_GRID.

* 客户容器

DATA: GC_CCONTAINER100 TYPE REF TO CL_GUI_CUSTOM_CONTAINER, GO_TREE100 TYPE REF TO CL_GUI_COLUMN_TREE, GV_CONT_100 TYPE SCRFNAME VALUE 'ALV100', * ALV字段设置

GT_FIELDCAT100 TYPE LVC_T_FCAT, GS_FIELDCAT100 TYPE LVC_S_FCAT, * ALV布局

GS_LAYOUT100 TYPE LVC_S_LAYO, GT_SORT100 TYPE LVC_T_SORT, GS_SORT100 TYPE LVC_S_SORT, GT_UIFUNCTION100 TYPE UI_FUNCTIONS.

*----------------------------------------------------------------------*

* DOI varibles

*----------------------------------------------------------------------*

DATA: INITIALIZED(1),

SPLITTER TYPE REF TO CL_GUI_SPLITTER_CONTAINER, CONTAINER TYPE REF TO CL_GUI_CONTAINER,

CONTROL TYPE REF TO I_OI_CONTAINER_CONTROL, DOCUMENT TYPE REF TO I_OI_DOCUMENT_PROXY, FILENAME LIKE RLGRAP-FILENAME , RETCODE TYPE SOI_RET_STRING,

SPREADSHEET TYPE REF TO I_OI_SPREADSHEET, ERROR TYPE REF TO I_OI_ERROR,

ERRORS TYPE REF TO I_OI_ERROR OCCURS 0 WITH HEADER LINE, APP TYPE VRM_ID,

BDS_INSTANCE TYPE REF TO CL_BDS_DOCUMENT_SET, DOC_SIGNATURE TYPE SBDST_SIGNATURE,

WA_DOC_SIGNATURE LIKE LINE OF DOC_SIGNATURE, DOC_COMPONENTS TYPE SBDST_COMPONENTS, DOC_URIS TYPE SBDST_URI,

WA_DOC_URIS LIKE LINE OF DOC_URIS, EXCEL(80) VALUE 'Excel.Sheet', RANGES TYPE SOI_RANGE_LIST, RANGEITEM TYPE SOI_RANGE_ITEM, EXCEL_INPUT TYPE SOI_GENERIC_TABLE, EXCEL_INPUT_WA TYPE SOI_GENERIC_ITEM, TABLENAME(10),

OKCODE(15), ROW(4), COLUMN(4), DATA(39),

DOCUMENT_TYPE(80), ITEM_URL(256).

DATA:BEGIN OF GT_CULUMN OCCURS 0 , NAME TYPE TV_ITMNAME, TEXT TYPE TV_HEADING , END OF GT_CULUMN .

DATA:BEGIN OF GT_T012 OCCURS 0 . INCLUDE TYPE T012 . DATA: BANKA TYPE BNKA-BANKA . DATA:END OF GT_T012 .

DATA:BEGIN OF GT_SUB_ALV OCCURS 0 . INCLUDE TYPE TCJ_POSITIONS . DATA: END OF GT_SUB_ALV .

DATA: BEGIN OF IT_TAB OCCURS 0, FLAG(1),

AREANO(5) TYPE N ,

TABCONTENT TYPE ZTAB_EXCEL , END OF IT_TAB.

DATA: BEGIN OF ITAB OCCURS 0.

INCLUDE STRUCTURE ALSMEX_TABLINE. DATA: END OF ITAB.

RANGES:R_BUKRS FOR T001-BUKRS .

DATA:GV_FLAG TYPE C ,

EV_REGCT TYPE ZFINODID, GV_NUM TYPE CHAR3 , G_VALUE TYPE STRING .

DATA:GT_HIERARCHY TYPE SOI_HIERARCHY_TABLE.

DATA:GT_T001 TYPE T001 OCCURS 0 WITH HEADER LINE , GT_T012K TYPE TABLE OF T012K WITH HEADER LINE , GT_ZFIE1002 TYPE TABLE OF ZFIE1002 WITH HEADER LINE .

TYPES:TT_DEMO_ITEM TYPE STANDARD TABLE OF DEMO_ITEM, TT_ZFIT1011 TYPE STANDARD TABLE OF ZFIT1011, TT_TAB TYPE STANDARD TABLE OF TY_TAB , TY_DEMO_ITEM TYPE DEMO_ITEM, TY_ZFIT1011 TYPE ZFIT1011.

DATA:GT_NODE_TAB TYPE TREEV_NTAB,

GT_ITEM_TAB TYPE STANDARD TABLE OF DEMO_ITEM, GT_ZFIT1011 TYPE TABLE OF ZFIT1011, GT_TAB TYPE TT_TAB , WT_TAB TYPE TT_TAB , GS_TAB TYPE TY_TAB, WS_TAB TYPE TY_TAB .

FIELD-SYMBOLS: TYPE ZFIT1011.

DATA:GT_TCJ_DOCUMENTS TYPE TCJ_DOCUMENTS OCCURS 0 WITH HEADER LINE, GT_TCJ_TRANSACTIONS TYPE TCJ_TRANSACTIONS OCCURS 0 WITH HEADER LINE ,

GT_TCJ_TRANS_NAMES TYPE TCJ_TRANS_NAMES OCCURS 0 WITH HEADER LINE ,

GT_BNKA TYPE BNKA OCCURS 0 WITH HEADER LINE .

*----------------------------------------------------------------------*

* ALV related

*-----------------------------------------------------------------------*

DATA: GT_SUB_FIELDCAT TYPE LVC_T_FCAT. DATA: GT_FIELDCAT TYPE LVC_T_FCAT, IT_FIELDCAT TYPE LVC_T_FCAT, IS_FIELDCAT TYPE LVC_S_FCAT,

IT_EVENTS TYPE SLIS_T_EVENT WITH HEADER LINE, IT_SUB_EVENTS TYPE SLIS_T_EVENT WITH HEADER LINE, GS_LAYOUT TYPE LVC_S_LAYO,

IT_SORT TYPE SLIS_T_SORTINFO_ALV, IT_PRINT TYPE SLIS_PRINT_ALV, G_GRID TYPE REF TO CL_GUI_ALV_GRID. DATA: G_REPID LIKE SY-REPID, GT_LAYOUT_ALV TYPE LVC_S_LAYO.

DATA: WA_SORT TYPE SLIS_SORTINFO_ALV, GT_SORT TYPE LVC_T_SORT, GS_T012K TYPE T012K.

DATA: LR_GRID TYPE REF TO CL_GUI_ALV_GRID.

DATA: G_LAYOUT TYPE SLIS_LAYOUT_ALV, TITLE TYPE LVC_TITLE, IVARIANT LIKE DISVARIANT.

DATA FNAME(20).

*--------------------------------------------------------------------*

* FIELD symbols

*--------------------------------------------------------------------*

FIELD-SYMBOLS: TYPE ANY, TYPE ANY .

FIELD-SYMBOLS: LIKE GT_TCJ_POSITIONS. FIELD-SYMBOLS: TYPE TY_TAB .

*&---------------------------------------------------------------------*

*& 包含 ZFIR_1026_CLS

*&---------------------------------------------------------------------*

*----------------------------------------------------------------------*

* INCLUDE BCALV_TOOLBAR_EVENT_RECEIVER *

*----------------------------------------------------------------------*

CLASS LCL_EVENT_RECEIVER DEFINITION.

PUBLIC SECTION. METHODS:

CONSTRUCTOR IMPORTING HANDLE TYPE REF TO CL_GUI_COLUMN_TREE CB_NODE_DOUBLE_CLICK TYPE RS38L_FNAM,

HANDLE_ITEM_DOUBLE_CLICK FOR EVENT ITEM_DOUBLE_CLICK OF CL_GUI_COLUMN_TREE

IMPORTING NODE_KEY ITEM_NAME.

PRIVATE SECTION.

DATA: TREE_HANDLE TYPE REF TO CL_GUI_COLUMN_TREE. DATA: TREE_CB_NODE_DOUBLE_CLICK TYPE RS38L_FNAM.

ENDCLASS. \ *----------------------------------------------------------------------*

* CLASS LCL_EVENT_RECEIVER IMPLEMENTATION

*----------------------------------------------------------------------* *

*--------------------------------------------------------------------

--*

CLASS LCL_EVENT_RECEIVER IMPLEMENTATION . METHOD CONSTRUCTOR. TREE_HANDLE = HANDLE.

TREE_CB_NODE_DOUBLE_CLICK = CB_NODE_DOUBLE_CLICK. ENDMETHOD. \ METHOD HANDLE_ITEM_DOUBLE_CLICK. DATA:LV_NODID TYPE ZFINODID . DATA:LV_ITEM_NAME TYPE NAME1 .

DATA:LS_TCJ_POSITIONS LIKE LINE OF GT_TCJ_POSITIONS . DATA:LS_SUB_ALV LIKE LINE OF GT_SUB_ALV . DATA:LV_1 TYPE STRING , LV_2 TYPE STRING , LV_3 TYPE STRING , LV_4 TYPE STRING .

* BREAK AB_LUOFY.

CLEAR :LV_NODID,LV_ITEM_NAME. LV_NODID = NODE_KEY . LV_ITEM_NAME = ITEM_NAME .

READ TABLE GT_TAB WITH KEY NODID = LV_NODID TRANSPORTING NO FIELDS.

IF SY-SUBRC = 0.

CLEAR: GT_SUB_ALV ,GS_TAB. REFRESH:WT_TAB ,GT_SUB_ALV.

PERFORM FRM_GET_CLICK_DATA USING LV_NODID . \使用递归找寻下级数据

LOOP AT WT_TAB INTO GS_TAB .

LOOP AT GT_TCJ_POSITIONS INTO LS_TCJ_POSITIONS WHERE COMP_CODE = GS_TAB-BUKRS \公司代码

AND HBKID = GS_TAB-HBKID \银行CODE

AND CAJO_NUMBER = GS_TAB-BCJNR . \银行描述 IF GS_TAB-RCFLG = 'X'.

CHECK LS_TCJ_POSITIONS-NODID IS NOT INITIAL . ELSE.

CHECK LS_TCJ_POSITIONS-NODID IS INITIAL . ENDIF.

IF LV_ITEM_NAME = 'ZHJ' OR LV_ITEM_NAME = 'NODID'. \合计项不做限制

ELSE.

SPLIT LV_ITEM_NAME AT '_' INTO LV_1 LV_2 . \分割出资金类别,资金类别明细

SPLIT LS_TCJ_POSITIONS-CLASS AT '_' INTO LV_3 LV_4 . \

分割出资金类别,资金类别明细

CONDENSE:LV_1,LV_2,LV_3,LV_4 NO-GAPS . CHECK LV_1 = LV_3 . \检查出资金类别 IF LV_2 = 'XJ' . ELSE.

CHECK LV_2 = LV_4 . ENDIF. ENDIF.

GS_TAB-NODID = LS_TCJ_POSITIONS-NODID . \区域中心标识. MOVE-CORRESPONDING LS_TCJ_POSITIONS TO LS_SUB_ALV . APPEND LS_SUB_ALV TO GT_SUB_ALV . CLEAR LS_SUB_ALV. ENDLOOP. ENDLOOP.

SORT GT_SUB_ALV BY COMP_CODE CAJO_NUMBER FISC_YEAR POSTING_NUMBER POSITION_NUMBER.

DELETE ADJACENT DUPLICATES FROM GT_SUB_ALV COMPARING COMP_CODE CAJO_NUMBER FISC_YEAR POSTING_NUMBER POSITION_NUMBER.

IF GT_SUB_ALV[] IS NOT INITIAL. PERFORM FRM_SUB_FIELDCAT . PERFORM FRM_SUB_EVENTS . PERFORM FRM_SUB_ALV . ENDIF.

ENDIF.

ENDMETHOD. \ ENDCLASS. \ DATA:GO_APPLICATION TYPE REF TO LCL_EVENT_RECEIVER.

*----------------------------------------------------------------------*

* --> p1 参数:1 列 2 行 3 值

* <-- p2 作用:填充excel

*----------------------------------------------------------------------*

DEFINE HFILL-CELL. ITAB-COL = &1. ITAB-ROW = &2. IF &4 = 'X'.

IF &3 < 0 . CLEAR G_VALUE. G_VALUE = ABS( &3 ).

CONCATENATE '-' G_VALUE INTO G_VALUE . CONDENSE G_VALUE NO-GAPS . MOVE G_VALUE TO ITAB-VALUE. ELSE.

MOVE &3 TO ITAB-VALUE. ENDIF. ELSE.

MOVE &3 TO ITAB-VALUE. ENDIF.

APPEND ITAB. CLEAR ITAB. END-OF-DEFINITION.

*&---------------------------------------------------------------------*

*& 包含 ZFIR_1026_SEL

*&---------------------------------------------------------------------*

SELECTION-SCREEN BEGIN OF BLOCK BLK1 WITH FRAME TITLE K1.

SELECT-OPTIONS: S_BUKRS FOR BKPF-BUKRS OBLIGATORY,

S_BUDAT FOR ISELLIST-BDATE DEFAULT SY-DATUM OBLIGATORY NO INTERVALS NO-EXTENSION.

SELECTION-SCREEN END OF BLOCK BLK1.

START-OF-SELECTION. REFRESH GT_T012K[]. EV_REGCT = 'GI' .

SELECT * INTO TABLE GT_ZFIT1011 FROM ZFIT1011 WHERE BUKRS IN S_BUKRS

OR NODID = 'GI'. IF S_BUKRS IS NOT INITIAL.

LOOP AT GT_ZFIT1011 ASSIGNING WHERE BUKRS IS INITIAL. -DWNOD = S_BUKRS-LOW. ENDLOOP. ENDIF.

IF GT_ZFIT1011[] IS INITIAL .

MESSAGE '请先维护资金ZFIT1011' TYPE 'S' DISPLAY LIKE 'E' . LEAVE LIST-PROCESSING .

ENDIF.

* assign event handlers in the application class to each desired event

\

CLEAR:LT_EVENTS,LS_EVENT.

LS_EVENT-EVENTID = CL_GUI_COLUMN_TREE=>EVENTID_ITEM_DOUBLE_CLICK.

LS_EVENT-APPL_EVENT = 'X'. APPEND LS_EVENT TO LT_EVENTS.

CALL METHOD GO_TREE100->SET_REGISTERED_EVENTS EXPORTING

EVENTS = LT_EVENTS EXCEPTIONS

CNTL_ERROR = 1 CNTL_SYSTEM_ERROR = 2 ILLEGAL_EVENT_COMBINATION = 3. IF SY-SUBRC <> 0. * MESSAGE A000. ENDIF.

IF GO_APPLICATION IS NOT INITIAL.

SET HANDLER GO_APPLICATION->HANDLE_ITEM_DOUBLE_CLICK FOR GO_TREE100. ENDIF.

***********************add ****************************

* build data

PERFORM BUILD_NODE_AND_ITEM_TABLE USING GT_ZFIT1011

CHANGING GT_NODE_TAB GT_ITEM_TAB.

*-- 为tree添加节点

CALL METHOD GO_TREE100->ADD_NODES_AND_ITEMS EXPORTING

NODE_TABLE = GT_NODE_TAB[] ITEM_TABLE = GT_ITEM_TAB[] ITEM_TABLE_STRUCTURE_NAME = 'DEMO_ITEM' EXCEPTIONS

FAILED = 1

CNTL_SYSTEM_ERROR = 3 ERROR_IN_TABLES = 4 DP_ERROR = 5 TABLE_STRUCTURE_NAME_NOT_FOUND = 6.

CALL METHOD GO_TREE100->EXPAND_ROOT_NODES * EXPORTING

* level_count = * expand_subtree = EXCEPTIONS

FAILED = 1 ILLEGAL_LEVEL_COUNT = 2 CNTL_SYSTEM_ERROR = 3 OTHERS = 4. IF SY-SUBRC <> 0.

* Implement suitable error handling here ENDIF.

CALL METHOD CL_GUI_CFW=>FLUSH.

ENDIF.

ENDFORM. \

*&---------------------------------------------------------------------*

*& Form FRM_BUILD_FIELDCAT

*&---------------------------------------------------------------------*

* text

*----------------------------------------------------------------------*

* --> p1 text * <-- p2 text

*----------------------------------------------------------------------*

FORM FRM_BUILD_FIELDCAT . DATA:LV_NAME TYPE TV_ITMNAME, LV_TEXT TYPE TV_HEADING . REFRESH GT_CULUMN. LV_NAME = 'ZJLB'. LV_TEXT = '资金类别' .

PERFORM FRM_ADD_COLUMN USING LV_NAME LV_TEXT . LV_NAME = 'KHHT'.

LV_TEXT = '开户行描述' .

PERFORM FRM_ADD_COLUMN USING LV_NAME LV_TEXT . LV_NAME = 'QCZHYE'.

LV_TEXT = '期初帐户余额 (2015-05-01)' .

PERFORM FRM_ADD_COLUMN USING LV_NAME LV_TEXT . LV_NAME = 'SRZJ_01'.

LV_TEXT = '运维收入' .

PERFORM FRM_ADD_COLUMN USING LV_NAME LV_TEXT . LV_NAME = 'SRZJ_02'.

LV_TEXT = '咨询&技术服务收入' .

PERFORM FRM_ADD_COLUMN USING LV_NAME LV_TEXT . LV_NAME = 'SRZJ_03'.

LV_TEXT = '软件收入' .

PERFORM FRM_ADD_COLUMN USING LV_NAME LV_TEXT . LV_NAME = 'SRZJ_04'.

LV_TEXT = '培训收入' .

PERFORM FRM_ADD_COLUMN USING LV_NAME LV_TEXT . LV_NAME = 'SRZJ_05'.

LV_TEXT = '备用金收入' .

PERFORM FRM_ADD_COLUMN USING LV_NAME LV_TEXT . LV_NAME = 'SRZJ_06'.

LV_TEXT = '其他收入' .

PERFORM FRM_ADD_COLUMN USING LV_NAME LV_TEXT . LV_NAME = 'SRZJ_07'.

LV_TEXT = '运营资金—昆明(收)' .

PERFORM FRM_ADD_COLUMN USING LV_NAME LV_TEXT . LV_NAME = 'SRZJ_08'.

LV_TEXT = '运营资金—上海(收)' .

PERFORM FRM_ADD_COLUMN USING LV_NAME LV_TEXT . LV_NAME = 'SRZJ_09'.

LV_TEXT = '利息收入' .

PERFORM FRM_ADD_COLUMN USING LV_NAME LV_TEXT . LV_NAME = 'SRZJ_10'.

LV_TEXT = '其他货币资金' .

PERFORM FRM_ADD_COLUMN USING LV_NAME LV_TEXT . LV_NAME = 'SRZJ_11'.

LV_TEXT = '筹资收入' .

PERFORM FRM_ADD_COLUMN USING LV_NAME LV_TEXT . LV_NAME = 'SRZJ_12'.

LV_TEXT = '借款' .

PERFORM FRM_ADD_COLUMN USING LV_NAME LV_TEXT . LV_NAME = 'SRZJ_13'.

LV_TEXT = '归还借款(收)' .

PERFORM FRM_ADD_COLUMN USING LV_NAME LV_TEXT . LV_NAME = 'SRZJ_14'.

LV_TEXT = '提取差旅费(收)' .

PERFORM FRM_ADD_COLUMN USING LV_NAME LV_TEXT . LV_NAME = 'SRZJ_15'.

LV_TEXT = '提取备用金(收)' .

PERFORM FRM_ADD_COLUMN USING LV_NAME LV_TEXT . LV_NAME = 'SRZJ_16'.

LV_TEXT = '退款' .

PERFORM FRM_ADD_COLUMN USING LV_NAME LV_TEXT . LV_NAME = 'SRZJ_17'.

LV_TEXT = '保证金收入' .

PERFORM FRM_ADD_COLUMN USING LV_NAME LV_TEXT . LV_NAME = 'SRZJ_18'.

LV_TEXT = '一般户备用金' .

PERFORM FRM_ADD_COLUMN USING LV_NAME LV_TEXT . LV_NAME = 'SRZJ_19'.

LV_TEXT = '运营资金—北京(收)' .

PERFORM FRM_ADD_COLUMN USING LV_NAME LV_TEXT . LV_NAME = 'SRZJ_XJ'.

LV_TEXT = '收入小计' .

PERFORM FRM_ADD_COLUMN USING LV_NAME LV_TEXT . LV_NAME = 'ZCZJ_01'.

LV_TEXT = '报销款' .

PERFORM FRM_ADD_COLUMN USING LV_NAME LV_TEXT . LV_NAME = 'ZCZJ_02'.

LV_TEXT = '租房合同—领导租房' .

PERFORM FRM_ADD_COLUMN USING LV_NAME LV_TEXT . LV_NAME = 'ZCZJ_03'.

LV_TEXT = '工资' .

PERFORM FRM_ADD_COLUMN USING LV_NAME LV_TEXT . LV_NAME = 'ZCZJ_04'.

LV_TEXT = '预借差旅费' .

PERFORM FRM_ADD_COLUMN USING LV_NAME LV_TEXT . LV_NAME = 'ZCZJ_05'.

LV_TEXT = '预借报销款' .

PERFORM FRM_ADD_COLUMN USING LV_NAME LV_TEXT . LV_NAME = 'ZCZJ_06'.

LV_TEXT = '其他预借款' .

PERFORM FRM_ADD_COLUMN USING LV_NAME LV_TEXT . LV_NAME = 'ZCZJ_07'.

LV_TEXT = '合同付款' .

PERFORM FRM_ADD_COLUMN USING LV_NAME LV_TEXT .

LV_NAME = 'ZCZJ_08'.

LV_TEXT = '培训费(员工福利)' .

PERFORM FRM_ADD_COLUMN USING LV_NAME LV_TEXT . LV_NAME = 'ZCZJ_09'.

LV_TEXT = '培训费 (对公FREE)' .

PERFORM FRM_ADD_COLUMN USING LV_NAME LV_TEXT . LV_NAME = 'ZCZJ_10'.

LV_TEXT = '办公室装修费' .

PERFORM FRM_ADD_COLUMN USING LV_NAME LV_TEXT . LV_NAME = 'ZCZJ_11'.

LV_TEXT = '办公室房租' .

PERFORM FRM_ADD_COLUMN USING LV_NAME LV_TEXT . LV_NAME = 'ZCZJ_12'.

LV_TEXT = '转款手续费' .

PERFORM FRM_ADD_COLUMN USING LV_NAME LV_TEXT . LV_NAME = 'ZCZJ_13'.

LV_TEXT = '采购软件' .

PERFORM FRM_ADD_COLUMN USING LV_NAME LV_TEXT . LV_NAME = 'ZCZJ_14'.

LV_TEXT = '软件服务费' .

PERFORM FRM_ADD_COLUMN USING LV_NAME LV_TEXT . LV_NAME = 'ZCZJ_15'.

LV_TEXT = '其他库存采购支出' .

PERFORM FRM_ADD_COLUMN USING LV_NAME LV_TEXT . LV_NAME = 'ZCZJ_16'.

LV_TEXT = '工资(代发)' .

PERFORM FRM_ADD_COLUMN USING LV_NAME LV_TEXT . LV_NAME = 'ZCZJ_17'.

LV_TEXT = '社保四险/医保险' .

PERFORM FRM_ADD_COLUMN USING LV_NAME LV_TEXT . LV_NAME = 'ZCZJ_18'.

LV_TEXT = '公积金' .

PERFORM FRM_ADD_COLUMN USING LV_NAME LV_TEXT . LV_NAME = 'ZCZJ_19'.

LV_TEXT = '残保金' .

PERFORM FRM_ADD_COLUMN USING LV_NAME LV_TEXT . LV_NAME = 'ZCZJ_20'.

LV_TEXT = '个人所得税' .

PERFORM FRM_ADD_COLUMN USING LV_NAME LV_TEXT . LV_NAME = 'ZCZJ_21'.

LV_TEXT = '工会经费' .

PERFORM FRM_ADD_COLUMN USING LV_NAME LV_TEXT . LV_NAME = 'ZCZJ_22'.

LV_TEXT = '社保代理/劳务派遣费' .

PERFORM FRM_ADD_COLUMN USING LV_NAME LV_TEXT . LV_NAME = 'ZCZJ_23'.

LV_TEXT = '差旅费' .

PERFORM FRM_ADD_COLUMN USING LV_NAME LV_TEXT . LV_NAME = 'ZCZJ_24'.

LV_TEXT = '机票款' .

PERFORM FRM_ADD_COLUMN USING LV_NAME LV_TEXT . LV_NAME = 'ZCZJ_25'.

LV_TEXT = '所得税(含汇算清缴)' .

PERFORM FRM_ADD_COLUMN USING LV_NAME LV_TEXT . LV_NAME = 'ZCZJ_26'.

LV_TEXT = '增值税' .

PERFORM FRM_ADD_COLUMN USING LV_NAME LV_TEXT . LV_NAME = 'ZCZJ_27'.

LV_TEXT = '附加税' .

PERFORM FRM_ADD_COLUMN USING LV_NAME LV_TEXT . LV_NAME = 'ZCZJ_28'.

LV_TEXT = '印花税' .

PERFORM FRM_ADD_COLUMN USING LV_NAME LV_TEXT . LV_NAME = 'ZCZJ_29'.

LV_TEXT = '一般户备用金(机票款,支)' .

PERFORM FRM_ADD_COLUMN USING LV_NAME LV_TEXT . LV_NAME = 'ZCZJ_30'.

LV_TEXT = '租房预借款' .

PERFORM FRM_ADD_COLUMN USING LV_NAME LV_TEXT . LV_NAME = 'ZCZJ_31'.

LV_TEXT = '车位租金' .

PERFORM FRM_ADD_COLUMN USING LV_NAME LV_TEXT . LV_NAME = 'ZCZJ_32'.

LV_TEXT = '电费(办公室)' .

PERFORM FRM_ADD_COLUMN USING LV_NAME LV_TEXT . LV_NAME = 'ZCZJ_33'.

LV_TEXT = '水费(办公室)' .

PERFORM FRM_ADD_COLUMN USING LV_NAME LV_TEXT . LV_NAME = 'ZCZJ_34'.

LV_TEXT = '其他租赁费(办公室)' .

PERFORM FRM_ADD_COLUMN USING LV_NAME LV_TEXT . LV_NAME = 'ZCZJ_35'.

LV_TEXT = '采购固定资产' .

PERFORM FRM_ADD_COLUMN USING LV_NAME LV_TEXT . LV_NAME = 'ZCZJ_36'.

LV_TEXT = '保险费' .

PERFORM FRM_ADD_COLUMN USING LV_NAME LV_TEXT . LV_NAME = 'ZCZJ_37'.

LV_TEXT = '购办公用品' .

PERFORM FRM_ADD_COLUMN USING LV_NAME LV_TEXT . LV_NAME = 'ZCZJ_38'.

LV_TEXT = '其他' .

PERFORM FRM_ADD_COLUMN USING LV_NAME LV_TEXT . LV_NAME = 'ZCZJ_39'.

LV_TEXT = '律师费' .

PERFORM FRM_ADD_COLUMN USING LV_NAME LV_TEXT . LV_NAME = 'ZCZJ_40'.

LV_TEXT = '运营资金—上海(支)' .

PERFORM FRM_ADD_COLUMN USING LV_NAME LV_TEXT . LV_NAME = 'ZCZJ_41'.

LV_TEXT = '运营资金—昆明(支)' .

PERFORM FRM_ADD_COLUMN USING LV_NAME LV_TEXT . LV_NAME = 'ZCZJ_42'.

LV_TEXT = '支取备用金' .

PERFORM FRM_ADD_COLUMN USING LV_NAME LV_TEXT . LV_NAME = 'ZCZJ_43'.

LV_TEXT = '支取差旅费' .

PERFORM FRM_ADD_COLUMN USING LV_NAME LV_TEXT . LV_NAME = 'ZCZJ_44'.

LV_TEXT = '其他服务费' .

PERFORM FRM_ADD_COLUMN USING LV_NAME LV_TEXT . LV_NAME = 'ZCZJ_45'.

LV_TEXT = '服务费(支)' .

PERFORM FRM_ADD_COLUMN USING LV_NAME LV_TEXT . LV_NAME = 'ZCZJ_46'.

LV_TEXT = '保证金' .

PERFORM FRM_ADD_COLUMN USING LV_NAME LV_TEXT . LV_NAME = 'ZCZJ_47'.

LV_TEXT = '归还借款(支)' .

PERFORM FRM_ADD_COLUMN USING LV_NAME LV_TEXT . LV_NAME = 'ZCZJ_48'.

LV_TEXT = '奖金' .

PERFORM FRM_ADD_COLUMN USING LV_NAME LV_TEXT . LV_NAME = 'ZCZJ_49'.

LV_TEXT = '利息支出' .

PERFORM FRM_ADD_COLUMN USING LV_NAME LV_TEXT . LV_NAME = 'ZCZJ_50'.

LV_TEXT = '付支付宝备用金' .

PERFORM FRM_ADD_COLUMN USING LV_NAME LV_TEXT . LV_NAME = 'ZCZJ_51'.

LV_TEXT = '运营资金-北京(支)' .

PERFORM FRM_ADD_COLUMN USING LV_NAME LV_TEXT .

LV_NAME = 'ZCZJ_XJ'.

LV_TEXT = '支出小计' .

PERFORM FRM_ADD_COLUMN USING LV_NAME LV_TEXT . LV_NAME = 'QMYE'.

LV_TEXT = '期末余额' .

PERFORM FRM_ADD_COLUMN USING LV_NAME LV_TEXT . LV_NAME = 'ZHJ' .

LV_TEXT = '合计' .

PERFORM FRM_ADD_COLUMN USING LV_NAME LV_TEXT .

ENDFORM. \

*&---------------------------------------------------------------------*

*& Form FRM_ADD_COLUMN

*&---------------------------------------------------------------------*

* text

*----------------------------------------------------------------------*

* -->P_LV_NAME text * -->P_LV_TEXT text

*----------------------------------------------------------------------*

FORM FRM_ADD_COLUMN USING PV_NAME TYPE TV_ITMNAME PV_TEXT TYPE TV_HEADING . DATA:LV_NUM TYPE I.

DATA:LV_TEXT TYPE TV_HEADING .

CALL METHOD GO_TREE100->ADD_COLUMN EXPORTING

NAME = PV_NAME * HIDDEN = * DISABLED = ALIGNMENT = '2' WIDTH = '40' * WIDTH_PIX = 'X' * HEADER_IMAGE =

HEADER_TEXT = PV_TEXT * HEADER_TOOLTIP = EXCEPTIONS

COLUMN_EXISTS = 1 ILLEGAL_COLUMN_NAME = 2 TOO_MANY_COLUMNS = 3 ILLEGAL_ALIGNMENT = 4

DIFFERENT_COLUMN_TYPES = 5 CNTL_SYSTEM_ERROR = 6 FAILED = 7 PREDECESSOR_COLUMN_NOT_FOUND = 8 OTHERS = 9. IF SY-SUBRC <> 0.

* Implement suitable error handling here ENDIF.

GT_CULUMN-NAME = PV_NAME . GT_CULUMN-TEXT = PV_TEXT . APPEND GT_CULUMN . CLEAR GT_CULUMN .

ENDFORM. \

*&---------------------------------------------------------------------*

*& Form BUILD_NODE_AND_ITEM_TABLE

*&---------------------------------------------------------------------*

* text

*----------------------------------------------------------------------*

* -->P_GT_ZFIT1011 text * <--P_GT_NODE_TAB text * <--P_GT_ITEM_TAB text

*----------------------------------------------------------------------*

FORM BUILD_NODE_AND_ITEM_TABLE USING IT_TAB TYPE TT_ZFIT1011 CHANGING CT_NODE TYPE TREEV_NTAB CT_ITEM TYPE TT_DEMO_ITEM. DATA:LS_TAB TYPE TY_TAB , LS_NODE TYPE TREEV_NODE, LS_ITEM TYPE TY_DEMO_ITEM. DATA:LV_UPNOD TYPE ZFIUPNOD . REFRESH:GT_TAB,R_BUKRS . CLEAR LV_UPNOD .

PERFORM FRM_BUILD_FIELDCAT. \添加列

*--------------------------------------------------------------------*

* 用递归获取树结构数据

GV_FLAG = 'X' . \第一次要排除同级节点

PERFORM FRM_COLLECT_NODE USING EV_REGCT CHANGING IT_TAB . \

* 整理业务数据

PERFORM FRM_SUBROUTINES .

*--------------------------------------------------------------------*

\根节点

LOOP AT GT_TAB INTO LS_TAB WHERE NODID = EV_REGCT . LS_NODE-NODE_KEY = EV_REGCT . LS_NODE-RELATKEY = ''.

LS_NODE-ISFOLDER = ABAP_TRUE. LS_NODE-EXPANDER = ABAP_TRUE.

APPEND LS_NODE TO CT_NODE. CLEAR:LS_NODE.

LS_ITEM-ITEM_NAME = 'NODID'. LS_ITEM-NODE_KEY = LS_TAB-NODID.

LS_ITEM-CLASS = 2. \k

LS_ITEM-EDITABLE = ''.

* modify by tianhaiguang on 20130422.

* ls_item-text = ls_tab-nodid && ' ' && ls_tab-ndtxt.

CONCATENATE LS_TAB-NODID LS_TAB-NDTXT INTO LS_ITEM-TEXT SEPARATED BY SPACE. * end modify

APPEND LS_ITEM TO CT_ITEM. CLEAR:LS_ITEM.

CLEAR:LS_TAB-ZJLB,LS_TAB-KHHT.

PERFORM FRM_ADD_DATA USING LS_TAB CHANGING CT_NODE CT_ITEM .

ENDLOOP.

* SORT GT_TAB BY NODID UPNOD RCFLG DESCENDING.\

LOOP AT GT_TAB INTO LS_TAB WHERE UPNOD IS NOT INITIAL.

\判断当前层的上一级是否存在

READ TABLE GT_TAB WITH KEY NODID = LS_TAB-UPNOD TRANSPORTING NO FIELDS.

IF SY-SUBRC <> 0. CONTINUE. ENDIF.

\判断当前层的下一级是否存在

READ TABLE GT_TAB WITH KEY UPNOD = LS_TAB-NODID TRANSPORTING NO F

IELDS.

IF SY-SUBRC = 0.

LS_NODE-ISFOLDER = ABAP_TRUE. ELSE.

LS_NODE-ISFOLDER = ABAP_FALSE. ENDIF.

LS_NODE-NODE_KEY = LS_TAB-NODID. LS_NODE-RELATKEY = LS_TAB-UPNOD.

* ls_node-n_image = '@5B@'. * ls_node-exp_image = '@5B@'. APPEND LS_NODE TO CT_NODE. CLEAR:LS_NODE.

*<---构建节点信息表--->

LS_ITEM-ITEM_NAME = 'NODID'. LS_ITEM-NODE_KEY = LS_TAB-NODID.

LS_ITEM-CLASS = 2.\ \ * ls_item-editable = 'X'.

* modify by tianhaiguang on 20130422.

* ls_item-text = ls_tab-nodid && '-' && ls_tab-ndtxt. IF LS_TAB-BANKA IS INITIAL.

CONCATENATE LS_TAB-NODID LS_TAB-NDTXT INTO LS_ITEM-TEXT SEPARATED BY SPACE. ELSE.

LS_ITEM-TEXT = LS_TAB-NDTXT . ENDIF.

* end modify.

COLLECT LS_ITEM INTO CT_ITEM. CLEAR:LS_ITEM.

IF LS_TAB-BCJNR IS INITIAL. CLEAR:LS_TAB-ZJLB,LS_TAB-KHHT. ENDIF.

PERFORM FRM_ADD_DATA USING LS_TAB CHANGING CT_NODE CT_ITEM .

ENDLOOP.

ENDFORM. \

*&---------------------------------------------------------------------*

*& Form FRM_COLLECT_NODE

*&---------------------------------------------------------------------*

* text

*----------------------------------------------------------------------*

* -->P_EV_REGCT text * <--P_IT_TAB text

*----------------------------------------------------------------------*

FORM FRM_COLLECT_NODE USING P_NODE TYPE ZFIUPNOD CHANGING P_TAB TYPE TT_ZFIT1011 . DATA:LS_TAB TYPE TY_ZFIT1011 .

READ TABLE P_TAB WITH KEY NODID = P_NODE INTO LS_TAB. IF SY-SUBRC = 0. IF GV_FLAG = 'X' .

CLEAR:LS_TAB-NXTND, LS_TAB-UPNOD . ENDIF.

IF LS_TAB-BUKRS IS NOT INITIAL. R_BUKRS-SIGN = 'I' . R_BUKRS-OPTION = 'EQ' . R_BUKRS-LOW = LS_TAB-BUKRS . APPEND R_BUKRS . CLEAR R_BUKRS . ENDIF.

CLEAR GS_TAB .

MOVE-CORRESPONDING LS_TAB TO GS_TAB . APPEND GS_TAB TO GT_TAB .

IF GV_FLAG = 'X' AND LS_TAB-NXTND IS INITIAL . GV_FLAG = '' . ELSE.

* 下一个同级节点

PERFORM FRM_COLLECT_NODE USING LS_TAB-NXTND CHANGING P_TAB . ENDIF.

* 下一级节点

PERFORM FRM_COLLECT_NODE USING LS_TAB-DWNOD CHANGING P_TAB . ENDIF.

ENDFORM. \

*&-------------------------------------------------------------------

--*

*& Form FRM_SUBROUTINES

*&---------------------------------------------------------------------*

* text

*----------------------------------------------------------------------*

* --> p1 text * <-- p2 text

*----------------------------------------------------------------------*

FORM FRM_SUBROUTINES . PERFORM FRM_DATA_GET . PERFORM FRM_DATA_PROCESS .

ENDFORM. \

*&---------------------------------------------------------------------*

*& Form FRM_DATA_GET

*&---------------------------------------------------------------------*

* text

*----------------------------------------------------------------------*

* --> p1 text * <-- p2 text

*----------------------------------------------------------------------*

FORM FRM_DATA_GET .

DATA:LV_DATE TYPE SY-DATUM . DATA:LV_TABIX TYPE SY-TABIX .

REFRESH: GT_TCJ_POSITIONS ,GT_TCJ_DOCUMENTS,GT_TCJ_TRANSACTIONS,GT_TCJ_TRANS_NAMES,GT_BNKA .

* 确定日期

IF S_BUDAT-HIGH IS NOT INITIAL. LV_DATE = S_BUDAT-HIGH . ELSE.

LV_DATE = S_BUDAT-LOW . ENDIF.

IF GT_T001[] IS NOT INITIAL .

SELECT * INTO CORRESPONDING FIELDS OF TABLE GT_TCJ_DOCUMENTS FROM TCJ_DOCUMENTS AS A

INNER JOIN T012K AS

B ON B~BCJNR = A~CAJO_NUMBER AND A~COMP_CODE = B~BUKRS

FOR ALL ENTRIES IN GT_T001

WHERE A~COMP_CODE IN S_BUKRS

AND A~COMP_CODE = GT_T001-BUKRS

AND A~POSTING_DATE <= LV_DATE

* AND a~posting_date IN s_budat

* AND ( a~document_status = 'P'

* OR a~document_status = 'R' ).

AND A~DOCUMENT_STATUS = 'S'.

* AND B~FUNAC IN S_FUNAC

* AND b~hbkid IN s_hbkid. ELSE.

SELECT * INTO CORRESPONDING FIELDS OF TABLE GT_TCJ_DOCUMENTS FROM TCJ_DOCUMENTS AS A

INNER JOIN T012K AS B ON B~BCJNR = A~CAJO_NUMBER AND A~COMP_CODE = B~BUKRS

WHERE A~COMP_CODE IN S_BUKRS

AND A~POSTING_DATE <= LV_DATE

* AND a~posting_date IN s_budat

AND A~DOCUMENT_STATUS = 'S'.

* AND ( a~document_status = 'P'

* OR a~document_status = 'R' ).

* AND B~FUNAC IN S_FUNAC

* AND b~hbkid IN s_hbkid. ENDIF.

IF GT_TCJ_DOCUMENTS[] IS NOT INITIAL .

* SELECT * INTO CORRESPONDING FIELDS OF TABLE gt_tcj_positions FROM tcj_positions \现金日记帐凭证项目

* FOR ALL ENTRIES IN gt_tcj_documents

* WHERE comp_code = gt_tcj_documents-comp_code

* AND cajo_number = gt_tcj_documents-cajo_number

* AND fisc_year = gt_tcj_documents-fisc_year

* AND posting_number = gt_tcj_documents-posting_number

* AND ( transact_type = 'E' OR transact_type = 'R' ).

*-------------代码优化---------------------------------------------------------------------------------------

SELECT * INTO CORRESPONDING FIELDS OF TABLE GT_TCJ_POSITIONS FROM TCJ_POSITIONS \现金日记帐凭证项目

WHERE COMP_CODE IN R_BUKRS

* AND posting_date IN s_budat

AND POSTING_DATE <= LV_DATE

AND ( TRANSACT_TYPE = 'E' OR TRANSACT_TYPE = 'R' ).

IF GT_TCJ_POSITIONS[] IS NOT INITIAL .

* 排除BUKRS(公司代码)=SH01、CJBELNR(Cash Journal Document Number)=A016

的数据*

* LOOP AT gt_tcj_positions WHERE comp_code = 'SH01' . * lv_tabix = sy-tabix .

* IF gt_tcj_positions-posting_number(4) = 'A016'. * DELETE gt_tcj_positions INDEX lv_tabix . * CONTINUE. * ENDIF.

** READ TABLE gt_tcj_documents TRANSPORTING NO FIELDS WITH KEY comp_code = gt_tcj_positions-comp_code \优化

** cajo_number = gt_tcj_positions-cajo_number

**

fisc_year = gt_tcj_positions-fisc_year

** posting_number = gt_tcj_positions-posting_number. ** IF sy-subrc NE 0.

** DELETE gt_tcj_positions INDEX lv_tabix . ** ENDIF. * ENDLOOP. *-------------------

SORT GT_TCJ_DOCUMENTS BY COMP_CODE CAJO_NUMBER FISC_YEAR POSTING_NUMBER.

LOOP AT GT_TCJ_POSITIONS. LV_TABIX = SY-TABIX .

IF GT_TCJ_POSITIONS-POSTING_NUMBER(4) = 'A016' AND GT_TCJ_POSITIONS-COMP_CODE = 'SH01'.

DELETE GT_TCJ_POSITIONS INDEX LV_TABIX . CONTINUE. ENDIF.

READ TABLE GT_TCJ_DOCUMENTS TRANSPORTING NO FIELDS WITH KEY COMP_CODE = GT_TCJ_POSITIONS-COMP_CODE \优化

CAJO_NUMBER = GT_TCJ_POSITIONS-CAJO_NUMBER

FISC_YEAR = GT_TCJ_POSITIONS-FISC_YEAR

POSTING_NUMBER = GT_TCJ_POSITIONS-POSTING_NUMBER

BINARY SEARCH.

IF SY-SUBRC NE 0.

DELETE GT_TCJ_POSITIONS INDEX LV_TABIX . ENDIF. ENDLOOP. *-------------------

IF GT_TCJ_POSITIONS[] IS INITIAL .

MESSAGE '没有符合条件的数据' TYPE 'S' DISPLAY LIKE 'E' . LEAVE TO SCREEN 0 . ELSE.

SELECT * INTO CORRESPONDING FIELDS OF TABLE GT_TCJ_TRANSACTIONS FROM TCJ_TRANSACTIONS \现金日记帐交易业务

FOR ALL ENTR

代码优化 BY AB_ZHUXG-------------------------------------------------------

代码优化 BY AB_ZHUXG-------------------------------------------------------

IES IN GT_TCJ_POSITIONS

WHERE COMP_CODE = GT_TCJ_POSITIONS-COMP_CODE

AND TRANSACT_NUMBER = GT_TCJ_POSITIONS-TRANSACT_NUMBER .

SELECT * INTO CORRESPONDING FIELDS OF TABLE GT_TCJ_TRANS_NAMES FROM TCJ_TRANS_NAMES \现金日记帐交易业务名称

FOR ALL ENTRIES IN GT_TCJ_POSITIONS

WHERE COMP_CODE = GT_TCJ_POSITIONS-COMP_CODE

AND TRANSACT_NUMBER = GT_TCJ_POSITIONS-TRANSACT_NUMBER . ENDIF. ENDIF.

* SELECT * INTO CORRESPONDING FIELDS OF TABLE gt_t012k FROM t012k * FOR ALL ENTRIES IN gt_tcj_documents

* WHERE bcjnr = gt_tcj_documents-cajo_number

* AND bukrs = gt_tcj_documents-comp_code .

*-----------------代码优化BY AB_ZHUXG------------------------------------------------------. DATA: LT_DOCUMENTS TYPE TABLE OF TCJ_DOCUMENTS. LT_DOCUMENTS = GT_TCJ_DOCUMENTS[].

SORT LT_DOCUMENTS BY COMP_CODE CAJO_NUMBER.

DELETE ADJACENT DUPLICATES FROM LT_DOCUMENTS COMPARING COMP_CODE CAJO_NUMBER.

SELECT * INTO CORRESPONDING FIELDS OF TABLE GT_T012K FROM T012K FOR ALL ENTRIES IN LT_DOCUMENTS

WHERE BCJNR = LT_DOCUMENTS-CAJO_NUMBER

AND BUKRS = LT_DOCUMENTS-COMP_CODE .

*-----------------代码优化BY AB_ZHUXG------------------------------------------------------. IF GT_T012K[] IS NOT INITIAL.

SELECT T012~BUKRS T012~HBKID

T012~BANKS T012~BANKL T012~TELF1 T012~STCD1 T012~NAME1 T012~SPRAS BNKA~BANKA

INTO CORRESPONDING FIELDS OF TABLE GT_T012 FROM T012 INNER JOIN BNKA ON BNKA~BANKS = T012~BANKS

AND BNKA~BANKL = T012~BANKL

FOR ALL ENTRIES IN GT_T012K

WHERE T012~HBKID = GT_T012K-HBKID

* AND t012~hbkid = gt_t012k-hktid

AND T012~BUKRS = GT_T012K-BUKRS .

SELECT * INTO CORRESPONDING FIELDS OF TABLE GT_ZFIE1002 FROM ZFIE1002

FOR ALL ENTRIES IN GT_T012K

WHERE FUNAC = GT_T012K-FUNAC

AND ACATR = GT_T012K-ACATR . ENDIF. ELSE.

MESSAGE '没有符合条件的数据' TYPE 'S' DISPLAY LIKE 'E' . LEAVE TO SCREEN 0 . ENDIF.

ENDFORM. \

*&---------------------------------------------------------------------*

*& Form FRM_DATA_PROCESS

*&---------------------------------------------------------------------*

* text

*----------------------------------------------------------------------*

* --> p1 text * <-- p2 text

*----------------------------------------------------------------------*

FORM FRM_DATA_PROCESS .

DATA: LV_TABIX TYPE SY-TABIX , LV_TABIX1 TYPE SY-TABIX , LV_TABIX2 TYPE SY-TABIX, LV_TABIX3 TYPE SY-TABIX, LV_CJAMOUNT TYPE CJAMOUNT , LV_UPNOD TYPE ZFIUPNOD. DATA LS_T012K TYPE T012K. DATA: LV_AWKEY TYPE AWKEY, LS_BKPF TYPE BKPF, LS_FAGLFLEXA TYPE FAGLFLEXA.

DATA:LT_TCJ_CJ_NAMES TYPE TABLE OF TCJ_CJ_NAMES, LS_TCJ_CJ_NAMES TYPE TCJ_CJ_NAMES.

REFRESH WT_TAB .

CLEAR:GS_TAB, LV_CJAMOUNT .

REFRESH LT_TCJ_CJ_NAMES[].

SELECT * INTO TABLE LT_TCJ_CJ_NAMES FROM TCJ_CJ_NAMES WHERE LANGU = '1'

AND COMP_CODE IN S_BUKRS.

LOOP AT GT_TCJ_POSITIONS ASSIGNING . LV_TABIX = SY-TABIX.

READ TABLE GT_T012K WITH KEY BCJNR = -CAJO_NUMBER BUKRS = -COMP_CODE . IF SY-SUBRC = 0.

-HBKID = GT_T012K-HBKID . \帐号

READ TABLE GT_T012 WITH KEY HBKID = GT_T012K-HBKID BUKRS = GT_T012K-BUKRS . IF SY-SUBRC = 0 .

-BANKA = GT_T012-BANKA . \银行描述

READ TABLE GT_ZFIE1002 WITH KEY FUNAC = GT_T012K-FUNAC ACATR = GT_T012K-ACATR . IF SY-SUBRC = 0 .

-ACATR = GT_T012K-ACATR . \资金类别明细 ENDIF. ENDIF. ELSE.

DELETE GT_TCJ_POSITIONS INDEX LV_TABIX.

ENDIF. ENDLOOP.

DELETE GT_TCJ_POSITIONS WHERE ACATR IS INITIAL .

SORT GT_TCJ_POSITIONS BY POSTING_DATE . LOOP AT GT_TCJ_POSITIONS ASSIGNING . WS_TAB-BUKRS = -COMP_CODE . \公司代码 WS_TAB-BANKA = -BANKA . \银行描述

* ws_tab-upnod = -nodid . \有节点值,说明为区域中心,直接挂在该区域中心下面

WS_TAB-HBKID = -HBKID . \银行号码

LV_CJAMOUNT = -P_NET_AMOUNT = -P_RECEIPTS - -P_PAYMENTS .\金额

IF WS_TAB-UPNOD IS NOT INITIAL. WS_TAB-RCFLG = 'X' . ENDIF.

READ TABLE LT_TCJ_CJ_NAMES INTO LS_TCJ_CJ_NAMES WITH KEY COMP_CODE = -COMP_CODE

CAJO_NUMBER = -CAJO_NUMBER. IF SY-SUBRC = 0.

-CLASS = 'KHHT'.

WS_TAB-KHHT = LS_TCJ_CJ_NAMES-CAJO_NAME . WS_TAB-BCJNR = LS_TCJ_CJ_NAMES-CAJO_NUMBER. ENDIF.

READ TABLE GT_T012K INTO LS_T012K WITH KEY BUKRS = -COMP_CODE BCJNR = -CAJO_NUMBER.

IF LS_T012K-FUNAC = 'A' .\可动用可划拨 -CLASS = 'ZJLB'.

WS_TAB-ZJLB = '可动用可划拨' .

ELSEIF LS_T012K-FUNAC = 'B' .\可动用不可划拨 -CLASS = 'ZJLB'.

WS_TAB-ZJLB = '可动用不可划拨' .

ELSEIF LS_T012K-FUNAC = 'C' .\不可动用 -CLASS = 'ZJLB'. WS_TAB-ZJLB = '不可动用' . ENDIF.

\期初余额

IF -TRANSACT_NUMBER = 66. -CLASS = 'QCZHYE' . WS_TAB-QCZHYE = LV_CJAMOUNT .

WS_TAB-SRZJ_XJ = LV_CJAMOUNT . \收入小计 ENDIF.

\运维收入 TANSACT-NUMBER = 42. IF -TRANSACT_NUMBER = 42. -CLASS = 'SRZJ_01' . WS_TAB-SRZJ_01 = LV_CJAMOUNT .

WS_TAB-SRZJ_XJ = LV_CJAMOUNT . \收入小计

\咨询&技术服务收入 TANSACT-NUMBER = 43. ELSEIF -TRANSACT_NUMBER = 43. -CLASS = 'SRZJ_02' . WS_TAB-SRZJ_02 = LV_CJAMOUNT .

WS_TAB-SRZJ_XJ = LV_CJAMOUNT . \收入小计

\软件收入 TANSACT-NUMBER = 44. ELSEIF -TRANSACT_NUMBER = 44. -CLASS = 'SRZJ_03' . WS_TAB-SRZJ_03 = LV_CJAMOUNT .

WS_TAB-SRZJ_XJ = LV_CJAMOUNT . \收入小计

\培训收入 TANSACT-NUMBER = 45. ELSEIF -TRANSACT_NUMBER = 45. -CLASS = 'SRZJ_04' . WS_TAB-SRZJ_04 = LV_CJAMOUNT .

WS_TAB-SRZJ_XJ = LV_CJAMOUNT . \收入小计

\备用金收入 TANSACT-NUMBER = 46. ELSEIF -TRANSACT_NUMBER = 46. -CLASS = 'SRZJ_05' . WS_TAB-SRZJ_05 = LV_CJAMOUNT .

WS_TAB-SRZJ_XJ = LV_CJAMOUNT . \收入小计

\其他收入 TANSACT-NUMBER = 47. ELSEIF -TRANSACT_NUMBER = 47. -CLASS = 'SRZJ_06' . WS_TAB-SRZJ_06 = LV_CJAMOUNT .

WS_TAB-SRZJ_XJ = LV_CJAMOUNT . \收入小计

\运营资金—昆明(收) TANSACT-NUMBER = 48.

ELSEIF -TRANSACT_NUMBER = 48. -CLASS = 'SRZJ_07' . WS_TAB-SRZJ_07 = LV_CJAMOUNT .

WS_TAB-SRZJ_XJ = LV_CJAMOUNT . \收入小计

\运营资金—上海(收) TANSACT-NUMBER = 49. ELSEIF -TRANSACT_NUMBER = 49. -CLASS = 'SRZJ_08' . WS_TAB-SRZJ_08 = LV_CJAMOUNT .

WS_TAB-SRZJ_XJ = LV_CJAMOUNT .

\利息收入 TANSACT-NUMBER = 50. ELSEIF -TRANSACT_NUMBER = 50. -CLASS = 'SRZJ_09' . WS_TAB-SRZJ_09 = LV_CJAMOUNT .

WS_TAB-SRZJ_XJ = LV_CJAMOUNT .

\其他货币资金 TANSACT-NUMBER = 51. ELSEIF -TRANSACT_NUMBER = 51. -CLASS = 'SRZJ_10' . WS_TAB-SRZJ_10 = LV_CJAMOUNT .

WS_TAB-SRZJ_XJ = LV_CJAMOUNT .

\筹资收入 TANSACT-NUMBER = 52. ELSEIF -TRANSACT_NUMBER = 52. -CLASS = 'SRZJ_11' . WS_TAB-SRZJ_11 = LV_CJAMOUNT .

WS_TAB-SRZJ_XJ = LV_CJAMOUNT .

\借款 TANSACT-NUMBER = 53.

ELSEIF -TRANSACT_NUMBER = 53. -CLASS = 'SRZJ_12' . WS_TAB-SRZJ_12 = LV_CJAMOUNT .

WS_TAB-SRZJ_XJ = LV_CJAMOUNT .

\归还借款(收) TANSACT-NUMBER = 62. ELSEIF -TRANSACT_NUMBER = 62. -CLASS = 'SRZJ_13' . WS_TAB-SRZJ_13 = LV_CJAMOUNT .

WS_TAB-SRZJ_XJ = LV_CJAMOUNT .

\提取差旅费(收) TANSACT-NUMBER = 63. ELSEIF -TRANSACT_NUMBER = 63. -CLASS = 'SRZJ_14' .

\收入小计 \收入小计 \收入小计 \收入小计 \收入小计 \收入小计 WS_TAB-SRZJ_14 = LV_CJAMOUNT .

WS_TAB-SRZJ_XJ = LV_CJAMOUNT . \收入小计

\提取备用金(收) TANSACT-NUMBER = 64. ELSEIF -TRANSACT_NUMBER = 64. -CLASS = 'SRZJ_15' . WS_TAB-SRZJ_15 = LV_CJAMOUNT .

WS_TAB-SRZJ_XJ = LV_CJAMOUNT . \收入小计

\退款 TANSACT-NUMBER = 65.

ELSEIF -TRANSACT_NUMBER = 65. -CLASS = 'SRZJ_16' . WS_TAB-SRZJ_16 = LV_CJAMOUNT .

WS_TAB-SRZJ_XJ = LV_CJAMOUNT .

\保证金 TANSACT-NUMBER = 70.

ELSEIF -TRANSACT_NUMBER = 70. -CLASS = 'SRZJ_17' . WS_TAB-SRZJ_17 = LV_CJAMOUNT .

WS_TAB-SRZJ_XJ = LV_CJAMOUNT .

\一般户备用金

ELSEIF -TRANSACT_NUMBER = 68. -CLASS = 'SRZJ_18' . WS_TAB-SRZJ_18 = LV_CJAMOUNT .

WS_TAB-SRZJ_XJ = LV_CJAMOUNT .

\运营资金—北京(收)

ELSEIF -TRANSACT_NUMBER = 72. -CLASS = 'SRZJ_19' . WS_TAB-SRZJ_19 = LV_CJAMOUNT .

WS_TAB-SRZJ_XJ = LV_CJAMOUNT . ENDIF.

\人工成本费用-报销款 TANSACT-NUMBER = 1. IF -TRANSACT_NUMBER = 01. -CLASS = 'ZCZJ_01' . WS_TAB-ZCZJ_01 = LV_CJAMOUNT . \

WS_TAB-ZCZJ_XJ = LV_CJAMOUNT .

\租房合同—领导租房 TANSACT-NUMBER = 2. ELSEIF -TRANSACT_NUMBER = 02. -CLASS = 'ZCZJ_02' . WS_TAB-ZCZJ_02 = LV_CJAMOUNT .

\收入小计 \收入小计 \收入小计 \收入小计 \支出小计 WS_TAB-ZCZJ_XJ = LV_CJAMOUNT . \支出小计

\工资 TANSACT-NUMBER = 3.

ELSEIF -TRANSACT_NUMBER = 03. -CLASS = 'ZCZJ_03' . WS_TAB-ZCZJ_03 = LV_CJAMOUNT .

WS_TAB-ZCZJ_XJ = LV_CJAMOUNT . \支出小计

\预借差旅费 TANSACT-NUMBER = 4. ELSEIF -TRANSACT_NUMBER = 04. -CLASS = 'ZCZJ_04' . WS_TAB-ZCZJ_04 = LV_CJAMOUNT .

WS_TAB-ZCZJ_XJ = LV_CJAMOUNT . \支出小计

\预借报销款 TANSACT-NUMBER = 5. ELSEIF -TRANSACT_NUMBER = 05. -CLASS = 'ZCZJ_05' . WS_TAB-ZCZJ_05 = LV_CJAMOUNT .

WS_TAB-ZCZJ_XJ = LV_CJAMOUNT . \支出小计

\其他预借款 TANSACT-NUMBER = 6. ELSEIF -TRANSACT_NUMBER = 06. -CLASS = 'ZCZJ_06' . WS_TAB-ZCZJ_06 = LV_CJAMOUNT .

WS_TAB-ZCZJ_XJ = LV_CJAMOUNT . \支出小计

\合同付款 TANSACT-NUMBER = 7.

ELSEIF -TRANSACT_NUMBER = 07. -CLASS = 'ZCZJ_07' . WS_TAB-ZCZJ_07 = LV_CJAMOUNT .

WS_TAB-ZCZJ_XJ = LV_CJAMOUNT . \支出小计

\培训费 TANSACT-NUMBER = 8.

ELSEIF -TRANSACT_NUMBER = 08. -CLASS = 'ZCZJ_08' . WS_TAB-ZCZJ_08 = LV_CJAMOUNT .

WS_TAB-ZCZJ_XJ = LV_CJAMOUNT . \支出小计

\培训费 (对公FREE) TANSACT-NUMBER = 9. ELSEIF -TRANSACT_NUMBER = 09. -CLASS = 'ZCZJ_09' . WS_TAB-ZCZJ_09 = LV_CJAMOUNT .

WS_TAB-ZCZJ_XJ = LV_CJAMOUNT . \支出小计

\办公室装修费 TANSACT-NUMBER = 10. ELSEIF -TRANSACT_NUMBER = 10. -CLASS = 'ZCZJ_10' . WS_TAB-ZCZJ_10 = LV_CJAMOUNT .

WS_TAB-ZCZJ_XJ = LV_CJAMOUNT . \支出小计

\办公室房租 TANSACT-NUMBER = 11. ELSEIF -TRANSACT_NUMBER = 11. -CLASS = 'ZCZJ_11' . WS_TAB-ZCZJ_11 = LV_CJAMOUNT .

WS_TAB-ZCZJ_XJ = LV_CJAMOUNT .

\转款手续费 TANSACT-NUMBER = 12. ELSEIF -TRANSACT_NUMBER = 12. -CLASS = 'ZCZJ_12' . WS_TAB-ZCZJ_12 = LV_CJAMOUNT .

WS_TAB-ZCZJ_XJ = LV_CJAMOUNT .

\采购软件 TANSACT-NUMBER = 13. ELSEIF -TRANSACT_NUMBER = 13. -CLASS = 'ZCZJ_13' . WS_TAB-ZCZJ_13 = LV_CJAMOUNT .

WS_TAB-ZCZJ_XJ = LV_CJAMOUNT .

\软件服务费 TANSACT-NUMBER = 14. ELSEIF -TRANSACT_NUMBER = 14. -CLASS = 'ZCZJ_14' . WS_TAB-ZCZJ_14 = LV_CJAMOUNT .

WS_TAB-ZCZJ_XJ = LV_CJAMOUNT .

\其他库存采购支出 TANSACT-NUMBER = 15. ELSEIF -TRANSACT_NUMBER = 15. -CLASS = 'ZCZJ_15' . WS_TAB-ZCZJ_15 = LV_CJAMOUNT .

WS_TAB-ZCZJ_XJ = LV_CJAMOUNT .

\工资(代发) TANSACT-NUMBER = 16. ELSEIF -TRANSACT_NUMBER = 16. -CLASS = 'ZCZJ_16' . WS_TAB-ZCZJ_16 = LV_CJAMOUNT .

WS_TAB-ZCZJ_XJ = LV_CJAMOUNT .

\社保四险/医保险 TANSACT-NUMBER = 17. ELSEIF -TRANSACT_NUMBER = 17.

\支出小计 \支出小计 \支出小计 \支出小计 \支出小计 \支出小计

本文来源:https://www.bwwdw.com/article/axqg.html

Top