*&---------------------------------------------------------------------* *& Report ZR_FI_03 *& *&---------------------------------------------------------------------* *&资产负债表 *& 狼 *&---------------------------------------------------------------------* REPORT zr_fi_03. TABLES: t001, "公司主数据 bkpf, " v_tcurr, faglflext. "科目余额表 DATA:ok_code LIKE sy-ucomm. ********************导出为EXCEL的定义******************** TYPE-POOLS ole2. DATA: v_excel TYPE ole2_object, v_book TYPE ole2_object, v_cell TYPE ole2_object, v_range TYPE ole2_object, v_font TYPE ole2_object, v_color TYPE ole2_object, v_column TYPE ole2_object, v_border TYPE ole2_object. ********************导出为EXCEL的定义******************** DATA:BEGIN OF l_bkpf OCCURS 0, bukrs TYPE bkpf-bukrs, gjahr TYPE bkpf-gjahr, END OF l_bkpf. DATA:num01 TYPE faglflext-hslvt, num02 TYPE faglflext-hslvt, num03 TYPE faglflext-hslvt, num04 TYPE faglflext-hslvt, num05 TYPE faglflext-hslvt, num06 TYPE faglflext-hslvt. DATA:sum13s TYPE faglflext-hslvt, sum13e TYPE faglflext-hslvt, sum32s TYPE faglflext-hslvt, sum32e TYPE faglflext-hslvt, sum48s TYPE faglflext-hslvt, sum48e TYPE faglflext-hslvt, sum57s TYPE faglflext-hslvt, sum57e TYPE faglflext-hslvt, sum58s TYPE faglflext-hslvt, sum58e TYPE faglflext-hslvt, sum66s TYPE faglflext-hslvt, sum66e TYPE faglflext-hslvt, sum68s TYPE faglflext-hslvt, sum68e TYPE faglflext-hslvt. DATA:BEGIN OF t_tab OCCURS 0, flag(1), ryear TYPE faglflext-ryear, racct TYPE faglflext-racct, drcrk TYPE faglflext-drcrk, hslvt TYPE faglflext-hslvt, hsl01 TYPE faglflext-hsl01, hsl02 TYPE faglflext-hsl02, hsl03 TYPE faglflext-hsl03, hsl04 TYPE faglflext-hsl04, hsl05 TYPE faglflext-hsl05, hsl06 TYPE faglflext-hsl06, hsl07 TYPE faglflext-hsl07, hsl08 TYPE faglflext-hsl08, hsl09 TYPE faglflext-hsl09, hsl10 TYPE faglflext-hsl10, hsl11 TYPE faglflext-hsl11, hsl12 TYPE faglflext-hsl12, hsl13 TYPE faglflext-hsl13, hsl14 TYPE faglflext-hsl14, hsl15 TYPE faglflext-hsl15, hsl16 TYPE faglflext-hsl16, END OF t_tab. *DATA:BEGIN OF l_tab OCCURS 0, * racct TYPE faglflext-racct, ** DRCRK TYPE FAGLFLEXT-DRCRK, * hslvt TYPE faglflext-hslvt, * hsl01 TYPE faglflext-hsl01, * hsl02 TYPE faglflext-hsl02, * hsl03 TYPE faglflext-hsl03, * hsl04 TYPE faglflext-hsl04, * hsl05 TYPE faglflext-hsl05, * hsl06 TYPE faglflext-hsl06, * hsl07 TYPE faglflext-hsl07, * hsl08 TYPE faglflext-hsl08, * hsl09 TYPE faglflext-hsl09, * hsl10 TYPE faglflext-hsl10, * hsl11 TYPE faglflext-hsl11, * hsl12 TYPE faglflext-hsl12, * hsl13 TYPE faglflext-hsl13, * hsl14 TYPE faglflext-hsl14, * hsl15 TYPE faglflext-hsl15, * hsl16 TYPE faglflext-hsl16, * END OF l_tab. DATA:BEGIN OF lg_tab OCCURS 0, * RACCT TYPE FAGLFLEXT-RACCT, * DRCRK TYPE FAGLFLEXT-DRCRK, hslvt TYPE faglflext-hslvt, hsl01 TYPE faglflext-hsl01, hsl02 TYPE faglflext-hsl02, hsl03 TYPE faglflext-hsl03, hsl04 TYPE faglflext-hsl04, hsl05 TYPE faglflext-hsl05, hsl06 TYPE faglflext-hsl06, hsl07 TYPE faglflext-hsl07, hsl08 TYPE faglflext-hsl08, hsl09 TYPE faglflext-hsl09, hsl10 TYPE faglflext-hsl10, hsl11 TYPE faglflext-hsl11, hsl12 TYPE faglflext-hsl12, hsl13 TYPE faglflext-hsl13, hsl14 TYPE faglflext-hsl14, hsl15 TYPE faglflext-hsl15, hsl16 TYPE faglflext-hsl16, END OF lg_tab. DATA:it_tab LIKE TABLE OF t_tab WITH HEADER LINE, t_101 LIKE TABLE OF lg_tab WITH HEADER LINE, t_102 LIKE TABLE OF lg_tab WITH HEADER LINE. *&---------------------------------------------------------------------* *& internal tables *&---------------------------------------------------------------------* DATA: BEGIN OF tb_result OCCURS 0, "资产负债表结果集 * companyid(4) TYPE c, asset1(30) TYPE c, "资产项目 row1(2) TYPE c, "行次 start1 LIKE faglflext-hslvt,"期初值 end1 LIKE faglflext-hslvt,"期未值 asset2(30) TYPE c, "资产项目 row2(2) TYPE c, "行次 start2 LIKE faglflext-hslvt,"期初值 end2 LIKE faglflext-hslvt,"期未值 END OF tb_result. DATA: BEGIN OF prt_result OCCURS 0, "资产负债表结果集 * companyid(4) TYPE c, asset1(30) TYPE c, "资产项目 row1(2) TYPE c, "行次 end1(16) TYPE c, "期未值 start1(16) TYPE c, "期初值 asset2(30) TYPE c, "资产项目 row2(2) TYPE c, "行次 end2(16) TYPE c, "期未值 start2(16) TYPE c, "期初值 END OF prt_result. DATA: BEGIN OF tt_result OCCURS 0, "资产负债表结果集 start1 LIKE faglflext-hslvt,"期初值 end1 LIKE faglflext-hslvt,"期未值 start2 LIKE faglflext-hslvt,"期初值 end2 LIKE faglflext-hslvt,"期未值 END OF tt_result. *&---------------------------------------------------------------------* *& variant declare *&---------------------------------------------------------------------* DATA: s_butxt(50) TYPE c, "公司名称 s_m1(23) TYPE c, s_m2(23) TYPE c, s_m3(23) TYPE c, s_m4(23) TYPE c. DATA: i_lwidth TYPE i VALUE 185, "横线宽 i_col1 TYPE i VALUE 35, "列1宽 i_col2 TYPE i VALUE 4, "列2宽 i_col3 TYPE i VALUE 20, "列3宽 i_col4 TYPE i VALUE 20. "列4宽 DATA: dynpread LIKE TABLE OF dynpread WITH HEADER LINE. DATA: dcurr LIKE TABLE OF bapi1093_0 WITH HEADER LINE. TYPE-POOLS: slis. DATA: fieldcat TYPE slis_t_fieldcat_alv WITH HEADER LINE, fld_head TYPE slis_listheader, sortcat TYPE slis_t_sortinfo_alv, sortcatln LIKE LINE OF sortcat, itab_listhead TYPE slis_t_listheader, layout TYPE slis_layout_alv, v_repid LIKE sy-repid, rt_extab TYPE slis_t_extab, eventcat TYPE slis_t_event. *定义ALV相关变量 *创建ALV必不可少的组件 *TYPE-POOLS: slis. *DATA: afield TYPE slis_fieldcat_alv, * fieldcat TYPE slis_t_fieldcat_alv, * gs_layout TYPE slis_layout_alv, * g_repid TYPE sy-repid, * i_layout TYPE slis_layout_alv, * gridlsl TYPE lvc_s_glay, * u_er_fieldcat TYPE slis_t_fieldcat_alv. DATA: tmpdate LIKE sy-datum, prtdate LIKE sy-datum, tempcurr LIKE bapi1093_1-from_curr, exch_rate(10) TYPE c, txunit(10) TYPE c, errorflag TYPE c, txcurr(16) TYPE c. DATA: f_tols1 LIKE faglflext-hslvt,"资产期初总计 f_tole1 LIKE faglflext-hslvt,"资产期末总计 f_tols2 LIKE faglflext-hslvt,"负债期初总计 f_tole2 LIKE faglflext-hslvt,"负债期末总计 f_sums1 LIKE faglflext-hslvt,"资产期初小计 f_sume1 LIKE faglflext-hslvt,"资产期末小计 f_sums2 LIKE faglflext-hslvt,"负债期初小计 f_sume2 LIKE faglflext-hslvt,"负债期末小计 f_rlts1 LIKE faglflext-hslvt, f_rlte1 LIKE faglflext-hslvt, * zx_s LIKE FAGLFLEXT-hslvt, * zx_e LIKE FAGLFLEXT-hslvt, f_rlts2 LIKE faglflext-hslvt, f_rlte2 LIKE faglflext-hslvt. DATA: f_smny1 LIKE faglflext-hslvt, f_emny1 LIKE faglflext-hslvt. DATA:i_butxt TYPE t001-butxt. *选择屏幕 SELECTION-SCREEN BEGIN OF BLOCK blk WITH FRAME TITLE t1. *SELECT-OPTIONS: s_mblnr FOR mseg-mblnr OBLIGATORY. PARAMETERS:i_rbukrs TYPE t001-bukrs OBLIGATORY, i_monat TYPE bkpf-monat OBLIGATORY, i_gjahr TYPE bkpf-gjahr OBLIGATORY . SELECTION-SCREEN END OF BLOCK blk. INITIALIZATION. v_repid = sy-repid. t1 = '资产负债表'. * 报表事件 START-OF-SELECTION. PERFORM getday_data. PERFORM calculate_data. PERFORM change_data. PERFORM init_fieldcat USING ''. PERFORM init_layout. PERFORM event_build. PERFORM listdata. END-OF-SELECTION. *&---------------------------------------------------------------------* *& Form GETDAY_DATA *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text * <-- p2 text *----------------------------------------------------------------------* FORM getday_data . CONCATENATE i_gjahr i_monat '01' INTO tmpdate. "组合年份 CALL FUNCTION 'LAST_DAY_OF_MONTHS' EXPORTING day_in = tmpdate "根据传入的参数,输出一个月的最后一天 IMPORTING last_day_of_month = prtdate EXCEPTIONS day_in_no_date = 1 OTHERS = 2. SELECT SINGLE butxt INTO s_butxt FROM t001 WHERE bukrs = i_rbukrs. ENDFORM. " GETDAY_DATA *&---------------------------------------------------------------------* *& Form CALCULATE_DATA *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text * <-- p2 text *----------------------------------------------------------------------* FORM calculate_data . DATA: d1 TYPE hslxx12, d2 TYPE hslxx12, d3 TYPE hslxx12, d4 TYPE hslxx12, d5 TYPE hslxx12, d52 TYPE hslxx12, " 资产合计 d6 TYPE hslxx12, d62 TYPE hslxx12, " 负债合计 d7 TYPE hslxx12, d72 TYPE hslxx12, " 所有者合计 d8 TYPE hslxx12, d82 TYPE hslxx12. " 未分配利润 SELECT bukrs gjahr INTO CORRESPONDING FIELDS OF TABLE l_bkpf FROM bkpf WHERE bukrs = i_rbukrs AND gjahr = i_gjahr. SORT l_bkpf BY bukrs gjahr. DELETE ADJACENT DUPLICATES FROM l_bkpf COMPARING bukrs gjahr. PERFORM select_data. **数据计算 PERFORM add_row USING '流动资产:' '' '' '流动负债:' '' ''. * i_monat s_rbukrs i_gjahr 1 1. PERFORM add_row USING '货币资金' '101' '1' ' 短期借款' '' '32'. * i_monat s_rbukrs i_gjahr 1 1. "期间---公司代码---年份 * f_sums2 = tb_result-start2. "初始值 * f_sume2 = tb_result-end2. "初始值 * f_tols1 = tb_result-start1. "初始值 * f_tole1 = tb_result-end1. "初始值 PERFORM add_row USING '交易性金融资产' '102' '2' ' 交易性金融负责' '' '33'. * f_sums2 = f_sums2 + tb_result-start2. * f_sume2 = f_sume2 + tb_result-end2. * f_tols1 = f_tols1 + tb_result-start1. * f_tole1 = f_tole1 + tb_result-end1. PERFORM add_row USING ' 应收票据' '103' '3' ' 应付票据' '' '34'. * f_sums2 = f_sums2 + tb_result-start2. * f_sume2 = f_sume2 + tb_result-end2. * f_tols1 = f_tols1 + tb_result-start1. * f_tole1 = f_tole1 + tb_result-end1. PERFORM add_row USING ' 应收账款' '104' '4' ' 应付帐款' '' '35'. * f_sums2 = f_sums2 + tb_result-start2. * f_sume2 = f_sume2 + tb_result-end2. * f_tols1 = f_tols1 + tb_result-start1. * f_tole1 = f_tole1 + tb_result-end1. PERFORM add_row USING ' 预付账款' '105' '5' ' 预收帐款' '' '36'. * f_sums2 = f_sums2 + tb_result-start2. * f_sume2 = f_sume2 + tb_result-end2. * f_tols1 = f_tols1 + tb_result-start1. * f_tole1 = f_tole1 + tb_result-end1. PERFORM add_row USING ' 应收利息' '106' '6' ' 应付职工薪酬' '' '37'. * f_sums2 = f_sums2 + tb_result-start2. * f_sume2 = f_sume2 + tb_result-end2. * f_tols1 = f_tols1 + tb_result-start1. * f_tole1 = f_tole1 + tb_result-end1. PERFORM add_row USING ' 应收股利 ' '107' '7' ' 应交税费' '' '38'. * f_sums2 = f_sums2 + tb_result-start2. * f_sume2 = f_sume2 + tb_result-end2. * f_tols1 = f_tols1 + tb_result-start1. * f_tole1 = f_tole1 + tb_result-end1. PERFORM add_row USING ' 其他应收款' '108' '8' ' 应付利息' '' '39'. * f_sums2 = f_sums2 + tb_result-start2. * f_sume2 = f_sume2 + tb_result-end2. * f_tols1 = f_tols1 + tb_result-start1. * f_tole1 = f_tole1 + tb_result-end1. PERFORM add_row USING ' 存货' '109' '9' ' 应付股利' '' '40'. * f_sums2 = f_sums2 + tb_result-start2. * f_sume2 = f_sume2 + tb_result-end2. * f_tols1 = f_tols1 + tb_result-start1. * f_tole1 = f_tole1 + tb_result-end1. PERFORM add_row USING ' ' '110' '' ' 其它应付款' '' '41'. * f_sums2 = f_sums2 + tb_result-start2. * f_sume2 = f_sume2 + tb_result-end2. * f_tols1 = f_tols1 + tb_result-start1. * f_tole1 = f_tole1 + tb_result-end1. PERFORM add_row USING ' 一年内到期的非流动资产' '111' '10' ' 一年内到期的非流动负债' '' '42'. * f_sums2 = f_sums2 + tb_result-start2. * f_sume2 = f_sume2 + tb_result-end2. * f_tols1 = f_tols1 + tb_result-start1. * f_tole1 = f_tole1 + tb_result-end1. PERFORM add_row USING ' 其它流动资产' '112' '11' ' 其它流动负债' '' '43'. * f_sums2 = f_sums2 + tb_result-start2. * f_sume2 = f_sume2 + tb_result-end2. * f_tols1 = f_tols1 + tb_result-start1. * f_tole1 = f_tole1 + tb_result-end1. PERFORM add_row USING ' 流动资产合计' '113' '12' ' 流动负债合计' '' '44'. CLEAR:f_sums2,f_sume2,f_tols1,f_tole1. * f_sums2 = f_sums2 + tb_result-start2. * f_sume2 = f_sume2 + tb_result-end2. * f_tols1 = f_tols1 + tb_result-start1. * f_tole1 = f_tole1 + tb_result-end1. sum13s = tb_result-start1. sum13e = tb_result-end1. sum48s = tb_result-start2. sum48e = tb_result-end2. PERFORM add_row USING '非流动资产:' '' '' '非流动负债:' '' ''. PERFORM add_row USING ' 可供出售金融资产' '114' '13' ' 长期借款' '' '45'. CLEAR:f_sums2,f_sume2. f_sums2 = f_sums2 + tb_result-start2. f_sume2 = f_sume2 + tb_result-end2. * f_tols1 = f_tols1 + tb_result-start1. * f_tole1 = f_tole1 + tb_result-end1. PERFORM add_row USING ' 持有至到期投资' '115' '14' ' 应付债券' '' '46'. f_sums2 = f_sums2 + tb_result-start2. f_sume2 = f_sume2 + tb_result-end2. * f_tols1 = f_tols1 + tb_result-start1. * f_tole1 = f_tole1 + tb_result-end1. PERFORM add_row USING ' 长期应收款' '116' '15' ' 长期应付款' '' '47'. CLEAR:f_tols1,f_tole1. f_sums2 = f_sums2 + tb_result-start2. f_sume2 = f_sume2 + tb_result-end2. f_tols1 = f_tols1 + tb_result-start1. f_tole1 = f_tole1 + tb_result-end1. PERFORM add_row USING ' 长期股权投资' '117' '16' ' 专项应付款' '' '48'. f_sums2 = f_sums2 + tb_result-start2. f_sume2 = f_sume2 + tb_result-end2. f_tols1 = f_tols1 + tb_result-start1. f_tole1 = f_tole1 + tb_result-end1. PERFORM add_row USING ' 投资性房地产' '118' '17' ' 预计负债' '' '49'. f_sums2 = f_sums2 + tb_result-start2. f_sume2 = f_sume2 + tb_result-end2. * f_tols1 = f_tols1 + tb_result-start1. * f_tole1 = f_tole1 + tb_result-end1. PERFORM add_row USING ' 固定资产' '119' '18' ' 递延所得税负债' '' '50'. f_sums2 = f_sums2 + tb_result-start2. f_sume2 = f_sume2 + tb_result-end2. f_tols1 = f_tols1 + tb_result-start1. f_tole1 = f_tole1 + tb_result-end1. PERFORM add_row USING ' 在建工程' '120' '19' ' 其他非流动负债' '' '51'. f_sums2 = f_sums2 + tb_result-start2. f_sume2 = f_sume2 + tb_result-end2. f_tols1 = f_tols1 + tb_result-start1. f_tole1 = f_tole1 + tb_result-end1. sum57s = f_sums2. sum57e = f_sume2. PERFORM add_row USING ' 工程物资' '121' '20' ' 非流动负债合计' '' '52'. f_sums2 = f_sums2 + tb_result-start2. f_sume2 = f_sume2 + tb_result-end2. f_tols1 = f_tols1 + tb_result-start1. f_tole1 = f_tole1 + tb_result-end1. PERFORM add_row USING ' 固定资产清理' '122' '21' ' 负债合计' '' '53'. f_sums2 = f_sums2 + tb_result-start2. f_sume2 = f_sume2 + tb_result-end2. f_tols1 = f_tols1 + tb_result-start1. f_tole1 = f_tole1 + tb_result-end1. PERFORM add_row USING ' 生产性生物资产' '123' '22' ' 所有者权益(或股东权益):' '' '54'. f_sums2 = f_sums2 + tb_result-start2. f_sume2 = f_sume2 + tb_result-end2. * f_tols1 = f_tols1 + tb_result-start1. * f_tole1 = f_tole1 + tb_result-end1. PERFORM add_row USING ' 油气资产' '124' '23' ' 实收资本(或股本)' '' '55'. CLEAR:f_sums2,f_sume2. f_sums2 = f_sums2 + tb_result-start2. f_sume2 = f_sume2 + tb_result-end2. * f_tols1 = f_tols1 + tb_result-start1. * f_tole1 = f_tole1 + tb_result-end1. PERFORM add_row USING ' 无形资产' '125' '24' ' 资本公积' '' '56'. f_sums2 = f_sums2 + tb_result-start2. f_sume2 = f_sume2 + tb_result-end2. f_tols1 = f_tols1 + tb_result-start1. f_tole1 = f_tole1 + tb_result-end1. PERFORM add_row USING ' 开发支出 ' '126' '25' ' 减:库存股' '' '57'. * f_sums2 = f_sums2 + tb_result-start2. * f_sume2 = f_sume2 + tb_result-end2. * f_tols1 = f_tols1 + tb_result-start1. * f_tole1 = f_tole1 + tb_result-end1. PERFORM add_row USING ' 商誉 ' '127' '26' ' 专项储备' '' '58'. * f_sums2 = f_sums2 + tb_result-start2. * f_sume2 = f_sume2 + tb_result-end2. f_tols1 = f_tols1 + tb_result-start1. f_tole1 = f_tole1 + tb_result-end1. PERFORM add_row USING ' 长摊待摊费用' '128' '27' ' 盈余公积' '' '59'. f_sums2 = f_sums2 + tb_result-start2. f_sume2 = f_sume2 + tb_result-end2. f_tols1 = f_tols1 + tb_result-start1. f_tole1 = f_tole1 + tb_result-end1. PERFORM add_row USING ' 递延所得税资产' '129' '28' ' 未分配利润' '' '60'. f_sums2 = f_sums2 + tb_result-start2. f_sume2 = f_sume2 + tb_result-end2. f_tols1 = f_tols1 + tb_result-start1. f_tole1 = f_tole1 + tb_result-end1. sum32s = f_tols1. sum32e = f_tole1. sum66s = f_sums2. sum66e = f_sume2. PERFORM add_row USING ' ' '130' '' ' 归属于母公司所有者权益合计' '' '61'. * f_sums2 = f_sums2 + tb_result-start2. * f_sume2 = f_sume2 + tb_result-end2. * f_tols1 = f_tols1 + tb_result-start1. * f_tole1 = f_tole1 + tb_result-end1. PERFORM add_row USING ' 其他非流动资产' '131' '29' ' 少数股东权益' '' '62'. * f_sums2 = f_sums2 + tb_result-start2. * f_sume2 = f_sume2 + tb_result-end2. * f_tols1 = f_tols1 + tb_result-start1. * f_tole1 = f_tole1 + tb_result-end1. PERFORM add_row USING ' 非流动资产合计:' '132' '30' ' 所有者权益(或股东权益)合计:' '' '63'. * f_sums2 = f_sums2 + tb_result-start2. * f_sume2 = f_sume2 + tb_result-end2. * f_tols1 = f_tols1 + tb_result-start1. * f_tole1 = f_tole1 + tb_result-end1. PERFORM add_row USING ' 资产总计:' '133' '31' ' 负债和所有者(或股东权益)合计:' '' '64'. * f_sums2 = f_sums2 + tb_result-start2. * f_sume2 = f_sume2 + tb_result-end2. * f_tols1 = f_tols1 + tb_result-start1. * f_tole1 = f_tole1 + tb_result-end1. ENDFORM. " CALCULATE_DATA *&---------------------------------------------------------------------* *& Form SELECT_DATA *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text * <-- p2 text *----------------------------------------------------------------------* FORM select_data . IF l_bkpf[] IS NOT INITIAL. IF i_monat = 1. SELECT ryear drcrk racct hslvt hsl01 INTO CORRESPONDING FIELDS OF TABLE t_tab FROM faglflext FOR ALL ENTRIES IN l_bkpf WHERE ryear = l_bkpf-gjahr AND RBUKRS = l_bkpf-bukrs. ELSEIF i_monat = 2. SELECT ryear drcrk racct hslvt hsl01 hsl02 INTO CORRESPONDING FIELDS OF TABLE t_tab FROM faglflext FOR ALL ENTRIES IN l_bkpf WHERE ryear = l_bkpf-gjahr AND RBUKRS = l_bkpf-bukrs. ELSEIF i_monat = 3. SELECT ryear drcrk racct hslvt hsl01 hsl02 hsl03 INTO CORRESPONDING FIELDS OF TABLE t_tab FROM faglflext FOR ALL ENTRIES IN l_bkpf WHERE ryear = l_bkpf-gjahr AND RBUKRS = l_bkpf-bukrs. ELSEIF i_monat = 4. SELECT ryear drcrk racct hslvt hsl01 hsl02 hsl03 hsl04 INTO CORRESPONDING FIELDS OF TABLE t_tab FROM faglflext FOR ALL ENTRIES IN l_bkpf WHERE ryear = l_bkpf-gjahr AND RBUKRS = l_bkpf-bukrs. ELSEIF i_monat = 5. SELECT ryear drcrk racct hslvt hsl01 hsl02 hsl03 hsl04 hsl05 INTO CORRESPONDING FIELDS OF TABLE t_tab FROM faglflext FOR ALL ENTRIES IN l_bkpf WHERE ryear = l_bkpf-gjahr AND RBUKRS = l_bkpf-bukrs. ELSEIF i_monat = 6. SELECT ryear drcrk racct hslvt hsl01 hsl02 hsl03 hsl04 hsl05 hsl06 INTO CORRESPONDING FIELDS OF TABLE t_tab FROM faglflext FOR ALL ENTRIES IN l_bkpf WHERE ryear = l_bkpf-gjahr AND RBUKRS = l_bkpf-bukrs. ELSEIF i_monat = 7. SELECT ryear drcrk racct hslvt hsl01 hsl02 hsl03 hsl04 hsl05 hsl06 hsl07 INTO CORRESPONDING FIELDS OF TABLE t_tab FROM faglflext FOR ALL ENTRIES IN l_bkpf WHERE ryear = l_bkpf-gjahr AND RBUKRS = l_bkpf-bukrs. ELSEIF i_monat = 8. SELECT ryear drcrk racct hslvt hsl01 hsl02 hsl03 hsl04 hsl05 hsl06 hsl07 hsl08 INTO CORRESPONDING FIELDS OF TABLE t_tab FROM faglflext FOR ALL ENTRIES IN l_bkpf WHERE ryear = l_bkpf-gjahr AND RBUKRS = l_bkpf-bukrs. ELSEIF i_monat = 9. SELECT ryear drcrk racct hslvt hsl01 hsl02 hsl03 hsl04 hsl05 hsl06 hsl07 hsl08 hsl09 INTO CORRESPONDING FIELDS OF TABLE t_tab FROM faglflext FOR ALL ENTRIES IN l_bkpf WHERE ryear = l_bkpf-gjahr AND RBUKRS = l_bkpf-bukrs. ELSEIF i_monat = 10. SELECT ryear drcrk racct hslvt hsl01 hsl02 hsl03 hsl04 hsl05 hsl06 hsl07 hsl08 hsl09 hsl10 INTO CORRESPONDING FIELDS OF TABLE t_tab FROM faglflext FOR ALL ENTRIES IN l_bkpf WHERE ryear = l_bkpf-gjahr AND RBUKRS = l_bkpf-bukrs. ELSEIF i_monat = 11. SELECT ryear drcrk racct hslvt hsl01 hsl02 hsl03 hsl04 hsl05 hsl06 hsl07 hsl08 hsl09 hsl10 hsl11 INTO CORRESPONDING FIELDS OF TABLE t_tab FROM faglflext FOR ALL ENTRIES IN l_bkpf WHERE ryear = l_bkpf-gjahr AND RBUKRS = l_bkpf-bukrs. ELSEIF i_monat = 12. SELECT ryear drcrk racct hslvt hsl01 hsl02 hsl03 hsl04 hsl05 hsl06 hsl07 hsl08 hsl09 hsl10 hsl11 hsl12 INTO CORRESPONDING FIELDS OF TABLE t_tab FROM faglflext FOR ALL ENTRIES IN l_bkpf WHERE ryear = l_bkpf-gjahr AND RBUKRS = l_bkpf-bukrs. ELSEIF i_monat = 13. SELECT ryear drcrk racct hslvt hsl01 hsl02 hsl03 hsl04 hsl05 hsl06 hsl07 hsl08 hsl09 hsl10 hsl11 hsl12 hsl13 INTO CORRESPONDING FIELDS OF TABLE t_tab FROM faglflext FOR ALL ENTRIES IN l_bkpf WHERE ryear = l_bkpf-gjahr AND RBUKRS = l_bkpf-bukrs. ELSEIF i_monat = 14. SELECT ryear drcrk racct hslvt hsl01 hsl02 hsl03 hsl04 hsl05 hsl06 hsl07 hsl08 hsl09 hsl10 hsl11 hsl12 hsl13 hsl14 INTO CORRESPONDING FIELDS OF TABLE t_tab FROM faglflext FOR ALL ENTRIES IN l_bkpf WHERE ryear = l_bkpf-gjahr AND RBUKRS = l_bkpf-bukrs. ELSEIF i_monat = 15. SELECT ryear drcrk racct hslvt hsl01 hsl02 hsl03 hsl04 hsl05 hsl06 hsl07 hsl08 hsl09 hsl10 hsl11 hsl12 hsl13 hsl14 hsl15 INTO CORRESPONDING FIELDS OF TABLE t_tab FROM faglflext FOR ALL ENTRIES IN l_bkpf WHERE ryear = l_bkpf-gjahr AND RBUKRS = l_bkpf-bukrs. ELSEIF i_monat = 16. SELECT ryear drcrk racct hslvt hsl01 hsl02 hsl03 hsl04 hsl05 hsl06 hsl07 hsl08 hsl09 hsl10 hsl11 hsl12 hsl13 hsl14 hsl15 hsl16 INTO CORRESPONDING FIELDS OF TABLE t_tab FROM faglflext FOR ALL ENTRIES IN l_bkpf WHERE ryear = l_bkpf-gjahr AND RBUKRS = l_bkpf-bukrs. ENDIF. ENDIF. ENDFORM. " SELECT_DATA *&---------------------------------------------------------------------* *& Form ADD_ROW *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * -->P_0588 text * -->P_0589 text * -->P_0590 text * -->P_0591 text * -->P_0592 text * -->P_0593 text *----------------------------------------------------------------------* FORM add_row USING a_asset1 a_km1 a_row1 "资产科目行号 a_asset2 a_km2 a_row2. CLEAR tb_result. "清空结果表 tb_result-asset1 = a_asset1. "资产项目 tb_result-row1 = a_row1. "行次 tb_result-asset2 = a_asset2. "资产项目 tb_result-row2 = a_row2. "行次 IF a_km1 = '101'. LOOP AT t_tab WHERE ( racct >= '1001000000' AND racct =< '1002999999' ) OR ( racct >= '1012000000' AND racct =< '1012999999' ). MOVE-CORRESPONDING t_tab TO t_101. COLLECT t_101. ENDLOOP. LOOP AT t_101. tb_result-start1 = t_101-hslvt. tb_result-end1 = t_101-hslvt + t_101-hsl01 + t_101-hsl02 + t_101-hsl03 + t_101-hsl04 + t_101-hsl05 + t_101-hsl06 + t_101-hsl07 + t_101-hsl08 + t_101-hsl09 + t_101-hsl10 + t_101-hsl11 + t_101-hsl12 + t_101-hsl13 + t_101-hsl14 + t_101-hsl15 + t_101-hsl16. ENDLOOP. CLEAR: t_101,t_101[]. ******************************************************************** LOOP AT t_tab WHERE racct >= '2001000000' AND racct =< '2001999999' . MOVE-CORRESPONDING t_tab TO t_101. COLLECT t_101. ENDLOOP. LOOP AT t_101. tb_result-start2 = - t_101-hslvt. tb_result-end2 = - ( t_101-hslvt + t_101-hsl01 + t_101-hsl02 + t_101-hsl03 + t_101-hsl04 + t_101-hsl05 + t_101-hsl06 + t_101-hsl07 + t_101-hsl08 + t_101-hsl09 + t_101-hsl10 + t_101-hsl11 + t_101-hsl12 + t_101-hsl13 + t_101-hsl14 + t_101-hsl15 + t_101-hsl16 ). ENDLOOP. CLEAR: t_101,t_101[]. ****************************************************************** ***************************************************************** ELSEIF a_km1 = '102'. CLEAR: t_101,t_101[]. LOOP AT t_tab WHERE racct >= '2101000000' AND racct =< '2101999999' . MOVE-CORRESPONDING t_tab TO t_101. COLLECT t_101. ENDLOOP. LOOP AT t_101. tb_result-start2 = 0 - t_101-hslvt. tb_result-end2 = 0 - ( t_101-hslvt + t_101-hsl01 + t_101-hsl02 + t_101-hsl03 + t_101-hsl04 + t_101-hsl05 + t_101-hsl06 + t_101-hsl07 + t_101-hsl08 + t_101-hsl09 + t_101-hsl10 + t_101-hsl11 + t_101-hsl12 + t_101-hsl13 + t_101-hsl14 + t_101-hsl15 + t_101-hsl16 ). ENDLOOP. CLEAR: t_101,t_101[]. ******************************************************************* ***************************************************************** ELSEIF a_km1 = '103'. CLEAR: t_101,t_101[]. LOOP AT t_tab WHERE racct >= '1121000000' AND racct =< '1121999999' . MOVE-CORRESPONDING t_tab TO t_101. COLLECT t_101. ENDLOOP. LOOP AT t_101. tb_result-start1 = t_101-hslvt. tb_result-end1 = t_101-hslvt + t_101-hsl01 + t_101-hsl02 + t_101-hsl03 + t_101-hsl04 + t_101-hsl05 + t_101-hsl06 + t_101-hsl07 + t_101-hsl08 + t_101-hsl09 + t_101-hsl10 + t_101-hsl11 + t_101-hsl12 + t_101-hsl13 + t_101-hsl14 + t_101-hsl15 + t_101-hsl16 . ENDLOOP. CLEAR: t_101,t_101[]. ************************************************ LOOP AT t_tab WHERE racct >= '2201000000' AND racct =< '2201999999' . MOVE-CORRESPONDING t_tab TO t_101. COLLECT t_101. ENDLOOP. LOOP AT t_101. tb_result-start2 = - t_101-hslvt. tb_result-end2 = - ( t_101-hslvt + t_101-hsl01 + t_101-hsl02 + t_101-hsl03 + t_101-hsl04 + t_101-hsl05 + t_101-hsl06 + t_101-hsl07 + t_101-hsl08 + t_101-hsl09 + t_101-hsl10 + t_101-hsl11 + t_101-hsl12 + t_101-hsl13 + t_101-hsl14 + t_101-hsl15 + t_101-hsl16 ). ENDLOOP. CLEAR: t_101,t_101[]. ********************************************************************** ********************************************************************** ELSEIF a_km1 = '104'. CLEAR:num01,num02,num03,num04,NUM05,NUM06. CLEAR: t_101,t_101[],t_102,t_102[]. LOOP AT t_tab WHERE racct >= '1122000000' AND racct =< '1122999999' AND drcrk = 'S' . MOVE-CORRESPONDING t_tab TO t_101. COLLECT t_101. ENDLOOP. LOOP AT t_101. * tb_result-start1 num01 = t_101-hslvt. * tb_result-end1 num02 = t_101-hslvt + t_101-hsl01 + t_101-hsl02 + t_101-hsl03 + t_101-hsl04 + t_101-hsl05 + t_101-hsl06 + t_101-hsl07 + t_101-hsl08 + t_101-hsl09 + t_101-hsl10 + t_101-hsl11 + t_101-hsl12 + t_101-hsl13 + t_101-hsl14 + t_101-hsl15 + t_101-hsl16 . ENDLOOP. CLEAR: t_101,t_101[]. LOOP AT t_tab WHERE racct = '1231010100'. MOVE-CORRESPONDING t_tab TO t_102. COLLECT t_102. ENDLOOP. LOOP AT t_102. num03 = - t_102-hslvt. * tb_result-end1 num04 = - ( t_102-hslvt + t_102-hsl01 + t_102-hsl02 + t_102-hsl03 + t_102-hsl04 + t_102-hsl05 + t_102-hsl06 + t_102-hsl07 + t_102-hsl08 + t_102-hsl09 + t_102-hsl10 + t_102-hsl11 + t_102-hsl12 + t_102-hsl13 + t_102-hsl14 + t_102-hsl15 + t_102-hsl16 ). ENDLOOP. CLEAR:t_102,t_102[]. tb_result-start1 = num01 + num03. tb_result-end1 = num02 + num04. ******************************************** LOOP AT t_tab WHERE racct >= '2202000000' AND racct =< '2202999999' AND drcrk = 'H' . MOVE-CORRESPONDING t_tab TO t_101. COLLECT t_101. ENDLOOP. LOOP AT t_101. tb_result-start2 = - t_101-hslvt. tb_result-end2 = - ( t_101-hslvt + t_101-hsl01 + t_101-hsl02 + t_101-hsl03 + t_101-hsl04 + t_101-hsl05 + t_101-hsl06 + t_101-hsl07 + t_101-hsl08 + t_101-hsl09 + t_101-hsl10 + t_101-hsl11 + t_101-hsl12 + t_101-hsl13 + t_101-hsl14 + t_101-hsl15 + t_101-hsl16 ). ENDLOOP. CLEAR: t_101,t_101[]. ***************************************************************** ***************************************************************************** ELSEIF a_km1 = '105'. CLEAR: t_101,t_101[]. LOOP AT t_tab WHERE racct >= '2202000000' AND racct =< '2202999999' AND drcrk = 'S'. MOVE-CORRESPONDING t_tab TO t_101. COLLECT t_101. ENDLOOP. LOOP AT t_101. tb_result-start1 = t_101-hslvt. tb_result-end1 = t_101-hslvt + t_101-hsl01 + t_101-hsl02 + t_101-hsl03 + t_101-hsl04 + t_101-hsl05 + t_101-hsl06 + t_101-hsl07 + t_101-hsl08 + t_101-hsl09 + t_101-hsl10 + t_101-hsl11 + t_101-hsl12 + t_101-hsl13 + t_101-hsl14 + t_101-hsl15 + t_101-hsl16 . ENDLOOP. CLEAR: t_101,t_101[]. ************************************************ LOOP AT t_tab WHERE racct >= '1122000000' AND racct =< '1122999999' AND drcrk = 'S' . MOVE-CORRESPONDING t_tab TO t_101. COLLECT t_101. ENDLOOP. LOOP AT t_101. tb_result-start2 = - t_101-hslvt. tb_result-end2 = - ( t_101-hslvt + t_101-hsl01 + t_101-hsl02 + t_101-hsl03 + t_101-hsl04 + t_101-hsl05 + t_101-hsl06 + t_101-hsl07 + t_101-hsl08 + t_101-hsl09 + t_101-hsl10 + t_101-hsl11 + t_101-hsl12 + t_101-hsl13 + t_101-hsl14 + t_101-hsl15 + t_101-hsl16 ). ENDLOOP. CLEAR: t_101,t_101[]. ******************************************************* , ***************************************************************************** ELSEIF a_km1 = '106'. CLEAR: t_101,t_101[]. LOOP AT t_tab WHERE racct >= '1132000000' AND racct =< '1132999999' . MOVE-CORRESPONDING t_tab TO t_101. COLLECT t_101. ENDLOOP. LOOP AT t_101. tb_result-start1 = t_101-hslvt. tb_result-end1 = t_101-hslvt + t_101-hsl01 + t_101-hsl02 + t_101-hsl03 + t_101-hsl04 + t_101-hsl05 + t_101-hsl06 + t_101-hsl07 + t_101-hsl08 + t_101-hsl09 + t_101-hsl10 + t_101-hsl11 + t_101-hsl12 + t_101-hsl13 + t_101-hsl14 + t_101-hsl15 + t_101-hsl16 . ENDLOOP. CLEAR: t_101,t_101[]. * *********************************************** LOOP AT t_tab WHERE racct >= '2211000000' AND racct =< '2211999999'. MOVE-CORRESPONDING t_tab TO t_101. COLLECT t_101. ENDLOOP. LOOP AT t_101. tb_result-start2 = - t_101-hslvt. tb_result-end2 = - ( t_101-hslvt + t_101-hsl01 + t_101-hsl02 + t_101-hsl03 + t_101-hsl04 + t_101-hsl05 + t_101-hsl06 + t_101-hsl07 + t_101-hsl08 + t_101-hsl09 + t_101-hsl10 + t_101-hsl11 + t_101-hsl12 + t_101-hsl13 + t_101-hsl14 + t_101-hsl15 + t_101-hsl16 ). ENDLOOP. CLEAR: t_101,t_101[]. *********************************************************** ********************************************************************* ELSEIF a_km1 = '107'. CLEAR: t_101,t_101[]. LOOP AT t_tab WHERE racct >= '1131000000' AND racct =< '1131999999' . MOVE-CORRESPONDING t_tab TO t_101. COLLECT t_101. ENDLOOP. LOOP AT t_101. tb_result-start1 = t_101-hslvt. tb_result-end1 = t_101-hslvt + t_101-hsl01 + t_101-hsl02 + t_101-hsl03 + t_101-hsl04 + t_101-hsl05 + t_101-hsl06 + t_101-hsl07 + t_101-hsl08 + t_101-hsl09 + t_101-hsl10 + t_101-hsl11 + t_101-hsl12 + t_101-hsl13 + t_101-hsl14 + t_101-hsl15 + t_101-hsl16 . ENDLOOP. CLEAR: t_101,t_101[]. * *********************************************** LOOP AT t_tab WHERE racct >= '2221000000' AND racct =< '2221999999'. MOVE-CORRESPONDING t_tab TO t_101. COLLECT t_101. ENDLOOP. LOOP AT t_101. tb_result-start2 = - t_101-hslvt. tb_result-end2 = - ( t_101-hslvt + t_101-hsl01 + t_101-hsl02 + t_101-hsl03 + t_101-hsl04 + t_101-hsl05 + t_101-hsl06 + t_101-hsl07 + t_101-hsl08 + t_101-hsl09 + t_101-hsl10 + t_101-hsl11 + t_101-hsl12 + t_101-hsl13 + t_101-hsl14 + t_101-hsl15 + t_101-hsl16 ). ENDLOOP. CLEAR: t_101,t_101[]. ************************************************************************ ************************************************************************ ELSEIF a_km1 = '108'. CLEAR:num01,num02,num03,num04. CLEAR: t_101,t_101[],t_102,t_102[]. LOOP AT t_tab WHERE ( racct >= '1221000000' AND racct =< '1221999999' AND drcrk = 'S') OR ( racct >= '2241000000' AND racct =< '2241999999' AND drcrk = 'S' ). MOVE-CORRESPONDING t_tab TO t_101. COLLECT t_101. ENDLOOP. LOOP AT t_101. * tb_result-start1 num01 = t_101-hslvt. * tb_result-end1 num02 = t_101-hslvt + t_101-hsl01 + t_101-hsl02 + t_101-hsl03 + t_101-hsl04 + t_101-hsl05 + t_101-hsl06 + t_101-hsl07 + t_101-hsl08 + t_101-hsl09 + t_101-hsl10 + t_101-hsl11 + t_101-hsl12 + t_101-hsl13 + t_101-hsl14 + t_101-hsl15 + t_101-hsl16 . ENDLOOP. CLEAR: t_101,t_101[]. LOOP AT t_tab WHERE racct >= '1231010200' AND racct =< '1231010299'. MOVE-CORRESPONDING t_tab TO t_102. COLLECT t_102. ENDLOOP. LOOP AT t_102. num03 = - t_102-hslvt. * tb_result-end1 num04 = - ( t_102-hslvt + t_102-hsl01 + t_102-hsl02 + t_102-hsl03 + t_102-hsl04 + t_102-hsl05 + t_102-hsl06 + t_102-hsl07 + t_102-hsl08 + t_102-hsl09 + t_102-hsl10 + t_102-hsl11 + t_102-hsl12 + t_102-hsl13 + t_102-hsl14 + t_102-hsl15 + t_102-hsl16 ). ENDLOOP. CLEAR:t_102,t_102[]. tb_result-start1 = num01 + num03. tb_result-end1 = num02 + num04. ******************************************** LOOP AT t_tab WHERE racct >= '2231000000' AND racct =< '2231999999' . MOVE-CORRESPONDING t_tab TO t_101. COLLECT t_101. ENDLOOP. LOOP AT t_101. tb_result-start2 = - t_101-hslvt. tb_result-end2 = - ( t_101-hslvt + t_101-hsl01 + t_101-hsl02 + t_101-hsl03 + t_101-hsl04 + t_101-hsl05 + t_101-hsl06 + t_101-hsl07 + t_101-hsl08 + t_101-hsl09 + t_101-hsl10 + t_101-hsl11 + t_101-hsl12 + t_101-hsl13 + t_101-hsl14 + t_101-hsl15 + t_101-hsl16 ). ENDLOOP. CLEAR: t_101,t_101[]. ******************************************** ****************************************** ELSEIF a_km1 = '109'. CLEAR:num01,num02. CLEAR: t_101,t_101[],t_102,t_102[]. LOOP AT t_tab WHERE ( racct >= '1401000000' AND racct =< '1403999999') OR ( racct >= '1405000000' AND racct =< '1406999999') OR ( racct >= '1408000000' AND racct =< '1408999999') OR ( racct >= '5001000000' AND racct =< '5001999999') OR ( racct >= '5201000000' AND racct =< '5201999999') OR ( racct >= '5301000000' AND racct =< '5301999999') OR ( racct >= '5401000000' AND racct =< '5401999999' ). MOVE-CORRESPONDING t_tab TO t_101. COLLECT t_101. ENDLOOP. LOOP AT t_101. * tb_result-start1 num01 = t_101-hslvt. * tb_result-end1 num02 = t_101-hslvt + t_101-hsl01 + t_101-hsl02 + t_101-hsl03 + t_101-hsl04 + t_101-hsl05 + t_101-hsl06 + t_101-hsl07 + t_101-hsl08 + t_101-hsl09 + t_101-hsl10 + t_101-hsl11 + t_101-hsl12 + t_101-hsl13 + t_101-hsl14 + t_101-hsl15 + t_101-hsl16 . ENDLOOP. CLEAR: t_101,t_101[]. LOOP AT t_tab WHERE racct >= '1471000000' AND racct =< '1471999999'. MOVE-CORRESPONDING t_tab TO t_102. COLLECT t_102. ENDLOOP. LOOP AT t_102. num03 = - t_102-hslvt. * tb_result-end1 num04 = - ( t_102-hslvt + t_102-hsl01 + t_102-hsl02 + t_102-hsl03 + t_102-hsl04 + t_102-hsl05 + t_102-hsl06 + t_102-hsl07 + t_102-hsl08 + t_102-hsl09 + t_102-hsl10 + t_102-hsl11 + t_102-hsl12 + t_102-hsl13 + t_102-hsl14 + t_102-hsl15 + t_102-hsl16 ). ENDLOOP. CLEAR:t_102,t_102[]. tb_result-start1 = num01 + num03. tb_result-end1 = num02 + num04. ******************************************** LOOP AT t_tab WHERE racct >= '2232000000' AND racct =< '2232999999' . MOVE-CORRESPONDING t_tab TO t_101. COLLECT t_101. ENDLOOP. LOOP AT t_101. tb_result-start2 = - t_101-hslvt. tb_result-end2 = - ( t_101-hslvt + t_101-hsl01 + t_101-hsl02 + t_101-hsl03 + t_101-hsl04 + t_101-hsl05 + t_101-hsl06 + t_101-hsl07 + t_101-hsl08 + t_101-hsl09 + t_101-hsl10 + t_101-hsl11 + t_101-hsl12 + t_101-hsl13 + t_101-hsl14 + t_101-hsl15 + t_101-hsl16 ). ENDLOOP. CLEAR: t_101,t_101[]. **************************************************************************************** *********************************************************************************** ELSEIF a_km1 = '110'. CLEAR: t_101,t_101[],t_102,t_102[]. LOOP AT t_tab WHERE ( racct >= '2241000000' AND racct =< '2241999999' AND drcrk = 'H') OR ( racct >= '1221000000' AND racct =< '1221999999' AND drcrk = 'H' ). MOVE-CORRESPONDING t_tab TO t_101. COLLECT t_101. ENDLOOP. LOOP AT t_101. tb_result-start2 = 0 - t_101-hslvt. tb_result-end2 = 0 - ( t_101-hslvt + t_101-hsl01 + t_101-hsl02 + t_101-hsl03 + t_101-hsl04 + t_101-hsl05 + t_101-hsl06 + t_101-hsl07 + t_101-hsl08 + t_101-hsl09 + t_101-hsl10 + t_101-hsl11 + t_101-hsl12 + t_101-hsl13 + t_101-hsl14 + t_101-hsl15 + t_101-hsl16 ). ENDLOOP. CLEAR: t_101,t_101[]. ******************************************** ********************************************************* ELSEIF a_km1 = '112'. CLEAR: t_101,t_101[],t_102,t_102[]. LOOP AT t_tab WHERE racct >= '1901000000' AND racct =< '1901999999'. MOVE-CORRESPONDING t_tab TO t_101. COLLECT t_101. ENDLOOP. LOOP AT t_101. tb_result-start1 = t_101-hslvt. tb_result-end1 = t_101-hslvt + t_101-hsl01 + t_101-hsl02 + t_101-hsl03 + t_101-hsl04 + t_101-hsl05 + t_101-hsl06 + t_101-hsl07 + t_101-hsl08 + t_101-hsl09 + t_101-hsl10 + t_101-hsl11 + t_101-hsl12 + t_101-hsl13 + t_101-hsl14 + t_101-hsl15 + t_101-hsl16 . ENDLOOP. CLEAR: t_101,t_101[]. ************************************************************************************************ ************************************************************************************************** ELSEIF a_km1 = '113'. LOOP AT tb_result. MOVE-CORRESPONDING tb_result to tt_result. COLLECT tt_result. ENDLOOP. LOOP AT tt_result. tb_result-start1 = tt_result-start1. tb_result-end1 = tt_result-end1. tb_result-start2 = tt_result-start2. tb_result-end2 = tt_result-end2. ENDLOOP. tb_result-asset1 = a_asset1. "资产项目 tb_result-row1 = a_row1. "行次 tb_result-asset2 = a_asset2. "资产项目 tb_result-row2 = a_row2. "行次 ******************************************** ********************************************************* ELSEIF a_km1 = '114'. CLEAR: t_101,t_101[],t_102,t_102[]. LOOP AT t_tab WHERE racct >= '2501000000' AND racct =< '2501999999'. MOVE-CORRESPONDING t_tab TO t_101. COLLECT t_101. ENDLOOP. LOOP AT t_101. tb_result-start2 = 0 - t_101-hslvt. tb_result-end2 = 0 - ( t_101-hslvt + t_101-hsl01 + t_101-hsl02 + t_101-hsl03 + t_101-hsl04 + t_101-hsl05 + t_101-hsl06 + t_101-hsl07 + t_101-hsl08 + t_101-hsl09 + t_101-hsl10 + t_101-hsl11 + t_101-hsl12 + t_101-hsl13 + t_101-hsl14 + t_101-hsl15 + t_101-hsl16 ). ENDLOOP. CLEAR: t_101,t_101[]. ******************************************** ********************************************************* ELSEIF a_km1 = '115'. CLEAR: t_101,t_101[],t_102,t_102[]. LOOP AT t_tab WHERE racct >= '2502000000' AND racct =< '2502999999'. MOVE-CORRESPONDING t_tab TO t_101. COLLECT t_101. ENDLOOP. LOOP AT t_101. tb_result-start2 = 0 - t_101-hslvt. tb_result-end2 = 0 - ( t_101-hslvt + t_101-hsl01 + t_101-hsl02 + t_101-hsl03 + t_101-hsl04 + t_101-hsl05 + t_101-hsl06 + t_101-hsl07 + t_101-hsl08 + t_101-hsl09 + t_101-hsl10 + t_101-hsl11 + t_101-hsl12 + t_101-hsl13 + t_101-hsl14 + t_101-hsl15 + t_101-hsl16 ). ENDLOOP. CLEAR: t_101,t_101[]. **************************************************************************************************** ********************************************************************************************* ELSEIF a_km1 = '116'. CLEAR:num01,num02,num03,num04. CLEAR: t_101,t_101[],t_102,t_102[]. LOOP AT t_tab WHERE ( racct >= '1531000000' AND racct =< '1531999999'). MOVE-CORRESPONDING t_tab TO t_101. COLLECT t_101. ENDLOOP. LOOP AT t_101. * tb_result-start1 num01 = t_101-hslvt. * tb_result-end1 num02 = t_101-hslvt + t_101-hsl01 + t_101-hsl02 + t_101-hsl03 + t_101-hsl04 + t_101-hsl05 + t_101-hsl06 + t_101-hsl07 + t_101-hsl08 + t_101-hsl09 + t_101-hsl10 + t_101-hsl11 + t_101-hsl12 + t_101-hsl13 + t_101-hsl14 + t_101-hsl15 + t_101-hsl16 . ENDLOOP. CLEAR: t_101,t_101[]. LOOP AT t_tab WHERE racct = '1231010600'. MOVE-CORRESPONDING t_tab TO t_102. COLLECT t_102. ENDLOOP. LOOP AT t_102. num03 = - t_102-hslvt. * tb_result-end1 num04 = - ( t_102-hslvt + t_102-hsl01 + t_102-hsl02 + t_102-hsl03 + t_102-hsl04 + t_102-hsl05 + t_102-hsl06 + t_102-hsl07 + t_102-hsl08 + t_102-hsl09 + t_102-hsl10 + t_102-hsl11 + t_102-hsl12 + t_102-hsl13 + t_102-hsl14 + t_102-hsl15 + t_102-hsl16 ). ENDLOOP. CLEAR:t_102,t_102[]. tb_result-start1 = num01 + num03. tb_result-end1 = num02 + num04. ****************************************************************** CLEAR:num01,num02,num03,num04. CLEAR: t_101,t_101[],t_102,t_102[]. LOOP AT t_tab WHERE ( racct >= '2701000000' AND racct =< '2701999999'). MOVE-CORRESPONDING t_tab TO t_101. COLLECT t_101. ENDLOOP. LOOP AT t_101. num01 = t_101-hslvt. num02 = t_101-hslvt + t_101-hsl01 + t_101-hsl02 + t_101-hsl03 + t_101-hsl04 + t_101-hsl05 + t_101-hsl06 + t_101-hsl07 + t_101-hsl08 + t_101-hsl09 + t_101-hsl10 + t_101-hsl11 + t_101-hsl12 + t_101-hsl13 + t_101-hsl14 + t_101-hsl15 + t_101-hsl16 . ENDLOOP. CLEAR: t_101,t_101[]. LOOP AT t_tab WHERE ( racct >= '2702000000' AND racct =< '2702999999'). MOVE-CORRESPONDING t_tab TO t_102. COLLECT t_102. ENDLOOP. LOOP AT t_102. num03 = - t_102-hslvt. num04 = - ( t_102-hslvt + t_102-hsl01 + t_102-hsl02 + t_102-hsl03 + t_102-hsl04 + t_102-hsl05 + t_102-hsl06 + t_102-hsl07 + t_102-hsl08 + t_102-hsl09 + t_102-hsl10 + t_102-hsl11 + t_102-hsl12 + t_102-hsl13 + t_102-hsl14 + t_102-hsl15 + t_102-hsl16 ). ENDLOOP. CLEAR:t_102,t_102[]. tb_result-start2 = 0 - ( num01 + num03 ). tb_result-end2 = 0 - ( num02 + num04 ). ************************************************************************************************** ******************************************************************************************************* ELSEIF a_km1 = '117'. CLEAR:num01,num02,num03,num04. CLEAR: t_101,t_101[],t_102,t_102[]. LOOP AT t_tab WHERE racct >= '1511000000' AND racct =< '1511999999'. MOVE-CORRESPONDING t_tab TO t_101. COLLECT t_101. ENDLOOP. LOOP AT t_101. num01 = t_101-hslvt. num02 = t_101-hslvt + t_101-hsl01 + t_101-hsl02 + t_101-hsl03 + t_101-hsl04 + t_101-hsl05 + t_101-hsl06 + t_101-hsl07 + t_101-hsl08 + t_101-hsl09 + t_101-hsl10 + t_101-hsl11 + t_101-hsl12 + t_101-hsl13 + t_101-hsl14 + t_101-hsl15 + t_101-hsl16 . ENDLOOP. CLEAR: t_101,t_101[]. LOOP AT t_tab WHERE racct >= '1512000000' AND racct =< '1512999999'. MOVE-CORRESPONDING t_tab TO t_102. COLLECT t_102. ENDLOOP. LOOP AT t_102. num03 = 0 - t_102-hslvt. num04 = 0 - ( t_102-hslvt + t_102-hsl01 + t_102-hsl02 + t_102-hsl03 + t_102-hsl04 + t_102-hsl05 + t_102-hsl06 + t_102-hsl07 + t_102-hsl08 + t_102-hsl09 + t_102-hsl10 + t_102-hsl11 + t_102-hsl12 + t_102-hsl13 + t_102-hsl14 + t_102-hsl15 + t_102-hsl16 ). ENDLOOP. CLEAR:t_102,t_102[]. tb_result-start1 = num01 + num03. tb_result-end1 = num02 + num04. ************************************************************************* CLEAR: t_101,t_101[],t_102,t_102[]. LOOP AT t_tab WHERE racct >= '2711000000' AND racct =< '2711999999'. MOVE-CORRESPONDING t_tab TO t_101. COLLECT t_101. ENDLOOP. LOOP AT t_101. tb_result-start2 = 0 - t_101-hslvt. tb_result-end2 = 0 - ( t_101-hslvt + t_101-hsl01 + t_101-hsl02 + t_101-hsl03 + t_101-hsl04 + t_101-hsl05 + t_101-hsl06 + t_101-hsl07 + t_101-hsl08 + t_101-hsl09 + t_101-hsl10 + t_101-hsl11 + t_101-hsl12 + t_101-hsl13 + t_101-hsl14 + t_101-hsl15 + t_101-hsl16 ). ENDLOOP. CLEAR: t_101,t_101[]. ************************************************************************** ************************************************** ELSEIF a_km1 = '118'. CLEAR: t_101,t_101[],t_102,t_102[]. LOOP AT t_tab WHERE racct >= '2801000000' AND racct =< '2801999999'. MOVE-CORRESPONDING t_tab TO t_101. COLLECT t_101. ENDLOOP. LOOP AT t_101. tb_result-start2 = 0 - t_101-hslvt. tb_result-end2 = 0 - ( t_101-hslvt + t_101-hsl01 + t_101-hsl02 + t_101-hsl03 + t_101-hsl04 + t_101-hsl05 + t_101-hsl06 + t_101-hsl07 + t_101-hsl08 + t_101-hsl09 + t_101-hsl10 + t_101-hsl11 + t_101-hsl12 + t_101-hsl13 + t_101-hsl14 + t_101-hsl15 + t_101-hsl16 ). ENDLOOP. CLEAR: t_101,t_101[]. ************************************************************************************* ******************************************************************************************** ELSEIF a_km1 = '119'. CLEAR:num01,num02,num03,num04,num05,num06. CLEAR: t_101,t_101[],t_102,t_102[]. LOOP AT t_tab WHERE racct >= '1601000000' AND racct =< '16011999999'. MOVE-CORRESPONDING t_tab TO t_101. COLLECT t_101. ENDLOOP. LOOP AT t_101. num01 = t_101-hslvt. num02 = t_101-hslvt + t_101-hsl01 + t_101-hsl02 + t_101-hsl03 + t_101-hsl04 + t_101-hsl05 + t_101-hsl06 + t_101-hsl07 + t_101-hsl08 + t_101-hsl09 + t_101-hsl10 + t_101-hsl11 + t_101-hsl12 + t_101-hsl13 + t_101-hsl14 + t_101-hsl15 + t_101-hsl16 . ENDLOOP. CLEAR: t_101,t_101[]. LOOP AT t_tab WHERE racct >= '1602000000' AND racct =< '1602999999'. MOVE-CORRESPONDING t_tab TO t_102. COLLECT t_102. ENDLOOP. LOOP AT t_102. num03 = 0 - t_102-hslvt. num04 = 0 - ( t_102-hslvt + t_102-hsl01 + t_102-hsl02 + t_102-hsl03 + t_102-hsl04 + t_102-hsl05 + t_102-hsl06 + t_102-hsl07 + t_102-hsl08 + t_102-hsl09 + t_102-hsl10 + t_102-hsl11 + t_102-hsl12 + t_102-hsl13 + t_102-hsl14 + t_102-hsl15 + t_102-hsl16 ). ENDLOOP. CLEAR:t_102,t_102[]. LOOP AT t_tab WHERE racct >= '1603000000' AND racct =< '1603999999'. MOVE-CORRESPONDING t_tab TO t_102. COLLECT t_102. ENDLOOP. LOOP AT t_102. num05 = 0 - t_102-hslvt. num06 = 0 - ( t_102-hslvt + t_102-hsl01 + t_102-hsl02 + t_102-hsl03 + t_102-hsl04 + t_102-hsl05 + t_102-hsl06 + t_102-hsl07 + t_102-hsl08 + t_102-hsl09 + t_102-hsl10 + t_102-hsl11 + t_102-hsl12 + t_102-hsl13 + t_102-hsl14 + t_102-hsl15 + t_102-hsl16 ). ENDLOOP. CLEAR:t_102,t_102[]. tb_result-start1 = num01 + num03 + num05. tb_result-end1 = num02 + num04 + num06. *************************************************************************** CLEAR: t_101,t_101[],t_102,t_102[]. LOOP AT t_tab WHERE racct >= '2901000000' AND racct =< '2901999999'. MOVE-CORRESPONDING t_tab TO t_101. COLLECT t_101. ENDLOOP. LOOP AT t_101. tb_result-start2 = 0 - t_101-hslvt. tb_result-end2 = 0 - ( t_101-hslvt + t_101-hsl01 + t_101-hsl02 + t_101-hsl03 + t_101-hsl04 + t_101-hsl05 + t_101-hsl06 + t_101-hsl07 + t_101-hsl08 + t_101-hsl09 + t_101-hsl10 + t_101-hsl11 + t_101-hsl12 + t_101-hsl13 + t_101-hsl14 + t_101-hsl15 + t_101-hsl16 ). ENDLOOP. *********************************************************************************** *********************************************************************************************** ELSEIF a_km1 = '120'. CLEAR:num01,num02,num03,num04. CLEAR: t_101,t_101[],t_102,t_102[]. LOOP AT t_tab WHERE racct >= '1604000000' AND racct =< '1604999999'. MOVE-CORRESPONDING t_tab TO t_101. COLLECT t_101. ENDLOOP. LOOP AT t_101. num01 = t_101-hslvt. num02 = t_101-hslvt + t_101-hsl01 + t_101-hsl02 + t_101-hsl03 + t_101-hsl04 + t_101-hsl05 + t_101-hsl06 + t_101-hsl07 + t_101-hsl08 + t_101-hsl09 + t_101-hsl10 + t_101-hsl11 + t_101-hsl12 + t_101-hsl13 + t_101-hsl14 + t_101-hsl15 + t_101-hsl16 . ENDLOOP. CLEAR: t_101,t_101[]. LOOP AT t_tab WHERE racct >= '1609000000' AND racct =< '1609999999'. MOVE-CORRESPONDING t_tab TO t_102. COLLECT t_102. ENDLOOP. LOOP AT t_102. num03 = 0 - t_102-hslvt. num04 = 0 - ( t_102-hslvt + t_102-hsl01 + t_102-hsl02 + t_102-hsl03 + t_102-hsl04 + t_102-hsl05 + t_102-hsl06 + t_102-hsl07 + t_102-hsl08 + t_102-hsl09 + t_102-hsl10 + t_102-hsl11 + t_102-hsl12 + t_102-hsl13 + t_102-hsl14 + t_102-hsl15 + t_102-hsl16 ). ENDLOOP. CLEAR:t_102,t_102[]. tb_result-start1 = num01 + num03 . tb_result-end1 = num02 + num04 . ************************************************************** CLEAR: t_101,t_101[],t_102,t_102[]. LOOP AT t_tab WHERE racct >= '2401000000' AND racct =< '2401999999'. MOVE-CORRESPONDING t_tab TO t_101. COLLECT t_101. ENDLOOP. LOOP AT t_101. tb_result-start2 = 0 - t_101-hslvt. tb_result-end2 = 0 - ( t_101-hslvt + t_101-hsl01 + t_101-hsl02 + t_101-hsl03 + t_101-hsl04 + t_101-hsl05 + t_101-hsl06 + t_101-hsl07 + t_101-hsl08 + t_101-hsl09 + t_101-hsl10 + t_101-hsl11 + t_101-hsl12 + t_101-hsl13 + t_101-hsl14 + t_101-hsl15 + t_101-hsl16 ). ENDLOOP. ******************************************************************************** ******************************************************************************************* ELSEIF a_km1 = '121'. CLEAR:num01,num02,num03,num04. CLEAR: t_101,t_101[],t_102,t_102[]. LOOP AT t_tab WHERE racct >= '1605000000' AND racct =< '1605999999'. MOVE-CORRESPONDING t_tab TO t_101. COLLECT t_101. ENDLOOP. LOOP AT t_101. num01 = t_101-hslvt. num02 = t_101-hslvt + t_101-hsl01 + t_101-hsl02 + t_101-hsl03 + t_101-hsl04 + t_101-hsl05 + t_101-hsl06 + t_101-hsl07 + t_101-hsl08 + t_101-hsl09 + t_101-hsl10 + t_101-hsl11 + t_101-hsl12 + t_101-hsl13 + t_101-hsl14 + t_101-hsl15 + t_101-hsl16 . ENDLOOP. CLEAR: t_101,t_101[]. LOOP AT t_tab WHERE racct >= '1610000000' AND racct =< '1610999999'. MOVE-CORRESPONDING t_tab TO t_102. COLLECT t_102. ENDLOOP. LOOP AT t_102. num03 = 0 - t_102-hslvt. num04 = 0 - ( t_102-hslvt + t_102-hsl01 + t_102-hsl02 + t_102-hsl03 + t_102-hsl04 + t_102-hsl05 + t_102-hsl06 + t_102-hsl07 + t_102-hsl08 + t_102-hsl09 + t_102-hsl10 + t_102-hsl11 + t_102-hsl12 + t_102-hsl13 + t_102-hsl14 + t_102-hsl15 + t_102-hsl16 ). ENDLOOP. CLEAR:t_102,t_102[]. tb_result-start1 = num01 + num03 . tb_result-end1 = num02 + num04 . *************************************** tb_result-start2 = sum57s. tb_result-end2 = sum57e. ********************************************************** *************************************************************** ELSEIF a_km1 = '122'. CLEAR: t_101,t_101[]. LOOP AT t_tab WHERE racct >= '1606000000' AND racct =< '1606999999' . MOVE-CORRESPONDING t_tab TO t_101. COLLECT t_101. ENDLOOP. LOOP AT t_101. tb_result-start1 = t_101-hslvt. tb_result-end1 = t_101-hslvt + t_101-hsl01 + t_101-hsl02 + t_101-hsl03 + t_101-hsl04 + t_101-hsl05 + t_101-hsl06 + t_101-hsl07 + t_101-hsl08 + t_101-hsl09 + t_101-hsl10 + t_101-hsl11 + t_101-hsl12 + t_101-hsl13 + t_101-hsl14 + t_101-hsl15 + t_101-hsl16 . ENDLOOP. CLEAR: t_101,t_101[]. ****************************************** sum58s = sum48s + sum57s . sum58e = sum48e + sum57e . tb_result-start2 = sum58s. tb_result-end2 = sum58e. ***************************************************************** ******************************************************************** ELSEIF a_km1 = '124'. CLEAR: t_101,t_101[],t_102,t_102[]. LOOP AT t_tab WHERE racct >= '4001000000' AND racct =< '4001999999'. MOVE-CORRESPONDING t_tab TO t_101. COLLECT t_101. ENDLOOP. LOOP AT t_101. tb_result-start2 = 0 - t_101-hslvt. tb_result-end2 = 0 - ( t_101-hslvt + t_101-hsl01 + t_101-hsl02 + t_101-hsl03 + t_101-hsl04 + t_101-hsl05 + t_101-hsl06 + t_101-hsl07 + t_101-hsl08 + t_101-hsl09 + t_101-hsl10 + t_101-hsl11 + t_101-hsl12 + t_101-hsl13 + t_101-hsl14 + t_101-hsl15 + t_101-hsl16 ). ENDLOOP. ************************************************************* , ****************************************************************** ELSEIF a_km1 = '125'. CLEAR:num01,num02,num03,num04,num05,num06. CLEAR: t_101,t_101[],t_102,t_102[]. LOOP AT t_tab WHERE racct >= '1701000000' AND racct =< '17011999999'. MOVE-CORRESPONDING t_tab TO t_101. COLLECT t_101. ENDLOOP. LOOP AT t_101. num01 = t_101-hslvt. num02 = t_101-hslvt + t_101-hsl01 + t_101-hsl02 + t_101-hsl03 + t_101-hsl04 + t_101-hsl05 + t_101-hsl06 + t_101-hsl07 + t_101-hsl08 + t_101-hsl09 + t_101-hsl10 + t_101-hsl11 + t_101-hsl12 + t_101-hsl13 + t_101-hsl14 + t_101-hsl15 + t_101-hsl16 . ENDLOOP. CLEAR: t_101,t_101[]. LOOP AT t_tab WHERE racct >= '1702000000' AND racct =< '1702999999'. MOVE-CORRESPONDING t_tab TO t_102. COLLECT t_102. ENDLOOP. LOOP AT t_102. num03 = 0 - t_102-hslvt. num04 = 0 - ( t_102-hslvt + t_102-hsl01 + t_102-hsl02 + t_102-hsl03 + t_102-hsl04 + t_102-hsl05 + t_102-hsl06 + t_102-hsl07 + t_102-hsl08 + t_102-hsl09 + t_102-hsl10 + t_102-hsl11 + t_102-hsl12 + t_102-hsl13 + t_102-hsl14 + t_102-hsl15 + t_102-hsl16 ). ENDLOOP. CLEAR:t_102,t_102[]. LOOP AT t_tab WHERE racct >= '1703000000' AND racct =< '1703999999'. MOVE-CORRESPONDING t_tab TO t_102. COLLECT t_102. ENDLOOP. LOOP AT t_102. num05 = 0 - t_102-hslvt. num06 = 0 - ( t_102-hslvt + t_102-hsl01 + t_102-hsl02 + t_102-hsl03 + t_102-hsl04 + t_102-hsl05 + t_102-hsl06 + t_102-hsl07 + t_102-hsl08 + t_102-hsl09 + t_102-hsl10 + t_102-hsl11 + t_102-hsl12 + t_102-hsl13 + t_102-hsl14 + t_102-hsl15 + t_102-hsl16 ). ENDLOOP. CLEAR:t_102,t_102[]. tb_result-start1 = num01 + num03 + num05. tb_result-end1 = num02 + num04 + num06. *************************************************************************** CLEAR: t_101,t_101[],t_102,t_102[]. LOOP AT t_tab WHERE racct >= '4002000000' AND racct =< '4002999999'. MOVE-CORRESPONDING t_tab TO t_101. COLLECT t_101. ENDLOOP. LOOP AT t_101. tb_result-start2 = 0 - t_101-hslvt. tb_result-end2 = 0 - ( t_101-hslvt + t_101-hsl01 + t_101-hsl02 + t_101-hsl03 + t_101-hsl04 + t_101-hsl05 + t_101-hsl06 + t_101-hsl07 + t_101-hsl08 + t_101-hsl09 + t_101-hsl10 + t_101-hsl11 + t_101-hsl12 + t_101-hsl13 + t_101-hsl14 + t_101-hsl15 + t_101-hsl16 ). ENDLOOP. ************************************************************************************ ********************************************************************************************** ELSEIF a_km1 = '127'. CLEAR:num01,num02,num03,num04. CLEAR: t_101,t_101[],t_102,t_102[]. LOOP AT t_tab WHERE racct >= '1711000000' AND racct =< '1711999999'. MOVE-CORRESPONDING t_tab TO t_101. COLLECT t_101. ENDLOOP. LOOP AT t_101. num01 = t_101-hslvt. num02 = t_101-hslvt + t_101-hsl01 + t_101-hsl02 + t_101-hsl03 + t_101-hsl04 + t_101-hsl05 + t_101-hsl06 + t_101-hsl07 + t_101-hsl08 + t_101-hsl09 + t_101-hsl10 + t_101-hsl11 + t_101-hsl12 + t_101-hsl13 + t_101-hsl14 + t_101-hsl15 + t_101-hsl16 . ENDLOOP. CLEAR: t_101,t_101[]. LOOP AT t_tab WHERE racct >= '1712000000' AND racct =< '1712999999'. MOVE-CORRESPONDING t_tab TO t_102. COLLECT t_102. ENDLOOP. LOOP AT t_102. num03 = 0 - t_102-hslvt. num04 = 0 - ( t_102-hslvt + t_102-hsl01 + t_102-hsl02 + t_102-hsl03 + t_102-hsl04 + t_102-hsl05 + t_102-hsl06 + t_102-hsl07 + t_102-hsl08 + t_102-hsl09 + t_102-hsl10 + t_102-hsl11 + t_102-hsl12 + t_102-hsl13 + t_102-hsl14 + t_102-hsl15 + t_102-hsl16 ). ENDLOOP. CLEAR:t_102,t_102[]. tb_result-start1 = num01 + num03 . tb_result-end1 = num02 + num04 . ************************************************************************************ *********************************************************************************** ELSEIF a_km1 = '128'. CLEAR: t_101,t_101[]. LOOP AT t_tab WHERE racct >= '1801000000' AND racct =< '1801999999' . MOVE-CORRESPONDING t_tab TO t_101. COLLECT t_101. ENDLOOP. LOOP AT t_101. tb_result-start1 = t_101-hslvt. tb_result-end1 = t_101-hslvt + t_101-hsl01 + t_101-hsl02 + t_101-hsl03 + t_101-hsl04 + t_101-hsl05 + t_101-hsl06 + t_101-hsl07 + t_101-hsl08 + t_101-hsl09 + t_101-hsl10 + t_101-hsl11 + t_101-hsl12 + t_101-hsl13 + t_101-hsl14 + t_101-hsl15 + t_101-hsl16 . ENDLOOP. CLEAR: t_101,t_101[]. * *********************************************** LOOP AT t_tab WHERE racct >= '4101000000' AND racct =< '4101999999'. MOVE-CORRESPONDING t_tab TO t_101. COLLECT t_101. ENDLOOP. LOOP AT t_101. tb_result-start2 = - t_101-hslvt. tb_result-end2 = - ( t_101-hslvt + t_101-hsl01 + t_101-hsl02 + t_101-hsl03 + t_101-hsl04 + t_101-hsl05 + t_101-hsl06 + t_101-hsl07 + t_101-hsl08 + t_101-hsl09 + t_101-hsl10 + t_101-hsl11 + t_101-hsl12 + t_101-hsl13 + t_101-hsl14 + t_101-hsl15 + t_101-hsl16 ). ENDLOOP. CLEAR: t_101,t_101[]. ************************************************************************************ *********************************************************************************** ELSEIF a_km1 = '129'. CLEAR: t_101,t_101[]. LOOP AT t_tab WHERE racct >= '1811000000' AND racct =< '1811999999' . MOVE-CORRESPONDING t_tab TO t_101. COLLECT t_101. ENDLOOP. LOOP AT t_101. tb_result-start1 = t_101-hslvt. tb_result-end1 = t_101-hslvt + t_101-hsl01 + t_101-hsl02 + t_101-hsl03 + t_101-hsl04 + t_101-hsl05 + t_101-hsl06 + t_101-hsl07 + t_101-hsl08 + t_101-hsl09 + t_101-hsl10 + t_101-hsl11 + t_101-hsl12 + t_101-hsl13 + t_101-hsl14 + t_101-hsl15 + t_101-hsl16 . ENDLOOP. CLEAR: t_101,t_101[]. * *********************************************** LOOP AT t_tab WHERE racct >= '4104000000' AND racct =< '4104999999'. MOVE-CORRESPONDING t_tab TO t_101. COLLECT t_101. ENDLOOP. LOOP AT t_101. tb_result-start2 = - t_101-hslvt. tb_result-end2 = - ( t_101-hslvt + t_101-hsl01 + t_101-hsl02 + t_101-hsl03 + t_101-hsl04 + t_101-hsl05 + t_101-hsl06 + t_101-hsl07 + t_101-hsl08 + t_101-hsl09 + t_101-hsl10 + t_101-hsl11 + t_101-hsl12 + t_101-hsl13 + t_101-hsl14 + t_101-hsl15 + t_101-hsl16 ). ENDLOOP. CLEAR: t_101,t_101[]. ************************************************************************************ *********************************************************************************** ELSEIF a_km1 = '130'. tb_result-start2 = sum66s. tb_result-end2 = sum66e. *************************************************************** ********************************************************************* ELSEIF a_km1 = '132'. tb_result-start1 = sum32s. tb_result-end1 = sum32e. tb_result-start2 = sum66s. tb_result-end2 = sum66e. ELSEIF a_km1 = '133'. tb_result-start1 = sum32s + sum13s. tb_result-end1 = sum32e + sum13e. tb_result-start2 = sum66s + sum58s. tb_result-end2 = sum66e + sum58e. ENDIF. APPEND tb_result. * CLEAR tb_result. ENDFORM. " ADD_ROW *&---------------------------------------------------------------------* *& Form init_fieldcat *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * -->FLAG text *----------------------------------------------------------------------* FORM init_fieldcat USING flag. "初始化表头 * clear fieldcat[]. * CLEAR FIELDCAT. * FIELDCAT-FIELDNAME = 'COMPANYID'. * FIELDCAT-reptext_ddic = '科目'. * FIELDCAT-no_out = 'X'. * APPEND FIELDCAT. CLEAR fieldcat[]. CLEAR fieldcat. fieldcat-fieldname = 'ASSET1'. fieldcat-reptext_ddic = '资 产'. APPEND fieldcat. CLEAR fieldcat. fieldcat-fieldname = 'ROW1'. fieldcat-reptext_ddic = '行 次'. APPEND fieldcat. CLEAR fieldcat. fieldcat-fieldname = 'END1'. fieldcat-reptext_ddic = '期末余额'. fieldcat-just = 'R'. APPEND fieldcat. CLEAR fieldcat. fieldcat-fieldname = 'START1'. fieldcat-reptext_ddic = '年初余额'. fieldcat-just = 'R'. APPEND fieldcat. CLEAR fieldcat. fieldcat-fieldname = 'ASSET2'. fieldcat-reptext_ddic = '负债和所有者权益(或股东权益)'. APPEND fieldcat. CLEAR fieldcat. fieldcat-fieldname = 'ROW2'. fieldcat-reptext_ddic = '行次'. APPEND fieldcat. CLEAR fieldcat. fieldcat-fieldname = 'END2'. fieldcat-reptext_ddic = '期末余额'. fieldcat-just = 'R'. APPEND fieldcat. CLEAR fieldcat. fieldcat-fieldname = 'START2'. fieldcat-reptext_ddic = '年初余额'. fieldcat-just = 'R'. APPEND fieldcat. * CLEAR:SORTCAT,SORTCATLN. ** SORTCATLN-SPOS = 1. * SORTCATLN-UP = 'X'. * SORTCATLN-FIELDNAME = 'COMPANYID'. * SORTCATLN-SUBTOT = 'X'. * SORTCATLN-GROUP = '*'. * APPEND SORTCATLN to SORTCAT. ENDFORM. "init_fieldcat *&---------------------------------------------------------------------* *& Form init_layout *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* FORM init_layout. layout-zebra = 'X'. layout-f2code = '&IC1'. layout-detail_popup = 'X'. layout-colwidth_optimize = 'X'. layout-no_vline = ''. layout-no_hline = ''. * LAYOUT-numc_sum = 'X'. layout-no_sumchoice = ''. layout-no_subchoice = ''. layout-no_totalline = ''. layout-no_subtotals = ''. ENDFORM. "init_layout *&---------------------------------------------------------------------* *& Form TOP_OF_PAGE *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* FORM top_of_page. SELECT SINGLE butxt INTO s_butxt FROM t001 WHERE bukrs = I_RBUKRS."prt_result-companyid. * WRITE:/42 '山西天地煤机装备有限公司'. WRITE:/48 '资产负债表'. WRITE:/48 prtdate. WRITE:/2 '单位名称:',s_butxt , 68 '金额单位:','元'."'币种:','人民币元'. * if m_2 = 'X' AND waers <> 'CNY'. * write:45 '汇率:',EXCH_RATE. * endif. * WRITE:/64 '金额单位:','元'. ENDFORM. "TOP_OF_PAGE *&---------------------------------------------------------------------* *& Form END_OF_LIST *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* FORM end_of_list. WRITE:/2 '公司负责人:', 40 '财务负责人:', 60 '复核:' ,85 '制表:'. ENDFORM. "END_OF_LIST *&---------------------------------------------------------------------* *& Form EVENT_BUILD *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* FORM event_build . DATA: ls_event TYPE slis_alv_event. CALL FUNCTION 'REUSE_ALV_EVENTS_GET' EXPORTING i_list_type = 0 IMPORTING et_events = eventcat[]. READ TABLE eventcat WITH KEY name = slis_ev_top_of_page INTO ls_event. IF sy-subrc = 0. MOVE 'TOP_OF_PAGE' TO ls_event-form. APPEND ls_event TO eventcat. ENDIF. READ TABLE eventcat WITH KEY name = slis_ev_end_of_list INTO ls_event. IF sy-subrc = 0. MOVE 'END_OF_LIST' TO ls_event-form. APPEND ls_event TO eventcat. ENDIF. ENDFORM. " EVENT_BUILD *&---------------------------------------------------------------------* *& Form LISTDATA *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* FORM listdata. * v_repid = sy-repid. CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY' EXPORTING I_CALLBACK_PF_STATUS_SET = 'USER_STATUS' i_callback_program = v_repid i_callback_user_command = 'USER_COMMAND' is_layout = layout it_fieldcat = fieldcat[] it_events = eventcat it_sort = sortcat it_excluding = rt_extab TABLES t_outtab = prt_result EXCEPTIONS program_error = 1 OTHERS = 2. IF sy-subrc <> 0. MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. ENDIF. ENDFORM. "LISTDATA *&---------------------------------------------------------------------* *& Form CHANGE_DATA *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text * <-- p2 text *----------------------------------------------------------------------* form CHANGE_DATA . loop at tb_result. clear prt_result. move-corresponding tb_result to prt_result. perform num2char using tb_result-start1 changing prt_result-start1. perform num2char using tb_result-start2 changing prt_result-start2. perform num2char using tb_result-end1 changing prt_result-end1. perform num2char using tb_result-end2 changing prt_result-end2. * perform num2char using prt_result-start1 changing prt_result-start1. * perform num2char using prt_result-start2 changing prt_result-start2. * perform num2char using prt_result-end1 changing prt_result-end1. * perform num2char using prt_result-end2 changing prt_result-end2. append prt_result. endloop. endform. " CHANGE_DATA *&--------------------------------------------------------------------* *& Form NUM2CHAR *&--------------------------------------------------------------------* * text *---------------------------------------------------------------------* * -->FNUM text * -->SRET text *---------------------------------------------------------------------* FORM num2char USING fnum like tb_result-end1 CHANGING sret. WRITE fnum NO-ZERO TO sret. IF fnum < 0. CONCATENATE '-' sret INTO sret. ENDIF. if sret CO '0.'. sret = ' '. endif. CONDENSE sret NO-GAPS. ENDFORM. *&---------------------------------------------------------------------* *& Form user_status *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text * <-- p2 text *----------------------------------------------------------------------* FORM user_status USING extab TYPE slis_t_extab. * SET TITLEBAR 'TITLE_ALV'. SET PF-STATUS 'STSTUS_ALV'. ENDFORM. "USER_STATUS *&---------------------------------------------------------------------* *& Form user_command *&---------------------------------------------------------------------* * 抓取ALV的功能码 *----------------------------------------------------------------------* * --> p1 text * <-- p2 text *----------------------------------------------------------------------* FORM user_command USING r_ucomm LIKE sy-ucomm rs_selfield TYPE slis_selfield. rs_selfield-refresh = 'X'. ok_code = R_ucomm. CLEAR R_ucomm. CASE ok_code . WHEN 'DLOD'. PERFORM DOWNLOAD_EXCEL. WHEN OTHERS. ENDCASE. ENDFORM. "user_command *&---------------------------------------------------------------------* *& Form DOWNLOAD_EXCEL *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text * <-- p2 text *----------------------------------------------------------------------* form DOWNLOAD_EXCEL . DATA:c1(4),c2(2),c3(2). DATA column TYPE i. DATA: str_title TYPE string. DATA: str_title01 TYPE string. DATA: str_month TYPE string. *对单元格操作的宏 DEFINE fill_cell. call method of v_excel 'CELLS' = v_cell exporting #1 = &1 #2 = &2. set property of v_cell 'value' = &3. call method of v_cell 'FONT' = v_font. set property of v_font 'Bold' = &4. set property of v_font 'size' = &5. END-OF-DEFINITION. *为特定区域加边框的宏 DEFINE addborder. call method of v_excel 'Range' = v_range exporting #1 = &1 #2 = &2. get property of v_range 'Borders' = v_border. set property of v_border 'LineStyle' = 1. set property of v_border 'WEIGHT' = 2. free object v_border. END-OF-DEFINITION. *产生对象 CREATE OBJECT v_excel 'Excel.Application'. CALL METHOD OF v_excel 'Workbooks' = v_book. CALL METHOD OF v_book 'ADD'. *生产大标题,居中,加粗 * CONCATENATE '资产负债表表' INTO str_title. fill_cell 1 1 '资产负债表' 1 18. SET PROPERTY OF v_cell 'HorizontalAlignment' = -4108. *合并大标题所在单元格 prtdate CALL METHOD OF v_excel 'Range' = v_range EXPORTING #1 = 'A1' #2 = 'H1'. CALL METHOD OF v_range 'select'. SET PROPERTY OF v_range 'MergeCells' = 1. *******************************************************小标题 fill_cell 2 8 '会企01 表' 1 10. SET PROPERTY OF v_cell 'HorizontalAlignment' = -4108. *'单位名称:',s_butxt CONCATENATE '单位名称:' s_butxt INTO str_title. fill_cell 3 1 str_title 1 10. *合并单元格 CALL METHOD OF v_excel 'Range' = v_range EXPORTING #1 = 'A3' #2 = 'C3'. CALL METHOD OF v_range 'select'. SET PROPERTY OF v_range 'MergeCells' = 1. ******** 日期《《《《 c1 = prtdate+0(4). c2 = prtdate+4(2). c3 = prtdate+6(2). CONCATENATE c1 '年' C2 '月' C3'日' INTO str_title01. fill_cell 3 5 str_title01 1 10. SET PROPERTY OF v_cell 'HorizontalAlignment' = -4108. *合并单元格 CALL METHOD OF v_excel 'Range' = v_range EXPORTING #1 = 'D3' #2 = 'E3'. CALL METHOD OF v_range 'select'. SET PROPERTY OF v_range 'MergeCells' = 1. *****************单位 fill_cell 3 8 '单位 元' 1 10. SET PROPERTY OF v_cell 'HorizontalAlignment' = -4108. *添加主表表头信息 fill_cell 4 1 '资 产' 1 10. SET PROPERTY OF v_cell 'HorizontalAlignment' = -4108. fill_cell 4 2 '行次' 1 10. SET PROPERTY OF v_cell 'HorizontalAlignment' = -4108. fill_cell 4 3 '期末余额' 1 10. SET PROPERTY OF v_cell 'HorizontalAlignment' = -4108. fill_cell 4 4 '年初余额' 1 10. SET PROPERTY OF v_cell 'HorizontalAlignment' = -4108. fill_cell 4 5 '负债和所有者权益(或股东权益)' 1 10. SET PROPERTY OF v_cell 'HorizontalAlignment' = -4108. fill_cell 4 6 '行次' 1 10. SET PROPERTY OF v_cell 'HorizontalAlignment' = -4108. SET PROPERTY OF v_cell 'HorizontalAlignment' = -4108. fill_cell 4 7 '期末余额' 1 10. SET PROPERTY OF v_cell 'HorizontalAlignment' = -4108. fill_cell 4 8 '年初余额' 1 10. SET PROPERTY OF v_cell 'HorizontalAlignment' = -4108. *为数据区赋值 FIELD-SYMBOLS: <field> TYPE any. DATA lv_txt(50) TYPE c. DATA: row_i TYPE i, col_i TYPE i. LOOP AT prt_result. row_i = sy-tabix + 4. DO 8 TIMES. COL_I = SY-INDEX. ASSIGN COMPONENT sy-index OF STRUCTURE prt_result TO <field>. lv_txt = <field>. fill_cell row_i col_i lv_txt 0 10. ************* 设置颜色, IF ( ROW_I = 5 AND COL_I = 1 ) OR ( ROW_I = 5 AND COL_I = 5 ) OR ( ROW_I = 18 AND COL_I = 1 ) OR ( ROW_I = 18 AND COL_I = 5 ) OR ( ROW_I = 19 AND COL_I = 1 ) OR ( ROW_I = 19 AND COL_I = 5 ) OR ( ROW_I = 38 AND COL_I = 1 ) OR ( ROW_I = 38 AND COL_I = 5 ) OR ( ROW_I = 39 AND COL_I = 1 ) OR ( ROW_I = 39 AND COL_I = 5 ). CALL METHOD of v_cell 'INTERIOR' = V_COLOR. SET PROPERTY OF V_COLOR 'ColorIndex' = 6. ENDIF. ENDDO. ENDLOOP. ***********添加脚标 WRITE:/2 '公司负责人:', 40 '财务负责人:', 60 '复核:' ,85 '制表:'. fill_cell 40 1 '校验' 1 10. SET PROPERTY OF v_cell 'HorizontalAlignment' = -4108. *为除了大标题外的所有加边框 DATA: intstr TYPE string. intstr = row_i. CONCATENATE 'H' intstr INTO intstr. addborder 'A4' 'H4'. * addborder 'C2' 'P3'. addborder 'A5' intstr. *设置列的长度为自适应 CALL METHOD OF v_excel 'Columns' = v_column. CALL METHOD OF v_column 'Autofit'. *设置Excel可见 SET PROPERTY OF v_excel 'Visible' = 1. endform. " DOWNLOAD_EXCEL