news 2026/8/1 21:44:08

西班牙资产负债表

作者头像

张小明

前端开发工程师

1.2k 24
文章封面图
西班牙资产负债表
REPORT ZFIR_007. TABLES: skb1. INCLUDE <cl_alv_control>. *--------------------------------------------------------------------* * 类型定义 *--------------------------------------------------------------------* TYPES: BEGIN OF ty_account_range, account_from TYPE skb1-altkt, account_to TYPE skb1-altkt, END OF ty_account_range. TYPES: ty_account_ranges TYPE TABLE OF ty_account_range WITH EMPTY KEY. TYPES: BEGIN OF ty_balance_line, item_no TYPE n LENGTH 3, item_text TYPE string, account_ranges TYPE ty_account_ranges, sign TYPE c LENGTH 1, opening_balance TYPE acdoct-hslvt, ending_balance TYPE acdoct-hslvt, END OF ty_balance_line. TYPES: BEGIN OF ty_output_line, left_item TYPE string, left_no TYPE n LENGTH 3, left_opening TYPE acdoct-hslvt, left_ending TYPE acdoct-hslvt, right_item TYPE string, right_no TYPE n LENGTH 3, right_opening TYPE acdoct-hslvt, right_ending TYPE acdoct-hslvt, color TYPE lvc_t_scol, style_maktx TYPE lvc_t_styl, END OF ty_output_line. TYPES: BEGIN OF ty_account_mapping, saknr TYPE skb1-saknr, altkt TYPE skb1-altkt, END OF ty_account_mapping. TYPES: BEGIN OF ty_item_account, item_no TYPE n LENGTH 3, saknr TYPE skb1-saknr, sign TYPE c LENGTH 1, END OF ty_item_account. TYPES: BEGIN OF ty_balance_data, racct TYPE acdoct-racct, hslvt TYPE acdoct-hslvt, hsl01 TYPE acdoct-hsl01, hsl02 TYPE acdoct-hsl02, hsl03 TYPE acdoct-hsl03, hsl04 TYPE acdoct-hsl04, hsl05 TYPE acdoct-hsl05, hsl06 TYPE acdoct-hsl06, hsl07 TYPE acdoct-hsl07, hsl08 TYPE acdoct-hsl08, hsl09 TYPE acdoct-hsl09, hsl10 TYPE acdoct-hsl10, hsl11 TYPE acdoct-hsl11, hsl12 TYPE acdoct-hsl12, hsl13 TYPE acdoct-hsl13, hsl14 TYPE acdoct-hsl14, hsl15 TYPE acdoct-hsl15, hsl16 TYPE acdoct-hsl16, END OF ty_balance_data. TYPES: BEGIN OF ty_item_balance, item_no TYPE n LENGTH 3, opening_balance TYPE acdoct-hslvt, ending_balance TYPE acdoct-hslvt, END OF ty_item_balance. *--------------------------------------------------------------------* * 数据声明 *--------------------------------------------------------------------* DATA: gt_left TYPE TABLE OF ty_balance_line, gt_right TYPE TABLE OF ty_balance_line, gt_output TYPE TABLE OF ty_output_line, gs_output TYPE ty_output_line, gt_mapping TYPE TABLE OF ty_account_mapping, gt_balance TYPE TABLE OF ty_balance_data, gt_left_map TYPE SORTED TABLE OF ty_balance_line WITH UNIQUE KEY item_no, gt_right_map TYPE SORTED TABLE OF ty_balance_line WITH UNIQUE KEY item_no, gt_item_acc_map TYPE HASHED TABLE OF ty_item_account WITH UNIQUE KEY item_no saknr. DATA: go_alv TYPE REF TO cl_salv_table, gv_bukrs TYPE acdoct-rbukrs VALUE '9080', gv_ldnr TYPE acdoct-rldnr VALUE '0L', gv_year TYPE acdoct-ryear VALUE 2025, gv_from TYPE i VALUE 1, gv_to TYPE i VALUE 12. DATA: gt_account_ranges TYPE RANGE OF skb1-altkt, gs_account_range LIKE LINE OF gt_account_ranges. CONSTANTS: c_plus TYPE c VALUE '+', c_minus TYPE c VALUE '-'. *--------------------------------------------------------------------* * 选择屏幕 *--------------------------------------------------------------------* SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE TEXT-001. PARAMETERS: p_bukrs TYPE bukrs DEFAULT '9080' OBLIGATORY, p_ldnr TYPE acdoct-rldnr DEFAULT '0L' OBLIGATORY, p_year TYPE acdoct-ryear DEFAULT 2025 OBLIGATORY, p_from TYPE acdoct-rpmax DEFAULT 1 OBLIGATORY, p_to TYPE acdoct-rpmax DEFAULT 12 OBLIGATORY. SELECTION-SCREEN END OF BLOCK b1. AT SELECTION-SCREEN OUTPUT. LOOP AT SCREEN. IF screen-name = 'P_LDNR'. screen-input = 0. MODIFY SCREEN. ENDIF. ENDLOOP. *--------------------------------------------------------------------* * 主程序 *--------------------------------------------------------------------* START-OF-SELECTION. PERFORM initialize_globals. PERFORM build_config_tables. PERFORM get_account_mapping. PERFORM build_item_account_relation. PERFORM get_balance_data_bulk. PERFORM calculate_item_balances. PERFORM calculate_all_totals. PERFORM build_output_table. PERFORM display_alv_lvc. *&---------------------------------------------------------------------* *& Form INITIALIZE_GLOBALS *&---------------------------------------------------------------------* FORM initialize_globals. gv_bukrs = p_bukrs. gv_ldnr = p_ldnr. gv_year = p_year. gv_from = p_from. gv_to = p_to. CLEAR: gt_left, gt_right, gt_output, gt_mapping, gt_balance, gt_item_acc_map. ENDFORM. *&---------------------------------------------------------------------* *& Form BUILD_CONFIG_TABLES *&---------------------------------------------------------------------* FORM build_config_tables. " 左侧配置 (ASSETS - 行1-73) PERFORM build_left_config. " 右侧配置 (EQUITY & LIABILITIES - 行74-133) PERFORM build_right_config. " 复制到排序表以提高查询性能 gt_left_map = gt_left. gt_right_map = gt_right. ENDFORM. *&---------------------------------------------------------------------* *& Form BUILD_LEFT_CONFIG *&---------------------------------------------------------------------* FORM build_left_config. " 完整的左侧133行配置 " 行1-73: 非流动资产和流动资产 APPEND VALUE #( item_no = 1 item_text = 'A) NON-CURRENT ASSETS' ) TO gt_left. APPEND VALUE #( item_no = 2 item_text = 'I. Intangible Assets' ) TO gt_left. " 第3行: Research & Development - 多个科目范围 APPEND VALUE #( item_no = 3 item_text = '1. Research & Development' account_ranges = VALUE #( ( account_from = '20000000' account_to = '20199999' ) ( account_from = '28000000' account_to = '28019999' ) ( account_from = '29000000' account_to = '29019999' ) ) sign = c_plus ) TO gt_left. " 第4行: Concessions - 多个科目范围 APPEND VALUE #( item_no = 4 item_text = '2. Concessions' account_ranges = VALUE #( ( account_from = '20200000' account_to = '20299999' ) ( account_from = '28020000' account_to = '28029999' ) ( account_from = '29020000' account_to = '29029999' ) ) sign = c_plus ) TO gt_left. " 第5行: Patents, licenses, trademarks - 多个科目范围 APPEND VALUE #( item_no = 5 item_text = '3. Patents, licenses, trademarks, and similar rights' account_ranges = VALUE #( ( account_from = '20300000' account_to = '20399999' ) ( account_from = '28030000' account_to = '28039999' ) ( account_from = '29030000' account_to = '29039999' ) ) sign = c_plus ) TO gt_left. APPEND VALUE #( item_no = 6 item_text = '4. Goodwill' account_ranges = VALUE #( ( account_from = '20400000' account_to = '20499999' ) ) sign = c_plus ) TO gt_left. " 第7行: Computer Applications - 多个科目范围 APPEND VALUE #( item_no = 7 item_text = '5. Computer Applications' account_ranges = VALUE #( ( account_from = '20600000' account_to = '20699999' ) ( account_from = '28060000' account_to = '28069999' ) ( account_from = '29060000' account_to = '29069999' ) ) sign = c_plus ) TO gt_left. " 第8行: Other Intangible Assets - 多个科目范围 APPEND VALUE #( item_no = 8 item_text = '6. Other Intangible Assets' account_ranges = VALUE #( ( account_from = '20500000' account_to = '20599999' ) ( account_from = '20700000' account_to = '20799999' ) ( account_from = '20900000' account_to = '20999999' ) ( account_from = '28050000' account_to = '28059999' ) ( account_from = '28070000' account_to = '28079999' ) ( account_from = '29050000' account_to = '29059999' ) ( account_from = '29070000' account_to = '29079999' ) ) sign = c_plus ) TO gt_left. APPEND VALUE #( item_no = 9 item_text = 'II. Historical Heritage Assets' ) TO gt_left. " 第10行: Real Estate - 多个科目范围 APPEND VALUE #( item_no = 10 item_text = '1. Real Estate' account_ranges = VALUE #( ( account_from = '27000000' account_to = '27099999' ) ( account_from = '29900000' account_to = '29909999' ) ) sign = c_plus ) TO gt_left. " 第11行: Archives - 多个科目范围 APPEND VALUE #( item_no = 11 item_text = '2. Archives' account_ranges = VALUE #( ( account_from = '27100000' account_to = '27199999' ) ( account_from = '29910000' account_to = '29919999' ) ) sign = c_plus ) TO gt_left. " 第12行: Libraries - 多个科目范围 APPEND VALUE #( item_no = 12 item_text = '3. Libraries' account_ranges = VALUE #( ( account_from = '27200000' account_to = '27299999' ) ( account_from = '29920000' account_to = '29929999' ) ) sign = c_plus ) TO gt_left. " 第13行: Museums - 多个科目范围 APPEND VALUE #( item_no = 13 item_text = '4. Museums' account_ranges = VALUE #( ( account_from = '27300000' account_to = '27399999' ) ( account_from = '29930000' account_to = '29939999' ) ) sign = c_plus ) TO gt_left. " 第14行: Movable Assets - 多个科目范围 APPEND VALUE #( item_no = 14 item_text = '5. Movable Assets' account_ranges = VALUE #( ( account_from = '27400000' account_to = '27499999' ) ( account_from = '29940000' account_to = '29949999' ) ) sign = c_plus ) TO gt_left. " 第15行: Advances on Historical Heritage Assets - 多个科目范围 APPEND VALUE #( item_no = 15 item_text = '6. Advances on Historical Heritage Assets' account_ranges = VALUE #( ( account_from = '27900000' account_to = '27999999' ) ( account_from = '29950000' account_to = '29959999' ) ) sign = c_plus ) TO gt_left. APPEND VALUE #( item_no = 16 item_text = 'III. Tangible Fixed Assets' ) TO gt_left. " 第17行: Land and Buildings - 多个科目范围 APPEND VALUE #( item_no = 17 item_text = '1. Land and Buildings' account_ranges = VALUE #( ( account_from = '21000000' account_to = '21199999' ) ( account_from = '28110000' account_to = '28119999' ) ( account_from = '29100000' account_to = '29119999' ) ) sign = c_plus ) TO gt_left. " 第18行: Technical Installations, machinery - 多个科目范围 APPEND VALUE #( item_no = 18 item_text = '2. Technical Installations, machinery and Other Tangible Fixed Assets' account_ranges = VALUE #( ( account_from = '21200000' account_to = '21999999' ) ( account_from = '28120000' account_to = '28199999' ) ( account_from = '29100000' account_to = '29139999' ) ) sign = c_plus ) TO gt_left. APPEND VALUE #( item_no = 19 item_text = '3. Assets Under Construction and Advances' account_ranges = VALUE #( ( account_from = '23000000' account_to = '23999999' ) ) sign = c_plus ) TO gt_left. APPEND VALUE #( item_no = 20 item_text = 'IV. Investment Properties' ) TO gt_left. " 第21行: Land - 多个科目范围 APPEND VALUE #( item_no = 21 item_text = '1. Land' account_ranges = VALUE #( ( account_from = '22000000' account_to = '22099999' ) ( account_from = '29200000' account_to = '29299999' ) ) sign = c_plus ) TO gt_left. " 第22行: Buildings - 多个科目范围 APPEND VALUE #( item_no = 22 item_text = '2. Buildings' account_ranges = VALUE #( ( account_from = '22100000' account_to = '22199999' ) ( account_from = '28200000' account_to = '28299999' ) ( account_from = '29210000' account_to = '29219999' ) ) sign = c_plus ) TO gt_left. APPEND VALUE #( item_no = 23 item_text = 'V. Long-Term Investments in Group and Associated Companies' ) TO gt_left. " 第24行: Equity Instruments - 多个科目范围 APPEND VALUE #( item_no = 24 item_text = '1. Equity Instruments' account_ranges = VALUE #( ( account_from = '24030000' account_to = '24049999' ) ( account_from = '24930000' account_to = '24949999' ) ( account_from = '29330000' account_to = '29349999' ) ) sign = c_plus ) TO gt_left. " 第25行: Loans to Entities - 多个科目范围 APPEND VALUE #( item_no = 25 item_text = '2. Loans to Entities' account_ranges = VALUE #( ( account_from = '24230000' account_to = '24249999' ) ( account_from = '29530000' account_to = '29549999' ) ) sign = c_plus ) TO gt_left. " 第26行: Debt Securities - 多个科目范围 APPEND VALUE #( item_no = 26 item_text = '3. Debt Securities' account_ranges = VALUE #( ( account_from = '24130000' account_to = '24149999' ) ( account_from = '29430000' account_to = '29449999' ) ) sign = c_plus ) TO gt_left. APPEND VALUE #( item_no = 27 item_text = '4. Derivatives' account_ranges = VALUE #( ( account_from = '25500000' account_to = '25599999' ) ) sign = c_plus ) TO gt_left. APPEND VALUE #( item_no = 28 item_text = '5. Other Financial Assets' account_ranges = VALUE #( ( account_from = '25800000' account_to = '25899999' ) ) sign = c_plus ) TO gt_left. APPEND VALUE #( item_no = 29 item_text = 'VI. Long-Term Financial Investments' ) TO gt_left. " 第30行: Equity Instruments - 多个科目范围 APPEND VALUE #( item_no = 30 item_text = '1. Equity Instruments' account_ranges = VALUE #( ( account_from = '24050000' account_to = '24059999' ) ( account_from = '24950000' account_to = '24959999' ) ( account_from = '29350000' account_to = '29359999' ) ( account_from = '25000000' account_to = '25099999' ) ( account_from = '25900000' account_to = '25999999' ) ) sign = c_plus ) TO gt_left. " 第31行: Loans to Third Parties - 多个科目范围 APPEND VALUE #( item_no = 31 item_text = '2. Loans to Third Parties' account_ranges = VALUE #( ( account_from = '24250000' account_to = '24259999' ) ( account_from = '25200000' account_to = '25499999' ) ( account_from = '29550000' account_to = '29559999' ) ( account_from = '29800000' account_to = '29899999' ) ) sign = c_plus ) TO gt_left. " 第32行: Debt Securities - 多个科目范围 APPEND VALUE #( item_no = 32 item_text = '3. Debt Securities' account_ranges = VALUE #( ( account_from = '24150000' account_to = '24159999' ) ( account_from = '25100000' account_to = '25199999' ) ( account_from = '29450000' account_to = '29459999' ) ( account_from = '29700000' account_to = '29799999' ) ) sign = c_plus ) TO gt_left. APPEND VALUE #( item_no = 33 item_text = '4. Derivatives' account_ranges = VALUE #( ( account_from = '25500000' account_to = '25599999' ) ) sign = c_plus ) TO gt_left. APPEND VALUE #( item_no = 34 item_text = '5. Other Financial Assets' account_ranges = VALUE #( ( account_from = '25700000' account_to = '25899999' ) ) sign = c_plus ) TO gt_left. APPEND VALUE #( item_no = 35 item_text = 'VII. Deferred Tax Assets' ) TO gt_left. APPEND VALUE #( item_no = 36 item_text = '1. Deferred Tax Assets' account_ranges = VALUE #( ( account_from = '47400000' account_to = '47499999' ) ) sign = c_plus ) TO gt_left. APPEND VALUE #( item_no = 37 item_text = 'B) CURRENT ASSETS' ) TO gt_left. APPEND VALUE #( item_no = 38 item_text = 'I. Non-current assets held for sale' ) TO gt_left. " 第39行: Non-current assets held for sale - 多个科目范围 APPEND VALUE #( item_no = 39 item_text = '1. Non-current assets held for sale' account_ranges = VALUE #( ( account_from = '58000000' account_to = '58499999' ) ( account_from = '59900000' account_to = '59999999' ) ) sign = c_plus ) TO gt_left. APPEND VALUE #( item_no = 40 item_text = 'II. Inventories' ) TO gt_left. " 第41行: Goods intended for use in business - 多个科目范围 APPEND VALUE #( item_no = 41 item_text = '1. Goods intended for use in business' account_ranges = VALUE #( ( account_from = '30000000' account_to = '30999999' ) ( account_from = '39000000' account_to = '39099999' ) ) sign = c_plus ) TO gt_left. " 第42行: Raw materials and other supplies - 多个科目范围 APPEND VALUE #( item_no = 42 item_text = '2. Raw materials and other supplies' account_ranges = VALUE #( ( account_from = '31000000' account_to = '32999999' ) ( account_from = '39100000' account_to = '39299999' ) ) sign = c_plus ) TO gt_left. " 第43行: Work in progress - 多个科目范围 APPEND VALUE #( item_no = 43 item_text = '3. Work in progress' account_ranges = VALUE #( ( account_from = '33000000' account_to = '34999999' ) ( account_from = '39300000' account_to = '39499999' ) ) sign = c_plus ) TO gt_left. " 第44行: Finished goods - 多个科目范围 APPEND VALUE #( item_no = 44 item_text = '4. Finished goods' account_ranges = VALUE #( ( account_from = '35000000' account_to = '35999999' ) ( account_from = '39500000' account_to = '39599999' ) ) sign = c_plus ) TO gt_left. " 第45行: By-products, waste, and recovered materials - 多个科目范围 APPEND VALUE #( item_no = 45 item_text = '5. By-products, waste, and recovered materials' account_ranges = VALUE #( ( account_from = '36000000' account_to = '36999999' ) ( account_from = '39600000' account_to = '39699999' ) ) sign = c_plus ) TO gt_left. APPEND VALUE #( item_no = 46 item_text = '6. Advances to suppliers' account_ranges = VALUE #( ( account_from = '40700000' account_to = '40799999' ) ) sign = c_plus ) TO gt_left. APPEND VALUE #( item_no = 47 item_text = 'III. Other debtors of business operations' ) TO gt_left. " 第48行: Other debtors of business operations - 多个科目范围 APPEND VALUE #( item_no = 48 item_text = '1. Other debtors of business operations' account_ranges = VALUE #( ( account_from = '44200000' account_to = '44399999' ) ( account_from = '49520000' account_to = '49530000' ) ) sign = c_plus ) TO gt_left. APPEND VALUE #( item_no = 49 item_text = 'IV. Trade debtors and other receivables' ) TO gt_left. " 第50行: Customers for sales and services rendered - 多个科目范围 APPEND VALUE #( item_no = 50 item_text = '1. Customers for sales and services rendered' account_ranges = VALUE #( ( account_from = '43000000' account_to = '43299999' ) ( account_from = '43500000' account_to = '43799999' ) ( account_from = '49000000' account_to = '49099999' ) ( account_from = '49350000' account_to = '49359999' ) ) sign = c_plus ) TO gt_left. " 第51行: Customers, group companies and entities, and associates - 多个科目范围 APPEND VALUE #( item_no = 51 item_text = '2. Customers, group companies and entities, and associates' account_ranges = VALUE #( ( account_from = '43300000' account_to = '43499999' ) ( account_from = '49330000' account_to = '49349999' ) ( account_from = '55300000' account_to = '55399999' ) ) sign = c_plus ) TO gt_left. " 第52行: Other debtors - 多个科目范围 APPEND VALUE #( item_no = 52 item_text = '3. Other debtors' account_ranges = VALUE #( ( account_from = '44000000' account_to = '44199999' ) ( account_from = '44600000' account_to = '44699999' ) ) sign = c_plus ) TO gt_left. " 第53行: Personnel - 多个科目范围 APPEND VALUE #( item_no = 53 item_text = '4. Personnel' account_ranges = VALUE #( ( account_from = '46000000' account_to = '46099999' ) ( account_from = '46400000' account_to = '46499999' ) ( account_from = '54400000' account_to = '54499999' ) ) sign = c_plus ) TO gt_left. APPEND VALUE #( item_no = 54 item_text = '5. Current tax assets' account_ranges = VALUE #( ( account_from = '47090000' account_to = '47099999' ) ) sign = c_plus ) TO gt_left. " 第55行: Other receivables from public authorities - 多个科目范围 APPEND VALUE #( item_no = 55 item_text = '6. Other receivables from public authorities' account_ranges = VALUE #( ( account_from = '47000000' account_to = '47009999' ) ( account_from = '47070000' account_to = '47089999' ) ( account_from = '47100000' account_to = '47399999' ) ) sign = c_plus ) TO gt_left. APPEND VALUE #( item_no = 56 item_text = '7. Founders for called-up capital' account_ranges = VALUE #( ( account_from = '55800000' account_to = '55899999' ) ) sign = c_plus ) TO gt_left. APPEND VALUE #( item_no = 57 item_text = 'V. Short-term investments in group companies and entities and associates' ) TO gt_left. " 第58行: Equity instruments - 多个科目范围 APPEND VALUE #( item_no = 58 item_text = '1. Equity instruments' account_ranges = VALUE #( ( account_from = '53030000' account_to = '53049999' ) ( account_from = '53930000' account_to = '53949999' ) ( account_from = '59300000' account_to = '59399999' ) ) sign = c_plus ) TO gt_left. " 第59行: Loans to companies - 多个科目范围 APPEND VALUE #( item_no = 59 item_text = '2. Loans to companies' account_ranges = VALUE #( ( account_from = '53230000' account_to = '53249999' ) ( account_from = '53430000' account_to = '53440000' ) ( account_from = '59530000' account_to = '59549999' ) ) sign = c_plus ) TO gt_left. " 第60行: Debt securities - 多个科目范围 APPEND VALUE #( item_no = 60 item_text = '3. Debt securities' account_ranges = VALUE #( ( account_from = '53130000' account_to = '53149999' ) ( account_from = '53330000' account_to = '53349999' ) ( account_from = '59430000' account_to = '59449999' ) ) sign = c_plus ) TO gt_left. " 第61行: Other financial assets - 多个科目范围 APPEND VALUE #( item_no = 61 item_text = '5. Other financial assets' account_ranges = VALUE #( ( account_from = '53530000' account_to = '53549999' ) ( account_from = '55230000' account_to = '55249999' ) ) sign = c_plus ) TO gt_left. APPEND VALUE #( item_no = 62 item_text = 'VI. Short-term financial investments' ) TO gt_left. " 第63行: Equity instruments - 多个科目范围 APPEND VALUE #( item_no = 63 item_text = '1. Equity instruments' account_ranges = VALUE #( ( account_from = '53050000' account_to = '53059999' ) ( account_from = '54000000' account_to = '54099999' ) ( account_from = '53950000' account_to = '53959999' ) ( account_from = '54900000' account_to = '54999999' ) ) sign = c_plus ) TO gt_left. " 第64行: Loans to companies - 多个科目范围 APPEND VALUE #( item_no = 64 item_text = '2. Loans to companies' account_ranges = VALUE #( ( account_from = '53250000' account_to = '53459999' ) ( account_from = '54200000' account_to = '54399999' ) ( account_from = '54700000' account_to = '54799999' ) ( account_from = '59550000' account_to = '59559999' ) ( account_from = '59800000' account_to = '59899999' ) ) sign = c_plus ) TO gt_left. " 第65行: Debt securities - 多个科目范围 APPEND VALUE #( item_no = 65 item_text = '3. Debt securities' account_ranges = VALUE #( ( account_from = '53150000' account_to = '53159999' ) ( account_from = '53350000' account_to = '53359999' ) ( account_from = '54100000' account_to = '54199999' ) ( account_from = '54600000' account_to = '54699999' ) ( account_from = '59450000' account_to = '59459999' ) ( account_from = '59700000' account_to = '59799999' ) ) sign = c_plus ) TO gt_left. " 第66行: Derivatives - 多个科目范围 APPEND VALUE #( item_no = 66 item_text = '4. Derivatives' account_ranges = VALUE #( ( account_from = '55900000' account_to = '55909999' ) ( account_from = '55930000' account_to = '55939999' ) ) sign = c_plus ) TO gt_left. " 第67行: Other financial assets - 多个科目范围 APPEND VALUE #( item_no = 67 item_text = '5. Other financial assets' account_ranges = VALUE #( ( account_from = '53550000' account_to = '53559999' ) ( account_from = '54500000' account_to = '54599999' ) ( account_from = '54800000' account_to = '54899999' ) ( account_from = '55100000' account_to = '55199999' ) ( account_from = '55250000' account_to = '55259999' ) ( account_from = '56500000' account_to = '56599999' ) ( account_from = '56600000' account_to = '56699999' ) ) sign = c_plus ) TO gt_left. APPEND VALUE #( item_no = 68 item_text = 'VII. Short-term accruals' ) TO gt_left. " 第69行: Short-term accruals - 多个科目范围 APPEND VALUE #( item_no = 69 item_text = '1. Short-term accruals' account_ranges = VALUE #( ( account_from = '48000000' account_to = '48099999' ) ( account_from = '56700000' account_to = '56799999' ) ) sign = c_plus ) TO gt_left. APPEND VALUE #( item_no = 70 item_text = 'VIII. Cash and cash equivalents' ) TO gt_left. APPEND VALUE #( item_no = 71 item_text = '1. Cash' account_ranges = VALUE #( ( account_from = '57000000' account_to = '57599999' ) ) sign = c_plus ) TO gt_left. APPEND VALUE #( item_no = 72 item_text = '2. Other equivalent liquid assets' account_ranges = VALUE #( ( account_from = '57600000' account_to = '57699999' ) ) sign = c_plus ) TO gt_left. APPEND VALUE #( item_no = 73 item_text = 'TOTAL ASSETS (A + B)' ) TO gt_left. ENDFORM. *&---------------------------------------------------------------------* *& Form BUILD_RIGHT_CONFIG *&---------------------------------------------------------------------* FORM build_right_config. " 完整的右侧133行配置 " 行74-133: 权益和负债 APPEND VALUE #( item_no = 74 item_text = 'A) EQUITY' ) TO gt_right. APPEND VALUE #( item_no = 75 item_text = 'A-1) Shareholders'' Equity' ) TO gt_right. APPEND VALUE #( item_no = 76 item_text = 'I. Share Capital' ) TO gt_right. APPEND VALUE #( item_no = 77 item_text = '1. Share Capital' account_ranges = VALUE #( ( account_from = '10000000' account_to = '10099999' ) ) sign = c_minus ) TO gt_right. APPEND VALUE #( item_no = 78 item_text = '2. Founders'' Unpaid Portion' account_ranges = VALUE #( ( account_from = '10300000' account_to = '10399999' ) ) sign = c_minus ) TO gt_right. APPEND VALUE #( item_no = 79 item_text = '3. Founders'' Outstanding Non-Cash Contributions' account_ranges = VALUE #( ( account_from = '10400000' account_to = '10499999' ) ) sign = c_minus ) TO gt_right. APPEND VALUE #( item_no = 80 item_text = 'II. Reserves' ) TO gt_right. " 第81行: Statutory Reserves - 多个科目范围 APPEND VALUE #( item_no = 81 item_text = '1. Statutory Reserves' account_ranges = VALUE #( ( account_from = '11200000' account_to = '11299999' ) ( account_from = '11410000' account_to = '11419999' ) ) sign = c_minus ) TO gt_right. " 第82行: Other Reserves - 多个科目范围 APPEND VALUE #( item_no = 82 item_text = '2. Other Reserves' account_ranges = VALUE #( ( account_from = '11300000' account_to = '11399999' ) ( account_from = '11430000' account_to = '11439999' ) ( account_from = '11500000' account_to = '11599999' ) ) sign = c_minus ) TO gt_right. APPEND VALUE #( item_no = 83 item_text = 'III. Retained Earnings' ) TO gt_right. APPEND VALUE #( item_no = 84 item_text = '1. Retained Earnings' account_ranges = VALUE #( ( account_from = '12000000' account_to = '12099999' ) ) sign = c_minus ) TO gt_right. APPEND VALUE #( item_no = 85 item_text = '2. Negative results from Prior Years' account_ranges = VALUE #( ( account_from = '12100000' account_to = '12199999' ) ) sign = c_minus ) TO gt_right. APPEND VALUE #( item_no = 86 item_text = 'IV. Current Year Result' account_ranges = VALUE #( ( account_from = '12900000' account_to = '12999999' ) ) sign = c_minus ) TO gt_right. APPEND VALUE #( item_no = 87 item_text = 'A-2) Adjustments for Changes in Value' ) TO gt_right. APPEND VALUE #( item_no = 88 item_text = 'I. Financial Assets Available for Sale' account_ranges = VALUE #( ( account_from = '13300000' account_to = '13399999' ) ) sign = c_minus ) TO gt_right. APPEND VALUE #( item_no = 89 item_text = 'II. Hedging Transactions' account_ranges = VALUE #( ( account_from = '13400000' account_to = '13499999' ) ) sign = c_minus ) TO gt_right. APPEND VALUE #( item_no = 90 item_text = 'III. Other' account_ranges = VALUE #( ( account_from = '13700000' account_to = '13799999' ) ) sign = c_minus ) TO gt_right. APPEND VALUE #( item_no = 91 item_text = 'A-3) Grants, Donations, and Bequests Received' account_ranges = VALUE #( ( account_from = '13000000' account_to = '13299999' ) ) sign = c_minus ) TO gt_right. APPEND VALUE #( item_no = 92 item_text = 'B) NON-CURRENT LIABILITIES' ) TO gt_right. APPEND VALUE #( item_no = 93 item_text = 'I. Long-term provisions' ) TO gt_right. APPEND VALUE #( item_no = 94 item_text = '1. Long-term employee benefits obligations' account_ranges = VALUE #( ( account_from = '14000000' account_to = '14099999' ) ) sign = c_minus ) TO gt_right. APPEND VALUE #( item_no = 95 item_text = '2. Environmental actions' account_ranges = VALUE #( ( account_from = '14500000' account_to = '14599999' ) ) sign = c_minus ) TO gt_right. APPEND VALUE #( item_no = 96 item_text = '3. Restructuring provisions' account_ranges = VALUE #( ( account_from = '14600000' account_to = '14699999' ) ) sign = c_minus ) TO gt_right. " 第97行: Other provisions - 多个科目范围 APPEND VALUE #( item_no = 97 item_text = '4. Other provisions' account_ranges = VALUE #( ( account_from = '14100000' account_to = '14499999' ) ( account_from = '14700000' account_to = '14799999' ) ) sign = c_minus ) TO gt_right. APPEND VALUE #( item_no = 98 item_text = 'II. Long-term debt' ) TO gt_right. " 第99行: Bonds and other marketable securities - 多个科目范围 APPEND VALUE #( item_no = 99 item_text = '1. Bonds and other marketable securities' account_ranges = VALUE #( ( account_from = '17700000' account_to = '17799999' ) ( account_from = '17900000' account_to = '17999999' ) ) sign = c_minus ) TO gt_right. " 第100行: Debt with credit institutions - 多个科目范围 APPEND VALUE #( item_no = 100 item_text = '2. Debt with credit institutions' account_ranges = VALUE #( ( account_from = '16050000' account_to = '16059999' ) ( account_from = '17000000' account_to = '17099999' ) ) sign = c_minus ) TO gt_right. " 第101行: Finance lease payables - 多个科目范围 APPEND VALUE #( item_no = 101 item_text = '3. Finance lease payables' account_ranges = VALUE #( ( account_from = '16250000' account_to = '16259999' ) ( account_from = '17400000' account_to = '17499999' ) ) sign = c_minus ) TO gt_right. APPEND VALUE #( item_no = 102 item_text = '4. Derivatives' account_ranges = VALUE #( ( account_from = '17600000' account_to = '17699999' ) ) sign = c_minus ) TO gt_right. " 第103行: Other financial liabilities - 多个科目范围 APPEND VALUE #( item_no = 103 item_text = '5. Other financial liabilities' account_ranges = VALUE #( ( account_from = '16150000' account_to = '16159999' ) ( account_from = '16350000' account_to = '16359999' ) ( account_from = '17100000' account_to = '17399999' ) ( account_from = '17500000' account_to = '17599999' ) ( account_from = '18000000' account_to = '18099999' ) ( account_from = '18500000' account_to = '18599999' ) ( account_from = '18900000' account_to = '18999999' ) ) sign = c_minus ) TO gt_right. APPEND VALUE #( item_no = 104 item_text = 'III. Long-term debt with group companies and associates' ) TO gt_right. " 第105行: Long-term debt with group companies and associates - 多个科目范围 APPEND VALUE #( item_no = 105 item_text = 'Long-term debt with group companies and associates' account_ranges = VALUE #( ( account_from = '16030000' account_to = '16049999' ) ( account_from = '16130000' account_to = '16149999' ) ( account_from = '16230000' account_to = '16249999' ) ( account_from = '16330000' account_to = '16349999' ) ) sign = c_minus ) TO gt_right. APPEND VALUE #( item_no = 106 item_text = 'IV. Deferred tax liabilities' ) TO gt_right. APPEND VALUE #( item_no = 107 item_text = '1. Deferred tax liabilities' account_ranges = VALUE #( ( account_from = '47900000' account_to = '47999999' ) ) sign = c_minus ) TO gt_right. APPEND VALUE #( item_no = 108 item_text = 'C) CURRENT LIABILITIES' ) TO gt_right. APPEND VALUE #( item_no = 109 item_text = 'I. Liabilities related to non-current assets held for sale' ) TO gt_right. APPEND VALUE #( item_no = 110 item_text = '1. Liabilities related to non-current assets held for sale' account_ranges = VALUE #( ( account_from = '58500000' account_to = '58999999' ) ) sign = c_minus ) TO gt_right. APPEND VALUE #( item_no = 111 item_text = 'II. Short-term provisions' ) TO gt_right. " 第112行: Short-term provisions - 多个科目范围 APPEND VALUE #( item_no = 112 item_text = '1. Short-term provisions' account_ranges = VALUE #( ( account_from = '49900000' account_to = '49999999' ) ( account_from = '52900000' account_to = '52999999' ) ) sign = c_minus ) TO gt_right. APPEND VALUE #( item_no = 113 item_text = 'III. Short-term debt' ) TO gt_right. " 第114行: Bonds and other marketable securities - 多个科目范围 APPEND VALUE #( item_no = 114 item_text = '1. Bonds and other marketable securities' account_ranges = VALUE #( ( account_from = '50000000' account_to = '50099999' ) ( account_from = '50500000' account_to = '50699999' ) ) sign = c_minus ) TO gt_right. " 第115行: Debt with credit institutions - 多个科目范围 APPEND VALUE #( item_no = 115 item_text = '2. Debt with credit institutions' account_ranges = VALUE #( ( account_from = '51050000' account_to = '51059999' ) ( account_from = '52000000' account_to = '52099999' ) ( account_from = '52700000' account_to = '52799999' ) ) sign = c_minus ) TO gt_right. " 第116行: Finance lease payables - 多个科目范围 APPEND VALUE #( item_no = 116 item_text = '3. Finance lease payables' account_ranges = VALUE #( ( account_from = '51250000' account_to = '51259999' ) ( account_from = '52400000' account_to = '52499999' ) ) sign = c_minus ) TO gt_right. " 第117行: Derivatives - 多个科目范围 APPEND VALUE #( item_no = 117 item_text = '4. Derivatives' account_ranges = VALUE #( ( account_from = '55950000' account_to = '55959999' ) ( account_from = '55980000' account_to = '55989999' ) ) sign = c_minus ) TO gt_right. " 第118行: Other financial liabilities - 多个科目范围 APPEND VALUE #( item_no = 118 item_text = '5. Other financial liabilities' account_ranges = VALUE #( ( account_from = '50900000' account_to = '50999999' ) ( account_from = '51150000' account_to = '51159999' ) ( account_from = '51350000' account_to = '51359999' ) ( account_from = '51450000' account_to = '51459999' ) ( account_from = '52100000' account_to = '52399999' ) ( account_from = '52500000' account_to = '52599999' ) ( account_from = '52800000' account_to = '52899999' ) * ( account_from = '55100000' account_to = '55199999' ) * ( account_from = '55250000' account_to = '55259999' ) * ( account_from = '55300000' account_to = '55399999' ) ( account_from = '55500000' account_to = '55599999' ) ( account_from = '55650000' account_to = '55669999' ) ( account_from = '56000000' account_to = '56199999' ) ( account_from = '56900000' account_to = '56999999' ) ) sign = c_minus ) TO gt_right. APPEND VALUE #( item_no = 119 item_text = 'IV. Short-term debts to group and associated companies and entities' ) TO gt_right. " 第120行: Short-term debts to group and associated companies and entities - 多个科目范围 APPEND VALUE #( item_no = 120 item_text = '1. Short-term debts to group and associated companies and entities' account_ranges = VALUE #( ( account_from = '51030000' account_to = '51049999' ) ( account_from = '51130000' account_to = '51149999' ) ( account_from = '51230000' account_to = '51249999' ) ( account_from = '51330000' account_to = '51349999' ) ( account_from = '51430000' account_to = '51449999' ) ( account_from = '55230000' account_to = '55249999' ) ( account_from = '55630000' account_to = '55649999' ) ) sign = c_minus ) TO gt_right. APPEND VALUE #( item_no = 121 item_text = 'V. Beneficiaries-Creditors' ) TO gt_right. APPEND VALUE #( item_no = 122 item_text = '1. Beneficiaries-Creditors' account_ranges = VALUE #( ( account_from = '41200000' account_to = '41299999' ) ) sign = c_minus ) TO gt_right. APPEND VALUE #( item_no = 123 item_text = 'VI. Trade creditors and other accounts payable' ) TO gt_right. " 第124行: Suppliers - 多个科目范围 APPEND VALUE #( item_no = 124 item_text = '1. Suppliers' account_ranges = VALUE #( ( account_from = '40000000' account_to = '40199999' ) ( account_from = '40500000' account_to = '40599999' ) ) sign = c_minus ) TO gt_right. " 第125行: Suppliers, group and associated companies and entities - 多个科目范围 APPEND VALUE #( item_no = 125 item_text = '2. Suppliers, group and associated companies and entities' account_ranges = VALUE #( ( account_from = '40300000' account_to = '40499999' ) ( account_from = '40600000' account_to = '40699999' ) ) sign = c_minus ) TO gt_right. APPEND VALUE #( item_no = 126 item_text = '3. Sundry creditors' account_ranges = VALUE #( ( account_from = '41000000' account_to = '41199999' ) ) sign = c_minus ) TO gt_right. APPEND VALUE #( item_no = 127 item_text = '4. Personnel (outstanding salaries)' account_ranges = VALUE #( ( account_from = '46500000' account_to = '46699999' ) ) sign = c_minus ) TO gt_right. APPEND VALUE #( item_no = 128 item_text = '5. Current tax liabilities' account_ranges = VALUE #( ( account_from = '47520000' account_to = '47529999' ) ) sign = c_minus ) TO gt_right. " 第129行: Other debts to Public Administrations - 多个科目范围 APPEND VALUE #( item_no = 129 item_text = '6. Other debts to Public Administrations' account_ranges = VALUE #( ( account_from = '47500000' account_to = '47519999' ) ( account_from = '47570000' account_to = '47589999' ) ( account_from = '47600000' account_to = '47799999' ) ) sign = c_minus ) TO gt_right. APPEND VALUE #( item_no = 130 item_text = '7. Customer advances' account_ranges = VALUE #( ( account_from = '43800000' account_to = '43899999' ) ) sign = c_minus ) TO gt_right. APPEND VALUE #( item_no = 131 item_text = 'VII. Short-term accruals' ) TO gt_right. " 第132行: Short-term accruals - 多个科目范围 APPEND VALUE #( item_no = 132 item_text = '1. Short-term accruals' account_ranges = VALUE #( ( account_from = '48500000' account_to = '48599999' ) ( account_from = '56800000' account_to = '56899999' ) ) sign = c_minus ) TO gt_right. APPEND VALUE #( item_no = 133 item_text = 'TOTAL LIABILITIES (A + B + C)' ) TO gt_right. ENDFORM. *&---------------------------------------------------------------------* *& Form GET_ACCOUNT_MAPPING *&---------------------------------------------------------------------* FORM get_account_mapping. " 收集所有需要转换的科目范围 PERFORM collect_account_ranges CHANGING gt_account_ranges. " 批量获取科目映射 IF gt_account_ranges IS NOT INITIAL. SELECT saknr, altkt INTO TABLE @gt_mapping FROM skb1 WHERE bukrs = @gv_bukrs AND altkt IN @gt_account_ranges. ENDIF. ENDFORM. *&---------------------------------------------------------------------* *& Form COLLECT_ACCOUNT_RANGES *&---------------------------------------------------------------------* FORM collect_account_ranges CHANGING pt_ranges LIKE gt_account_ranges. DATA: ls_range LIKE LINE OF pt_ranges. DATA: ls_account_range TYPE ty_account_range. " 收集左侧科目范围 LOOP AT gt_left_map ASSIGNING FIELD-SYMBOL(<fs_line>) WHERE account_ranges IS NOT INITIAL. LOOP AT <fs_line>-account_ranges INTO ls_account_range. CLEAR ls_range. ls_range-sign = 'I'. ls_range-option = 'BT'. ls_range-low = ls_account_range-account_from. ls_range-high = ls_account_range-account_to. ls_range-low = |{ ls_range-low ALPHA = IN }|. ls_range-high = |{ ls_range-high ALPHA = IN }|. APPEND ls_range TO pt_ranges. ENDLOOP. ENDLOOP. " 收集右侧科目范围 LOOP AT gt_right_map ASSIGNING FIELD-SYMBOL(<fs_line_r>) WHERE account_ranges IS NOT INITIAL. LOOP AT <fs_line_r>-account_ranges INTO ls_account_range. CLEAR ls_range. ls_range-sign = 'I'. ls_range-option = 'BT'. ls_range-low = ls_account_range-account_from. ls_range-high = ls_account_range-account_to. ls_range-low = |{ ls_range-low ALPHA = IN }|. ls_range-high = |{ ls_range-high ALPHA = IN }|. APPEND ls_range TO pt_ranges. ENDLOOP. ENDLOOP. ENDFORM. *&---------------------------------------------------------------------* *& Form BUILD_ITEM_ACCOUNT_RELATION *&---------------------------------------------------------------------* FORM build_item_account_relation. " 建立科目行与科目的关联关系 DATA: ls_account_range TYPE ty_account_range. " 处理左侧科目的关联 LOOP AT gt_left_map ASSIGNING FIELD-SYMBOL(<fs_left>) WHERE account_ranges IS NOT INITIAL. LOOP AT <fs_left>-account_ranges INTO ls_account_range. DATA(lv_from) = |{ ls_account_range-account_from ALPHA = IN }|. DATA(lv_to) = |{ ls_account_range-account_to ALPHA = IN }|. LOOP AT gt_mapping ASSIGNING FIELD-SYMBOL(<fs_map>). " 检查西班牙科目号是否在范围内 IF <fs_map>-altkt BETWEEN lv_from AND lv_to. " 建立关联关系 INSERT VALUE #( item_no = <fs_left>-item_no saknr = <fs_map>-saknr sign = <fs_left>-sign ) INTO TABLE gt_item_acc_map. ENDIF. ENDLOOP. ENDLOOP. ENDLOOP. " 处理右侧科目的关联 LOOP AT gt_right_map ASSIGNING FIELD-SYMBOL(<fs_right>) WHERE account_ranges IS NOT INITIAL. LOOP AT <fs_right>-account_ranges INTO ls_account_range. lv_from = |{ ls_account_range-account_from ALPHA = IN }|. lv_to = |{ ls_account_range-account_to ALPHA = IN }|. LOOP AT gt_mapping ASSIGNING <fs_map>. " 检查西班牙科目号是否在范围内 IF <fs_map>-altkt BETWEEN lv_from AND lv_to. " 建立关联关系 INSERT VALUE #( item_no = <fs_right>-item_no saknr = <fs_map>-saknr sign = <fs_right>-sign ) INTO TABLE gt_item_acc_map. ENDIF. ENDLOOP. ENDLOOP. ENDLOOP. ENDFORM. *&---------------------------------------------------------------------* *& Form GET_BALANCE_DATA_BULK *&---------------------------------------------------------------------* FORM get_balance_data_bulk. DATA: lt_saknr_range TYPE RANGE OF acdoct-racct, ls_saknr_range LIKE LINE OF lt_saknr_range. " 从gt_item_acc_map中获取所有科目号 LOOP AT gt_item_acc_map ASSIGNING FIELD-SYMBOL(<fs_item>). ls_saknr_range-sign = 'I'. ls_saknr_range-option = 'EQ'. ls_saknr_range-low = <fs_item>-saknr. COLLECT ls_saknr_range INTO lt_saknr_range. ENDLOOP. " 批量获取所有期间数据 IF lt_saknr_range IS NOT INITIAL. SELECT racct, hslvt, hsl01, hsl02, hsl03, hsl04, hsl05, hsl06, hsl07, hsl08, hsl09, hsl10, hsl11, hsl12, hsl13, hsl14, hsl15, hsl16 INTO TABLE @gt_balance FROM acdoct WHERE rbukrs = @gv_bukrs AND rldnr = @gv_ldnr AND ryear = @gv_year AND racct IN @lt_saknr_range. ENDIF. ENDFORM. *&---------------------------------------------------------------------* *& Form CALCULATE_ITEM_BALANCES *&---------------------------------------------------------------------* FORM calculate_item_balances. DATA: lt_item_balances TYPE HASHED TABLE OF ty_item_balance WITH UNIQUE KEY item_no, ls_item_balance TYPE ty_item_balance. " 初始化所有科目行的余额 PERFORM initialize_item_balances. " 遍历所有ACDOCT数据 LOOP AT gt_balance ASSIGNING FIELD-SYMBOL(<fs_balance>). " 查找该科目号对应的所有科目行 LOOP AT gt_item_acc_map ASSIGNING FIELD-SYMBOL(<fs_item_acc>) WHERE saknr = <fs_balance>-racct. " 计算期间余额 DATA lv_ending_balance TYPE acdoct-hslvt. CLEAR lv_ending_balance. PERFORM calculate_period_balance USING <fs_balance> gv_from gv_to CHANGING lv_ending_balance. " 根据符号调整余额 DATA(lv_opening) = <fs_balance>-hslvt. DATA(lv_ending) = lv_ending_balance. IF <fs_item_acc>-sign = c_minus. lv_opening = -1 * lv_opening. lv_ending = -1 * lv_ending. ENDIF. " 使用哈希表暂存计算结果 READ TABLE lt_item_balances WITH KEY item_no = <fs_item_acc>-item_no ASSIGNING FIELD-SYMBOL(<fs_item_bal>). IF sy-subrc <> 0. ls_item_balance-item_no = <fs_item_acc>-item_no. ls_item_balance-opening_balance = lv_opening. ls_item_balance-ending_balance = lv_ending. INSERT ls_item_balance INTO TABLE lt_item_balances. ELSE. <fs_item_bal>-opening_balance = <fs_item_bal>-opening_balance + lv_opening. <fs_item_bal>-ending_balance = <fs_item_bal>-ending_balance + lv_ending. ENDIF. ENDLOOP. ENDLOOP. " 将计算结果更新到配置表中 PERFORM update_item_balances_from_hash USING lt_item_balances. " 特殊处理第84行 - 从ZFIR_006获取数据 PERFORM get_zfir_006_data_for_line_84. ENDFORM. *&---------------------------------------------------------------------* *& Form GET_ZFIR_006_DATA_FOR_LINE_84 *&---------------------------------------------------------------------* FORM get_zfir_006_data_for_line_84. " 查找第84行(Retained Earnings) READ TABLE gt_right_map WITH KEY item_no = 84 ASSIGNING FIELD-SYMBOL(<fs_line_84>). IF sy-subrc = 0. FIELD-SYMBOLS <lt_pay_data> TYPE ANY TABLE. DATA lr_pay_data TYPE REF TO data. DATA lt_selscreen TYPE TABLE OF rsparams. DATA ls_selscreen TYPE rsparams. " 初始化设置,屏蔽 ALV 显示 CALL METHOD cl_salv_bs_runtime_info=>set EXPORTING display = abap_false metadata = abap_false data = abap_true. " 清空选择屏幕表 REFRESH: lt_selscreen. " 填充公司代码参数 ls_selscreen-selname = 'P_BUKRS'. " 对应目标参数 p_bukrs ls_selscreen-kind = 'P'. ls_selscreen-sign = 'I'. ls_selscreen-option = 'EQ'. ls_selscreen-low = p_bukrs. APPEND ls_selscreen TO lt_selscreen. " 填充分类账参数 ls_selscreen-selname = 'P_RLDNR'. " 对应目标参数 p_rldnr ls_selscreen-kind = 'P'. ls_selscreen-sign = 'I'. ls_selscreen-option = 'EQ'. ls_selscreen-low = p_ldnr. APPEND ls_selscreen TO lt_selscreen. " 填充年度参数 ls_selscreen-selname = 'P_RYEAR'. " 对应目标参数 p_ryear ls_selscreen-kind = 'P'. ls_selscreen-sign = 'I'. ls_selscreen-option = 'EQ'. ls_selscreen-low = p_year. APPEND ls_selscreen TO lt_selscreen. " 填充起始期间参数 ls_selscreen-selname = 'P_PERAF'. " 对应目标参数 p_peraf ls_selscreen-kind = 'P'. ls_selscreen-sign = 'I'. ls_selscreen-option = 'EQ'. ls_selscreen-low = p_from. APPEND ls_selscreen TO lt_selscreen. " 填充结束期间参数 ls_selscreen-selname = 'P_PERAT'. " 对应目标参数 p_perat ls_selscreen-kind = 'P'. ls_selscreen-sign = 'I'. ls_selscreen-option = 'EQ'. ls_selscreen-low = p_to. APPEND ls_selscreen TO lt_selscreen. " 调用目标程序并传递选择屏幕参数 SUBMIT zfir_006 WITH SELECTION-TABLE lt_selscreen AND RETURN. TRY. " 获取 ALV 数据 CALL METHOD cl_salv_bs_runtime_info=>get_data_ref IMPORTING r_data = lr_pay_data. ASSIGN lr_pay_data->* TO <lt_pay_data>. CATCH cx_salv_bs_sc_runtime_info. MESSAGE '无法获取 ALV 数据' TYPE 'E'. ENDTRY. " 清理设置,恢复默认状态 CALL METHOD cl_salv_bs_runtime_info=>clear_all. " 处理获取的数据 IF <lt_pay_data> IS ASSIGNED. DATA: lv_fieldname1 TYPE string VALUE 'AMOUNT'. DATA: lv_fieldname2 TYPE string VALUE 'NO'. FIELD-SYMBOLS: <fs_no> TYPE any. FIELD-SYMBOLS: <fs_amount> TYPE any. LOOP AT <lt_pay_data> ASSIGNING FIELD-SYMBOL(<dyn_wa>). ASSIGN COMPONENT lv_fieldname2 OF STRUCTURE <dyn_wa> TO <fs_no>. IF sy-subrc = 0 AND <fs_no> IS ASSIGNED. IF <fs_no> = 71. " 第71行对应ZFIR_006中的数据 ASSIGN COMPONENT lv_fieldname1 OF STRUCTURE <dyn_wa> TO <fs_amount>. IF sy-subrc = 0 AND <fs_amount> IS ASSIGNED. " 更新第84行的期末余额,根据符号调整 * IF <fs_line_84>-sign = c_minus. * <fs_line_84>-ending_balance = -1 * <fs_amount>. * ELSE. <fs_line_84>-ending_balance = <fs_amount>. * <fs_line_84>-opening_balance = <fs_amount>. * ENDIF. EXIT. " 找到数据后退出循环 ENDIF. ENDIF. ENDIF. UNASSIGN <fs_no>. UNASSIGN <fs_amount>. ENDLOOP. ENDIF. ENDIF. ENDFORM. *&---------------------------------------------------------------------* *& Form CALCULATE_PERIOD_BALANCE *&---------------------------------------------------------------------* FORM calculate_period_balance USING is_balance TYPE ty_balance_data iv_from TYPE i iv_to TYPE i CHANGING cv_balance TYPE acdoct-hslvt. DATA: lv_period TYPE i. CLEAR cv_balance. DO iv_to - iv_from + 1 TIMES. lv_period = iv_from + sy-index - 1. CASE lv_period. WHEN 1. cv_balance = cv_balance + is_balance-hsl01. WHEN 2. cv_balance = cv_balance + is_balance-hsl02. WHEN 3. cv_balance = cv_balance + is_balance-hsl03. WHEN 4. cv_balance = cv_balance + is_balance-hsl04. WHEN 5. cv_balance = cv_balance + is_balance-hsl05. WHEN 6. cv_balance = cv_balance + is_balance-hsl06. WHEN 7. cv_balance = cv_balance + is_balance-hsl07. WHEN 8. cv_balance = cv_balance + is_balance-hsl08. WHEN 9. cv_balance = cv_balance + is_balance-hsl09. WHEN 10. cv_balance = cv_balance + is_balance-hsl10. WHEN 11. cv_balance = cv_balance + is_balance-hsl11. WHEN 12. cv_balance = cv_balance + is_balance-hsl12. WHEN 13. cv_balance = cv_balance + is_balance-hsl13. WHEN 14. cv_balance = cv_balance + is_balance-hsl14. WHEN 15. cv_balance = cv_balance + is_balance-hsl15. WHEN 16. cv_balance = cv_balance + is_balance-hsl16. ENDCASE. ENDDO. ENDFORM. *&---------------------------------------------------------------------* *& Form INITIALIZE_ITEM_BALANCES *&---------------------------------------------------------------------* FORM initialize_item_balances. " 初始化左侧所有科目行的余额 LOOP AT gt_left_map ASSIGNING FIELD-SYMBOL(<fs_left>). CLEAR: <fs_left>-opening_balance, <fs_left>-ending_balance. ENDLOOP. " 初始化右侧所有科目行的余额 LOOP AT gt_right_map ASSIGNING FIELD-SYMBOL(<fs_right>). CLEAR: <fs_right>-opening_balance, <fs_right>-ending_balance. ENDLOOP. ENDFORM. *&---------------------------------------------------------------------* *& Form UPDATE_ITEM_BALANCES_FROM_HASH *&---------------------------------------------------------------------* FORM update_item_balances_from_hash USING it_item_balances TYPE HASHED TABLE. FIELD-SYMBOLS: <fs_item_bal> TYPE ty_item_balance. LOOP AT it_item_balances ASSIGNING <fs_item_bal>. " 更新左侧配置表 READ TABLE gt_left_map WITH KEY item_no = <fs_item_bal>-item_no ASSIGNING FIELD-SYMBOL(<fs_left>). IF sy-subrc = 0. <fs_left>-opening_balance = <fs_left>-opening_balance + <fs_item_bal>-opening_balance. <fs_left>-ending_balance = <fs_left>-ending_balance + <fs_item_bal>-ending_balance. ELSE. " 更新右侧配置表 READ TABLE gt_right_map WITH KEY item_no = <fs_item_bal>-item_no ASSIGNING FIELD-SYMBOL(<fs_right>). IF sy-subrc = 0. <fs_right>-opening_balance = <fs_right>-opening_balance + <fs_item_bal>-opening_balance. <fs_right>-ending_balance = <fs_right>-ending_balance + <fs_item_bal>-ending_balance. ENDIF. ENDIF. ENDLOOP. ENDFORM. *&---------------------------------------------------------------------* *& Form CALCULATE_ALL_TOTALS *&---------------------------------------------------------------------* FORM calculate_all_totals. PERFORM calculate_left_totals. PERFORM calculate_right_totals. ENDFORM. *&---------------------------------------------------------------------* *& Form CALCULATE_LEFT_TOTALS_HIERARCHICAL *& 按依赖关系分层计算左侧总计 *&---------------------------------------------------------------------* FORM calculate_left_totals. DATA: lv_opening_sum TYPE acdoct-hslvt, lv_ending_sum TYPE acdoct-hslvt. " ============================== 第1层:基础行计算 ============================== " 这些是叶子节点,直接从数据源获取或已计算好 " ============================== 第2层:第一级汇总 ============================== " 直接汇总明细行 " 行2 = 3+4+5+6+7+8 PERFORM sum_lines USING '3,4,5,6,7,8' 'L' CHANGING lv_opening_sum lv_ending_sum. PERFORM update_line USING '2' 'L' lv_opening_sum lv_ending_sum. " 行9 = 10+11+12+13+14+15 PERFORM sum_lines USING '10,11,12,13,14,15' 'L' CHANGING lv_opening_sum lv_ending_sum. PERFORM update_line USING '9' 'L' lv_opening_sum lv_ending_sum. " 行16 = 17+18+19 PERFORM sum_lines USING '17,18,19' 'L' CHANGING lv_opening_sum lv_ending_sum. PERFORM update_line USING '16' 'L' lv_opening_sum lv_ending_sum. " 行20 = 21+22 PERFORM sum_lines USING '21,22' 'L' CHANGING lv_opening_sum lv_ending_sum. PERFORM update_line USING '20' 'L' lv_opening_sum lv_ending_sum. " 行23 = 24+25+26+27+28 PERFORM sum_lines USING '24,25,26,27,28' 'L' CHANGING lv_opening_sum lv_ending_sum. PERFORM update_line USING '23' 'L' lv_opening_sum lv_ending_sum. " 行29 = 30+31+32+33+34 PERFORM sum_lines USING '30,31,32,33,34' 'L' CHANGING lv_opening_sum lv_ending_sum. PERFORM update_line USING '29' 'L' lv_opening_sum lv_ending_sum. " 行35 = 36 PERFORM sum_lines USING '36' 'L' CHANGING lv_opening_sum lv_ending_sum. PERFORM update_line USING '35' 'L' lv_opening_sum lv_ending_sum. " 行38 = 39 PERFORM sum_lines USING '39' 'L' CHANGING lv_opening_sum lv_ending_sum. PERFORM update_line USING '38' 'L' lv_opening_sum lv_ending_sum. " 行40 = 41+42+43+44+45+46 PERFORM sum_lines USING '41,42,43,44,45,46' 'L' CHANGING lv_opening_sum lv_ending_sum. PERFORM update_line USING '40' 'L' lv_opening_sum lv_ending_sum. " 行47 = 48 PERFORM sum_lines USING '48' 'L' CHANGING lv_opening_sum lv_ending_sum. PERFORM update_line USING '47' 'L' lv_opening_sum lv_ending_sum. " 行49 = 50+51+52+53+54+55+56 PERFORM sum_lines USING '50,51,52,53,54,55,56' 'L' CHANGING lv_opening_sum lv_ending_sum. PERFORM update_line USING '49' 'L' lv_opening_sum lv_ending_sum. " 行57 = 58+59+60+61 PERFORM sum_lines USING '58,59,60,61' 'L' CHANGING lv_opening_sum lv_ending_sum. PERFORM update_line USING '57' 'L' lv_opening_sum lv_ending_sum. " 行62 = 63+64+65+66+67 PERFORM sum_lines USING '63,64,65,66,67' 'L' CHANGING lv_opening_sum lv_ending_sum. PERFORM update_line USING '62' 'L' lv_opening_sum lv_ending_sum. " 行68 = 69 PERFORM sum_lines USING '69' 'L' CHANGING lv_opening_sum lv_ending_sum. PERFORM update_line USING '68' 'L' lv_opening_sum lv_ending_sum. " 行70 = 71+72 PERFORM sum_lines USING '71,72' 'L' CHANGING lv_opening_sum lv_ending_sum. PERFORM update_line USING '70' 'L' lv_opening_sum lv_ending_sum. " ============================== 第3层:第二级汇总 ============================== " 汇总第一级汇总行或混合汇总 " 行1 = 2 + 9 + 16 + 20 + 23 + 29 + 35 PERFORM sum_lines USING '2,9,16,20,23,29,35' 'L' CHANGING lv_opening_sum lv_ending_sum. PERFORM update_line USING '1' 'L' lv_opening_sum lv_ending_sum. " 行37 = 38+40+47+49+57+62+68+70 PERFORM sum_lines USING '38,40,47,49,57,62,68,70' 'L' CHANGING lv_opening_sum lv_ending_sum. PERFORM update_line USING '37' 'L' lv_opening_sum lv_ending_sum. " ============================== 第4层:最终汇总 ============================== " 顶级汇总 " 行73 = 1+37 PERFORM sum_lines USING '1,37' 'L' CHANGING lv_opening_sum lv_ending_sum. PERFORM update_line USING '73' 'L' lv_opening_sum lv_ending_sum. ENDFORM. *&---------------------------------------------------------------------* *& Form CALCULATE_RIGHT_TOTALS_HIERARCHICAL *& 按依赖关系分层计算右侧总计 *&---------------------------------------------------------------------* FORM calculate_right_totals. DATA: lv_opening_sum TYPE acdoct-hslvt, lv_ending_sum TYPE acdoct-hslvt. " ============================== 第1层:基础行计算 ============================== " 这些是叶子节点,直接从数据源获取或已计算好 " ============================== 第2层:第一级汇总 ============================== " 直接汇总明细行 " 行76 = 77+78+79 PERFORM sum_lines USING '77,78,79' 'R' CHANGING lv_opening_sum lv_ending_sum. PERFORM update_line USING '76' 'R' lv_opening_sum lv_ending_sum. " 行80 = 81+82 PERFORM sum_lines USING '81,82' 'R' CHANGING lv_opening_sum lv_ending_sum. PERFORM update_line USING '80' 'R' lv_opening_sum lv_ending_sum. " 行83 = 84+85 PERFORM sum_lines USING '84,85' 'R' CHANGING lv_opening_sum lv_ending_sum. PERFORM update_line USING '83' 'R' lv_opening_sum lv_ending_sum. " 行87 = 88+89+90 PERFORM sum_lines USING '88,89,90' 'R' CHANGING lv_opening_sum lv_ending_sum. PERFORM update_line USING '87' 'R' lv_opening_sum lv_ending_sum. " 行93 = 94+95+96+97 PERFORM sum_lines USING '94,95,96,97' 'R' CHANGING lv_opening_sum lv_ending_sum. PERFORM update_line USING '93' 'R' lv_opening_sum lv_ending_sum. " 行98 = 99+100+101+102+103 PERFORM sum_lines USING '99,100,101,102,103' 'R' CHANGING lv_opening_sum lv_ending_sum. PERFORM update_line USING '98' 'R' lv_opening_sum lv_ending_sum. " 行104 = 105 PERFORM sum_lines USING '105' 'R' CHANGING lv_opening_sum lv_ending_sum. PERFORM update_line USING '104' 'R' lv_opening_sum lv_ending_sum. " 行106 = 107 PERFORM sum_lines USING '107' 'R' CHANGING lv_opening_sum lv_ending_sum. PERFORM update_line USING '106' 'R' lv_opening_sum lv_ending_sum. " 行109 = 110 PERFORM sum_lines USING '110' 'R' CHANGING lv_opening_sum lv_ending_sum. PERFORM update_line USING '109' 'R' lv_opening_sum lv_ending_sum. " 行111 = 112 PERFORM sum_lines USING '112' 'R' CHANGING lv_opening_sum lv_ending_sum. PERFORM update_line USING '111' 'R' lv_opening_sum lv_ending_sum. " 行113 = 114+115+116+117+118 PERFORM sum_lines USING '114,115,116,117,118' 'R' CHANGING lv_opening_sum lv_ending_sum. PERFORM update_line USING '113' 'R' lv_opening_sum lv_ending_sum. " 行119 = 120 PERFORM sum_lines USING '120' 'R' CHANGING lv_opening_sum lv_ending_sum. PERFORM update_line USING '119' 'R' lv_opening_sum lv_ending_sum. " 行121 = 122 PERFORM sum_lines USING '122' 'R' CHANGING lv_opening_sum lv_ending_sum. PERFORM update_line USING '121' 'R' lv_opening_sum lv_ending_sum. " 行123 = 124+125+126+127+128+129+130 PERFORM sum_lines USING '124,125,126,127,128,129,130' 'R' CHANGING lv_opening_sum lv_ending_sum. PERFORM update_line USING '123' 'R' lv_opening_sum lv_ending_sum. " 行131 = 132 PERFORM sum_lines USING '132' 'R' CHANGING lv_opening_sum lv_ending_sum. PERFORM update_line USING '131' 'R' lv_opening_sum lv_ending_sum. " ============================== 第3层:第二级汇总 ============================== " 汇总第一级汇总行 " 行75 = 76+80+83+86 (注意86是明细行) PERFORM sum_lines USING '76,80,83,86' 'R' CHANGING lv_opening_sum lv_ending_sum. PERFORM update_line USING '75' 'R' lv_opening_sum lv_ending_sum. " 行92 = 93+98+104+106 PERFORM sum_lines USING '93,98,104,106' 'R' CHANGING lv_opening_sum lv_ending_sum. PERFORM update_line USING '92' 'R' lv_opening_sum lv_ending_sum. " 行108 = 109+111+113+119+121+123+131 PERFORM sum_lines USING '109,111,113,119,121,123,131' 'R' CHANGING lv_opening_sum lv_ending_sum. PERFORM update_line USING '108' 'R' lv_opening_sum lv_ending_sum. " ============================== 第4层:第三级汇总 ============================== " 更高层级的汇总 " 行74 = 75+87+91 (注意91是明细行) PERFORM sum_lines USING '75,87,91' 'R' CHANGING lv_opening_sum lv_ending_sum. PERFORM update_line USING '74' 'R' lv_opening_sum lv_ending_sum. " ============================== 第5层:最终汇总 ============================== " 顶级汇总 " 行133 = 108+92+74 PERFORM sum_lines USING '108,92,74' 'R' CHANGING lv_opening_sum lv_ending_sum. PERFORM update_line USING '133' 'R' lv_opening_sum lv_ending_sum. ENDFORM. *&---------------------------------------------------------------------* *& Form SUM_LINES *&---------------------------------------------------------------------* FORM sum_lines USING iv_line_numbers TYPE string iv_side TYPE c CHANGING cv_opening TYPE acdoct-hslvt cv_ending TYPE acdoct-hslvt. DATA: lt_numbers TYPE TABLE OF string, lv_number TYPE string. SPLIT iv_line_numbers AT ',' INTO TABLE lt_numbers. CLEAR: cv_opening, cv_ending. LOOP AT lt_numbers INTO lv_number. IF iv_side = 'L'. READ TABLE gt_left_map WITH KEY item_no = lv_number ASSIGNING FIELD-SYMBOL(<fs_line>). ELSE. READ TABLE gt_right_map WITH KEY item_no = lv_number ASSIGNING <fs_line>. ENDIF. IF sy-subrc = 0. cv_opening = cv_opening + <fs_line>-opening_balance. cv_ending = cv_ending + <fs_line>-ending_balance. ENDIF. ENDLOOP. ENDFORM. *&---------------------------------------------------------------------* *& Form UPDATE_LINE *&---------------------------------------------------------------------* FORM update_line USING iv_item_no TYPE n iv_side TYPE c iv_opening TYPE acdoct-hslvt iv_ending TYPE acdoct-hslvt. IF iv_side = 'L'. READ TABLE gt_left_map WITH KEY item_no = iv_item_no ASSIGNING FIELD-SYMBOL(<fs_line>). ELSE. READ TABLE gt_right_map WITH KEY item_no = iv_item_no ASSIGNING <fs_line>. ENDIF. IF sy-subrc = 0. <fs_line>-opening_balance = iv_opening. <fs_line>-ending_balance = iv_ending. ENDIF. ENDFORM. *&---------------------------------------------------------------------* *& Form BUILD_OUTPUT_TABLE *&---------------------------------------------------------------------* FORM build_output_table. DATA: lv_max_lines TYPE i. gt_left = gt_left_map. gt_right = gt_right_map. " 确定最大行数 DESCRIBE TABLE gt_left LINES DATA(lv_left_lines). DESCRIBE TABLE gt_right LINES DATA(lv_right_lines). lv_max_lines = nmax( val1 = lv_left_lines val2 = lv_right_lines ). " 构建输出表 DO lv_max_lines TIMES. DATA(lv_index) = sy-index. CLEAR gs_output. " 左侧数据 READ TABLE gt_left INDEX lv_index ASSIGNING FIELD-SYMBOL(<fs_left>). IF sy-subrc = 0. gs_output-left_item = <fs_left>-item_text. gs_output-left_no = <fs_left>-item_no. gs_output-left_opening = <fs_left>-opening_balance. gs_output-left_ending = <fs_left>-ending_balance. ENDIF. " 右侧数据 READ TABLE gt_right INDEX lv_index ASSIGNING FIELD-SYMBOL(<fs_right>). IF sy-subrc = 0 AND lv_index <> lv_right_lines. gs_output-right_item = <fs_right>-item_text. gs_output-right_no = <fs_right>-item_no. gs_output-right_opening = <fs_right>-opening_balance. gs_output-right_ending = <fs_right>-ending_balance. ELSEIF lv_max_lines = lv_index. " 汇总行放到最后一行 READ TABLE gt_right INDEX lv_right_lines ASSIGNING <fs_right>. gs_output-right_item = <fs_right>-item_text. gs_output-right_no = <fs_right>-item_no. gs_output-right_opening = <fs_right>-opening_balance. gs_output-right_ending = <fs_right>-ending_balance. ENDIF. " 加粗样式 CASE gs_output-left_no. WHEN '1' OR '2' OR '9' OR '16' OR '20' OR '23' OR '29' OR '35' OR '37' OR '38' OR '40' OR '47' OR '49' OR '57' OR '62' OR '68' OR '70' OR '73'. DATA(ls_style) = VALUE lvc_s_styl( style = alv_style_font_bold fieldname = 'LEFT_ITEM' ). INSERT ls_style INTO TABLE gs_output-style_maktx. ls_style-fieldname = 'LEFT_OPENING'. INSERT ls_style INTO TABLE gs_output-style_maktx. ls_style-fieldname = 'LEFT_ENDING'. INSERT ls_style INTO TABLE gs_output-style_maktx. ls_style-fieldname = 'LEFT_NO'. INSERT ls_style INTO TABLE gs_output-style_maktx. ENDCASE. " 加粗样式 CASE gs_output-right_no. WHEN '74' OR '75' OR '76' OR '80' OR '83' OR '86' OR '87' OR '88' OR '89' OR '90' OR '91' OR '92' OR '93' OR '98' OR '104' OR '106' OR '108' OR '109' OR '111' OR '113' OR '119' OR '121' OR '123' OR '131' OR '133'. ls_style = VALUE lvc_s_styl( style = alv_style_font_bold fieldname = 'RIGHT_ITEM' ). INSERT ls_style INTO TABLE gs_output-style_maktx. ls_style-fieldname = 'RIGHT_OPENING'. INSERT ls_style INTO TABLE gs_output-style_maktx. ls_style-fieldname = 'RIGHT_ENDING'. INSERT ls_style INTO TABLE gs_output-style_maktx. ls_style-fieldname = 'RIGHT_NO'. INSERT ls_style INTO TABLE gs_output-style_maktx. ENDCASE. APPEND gs_output TO gt_output. ENDDO. ENDFORM. FORM display_alv_lvc. DATA: lt_fieldcat TYPE lvc_t_fcat, ls_fieldcat TYPE lvc_s_fcat, ls_layout TYPE lvc_s_layo, lt_exclude TYPE ui_functions, ls_variant TYPE disvariant, lt_sort TYPE lvc_t_sort, lt_filter TYPE lvc_t_filt. " 创建字段目录 PERFORM create_field_catalog CHANGING lt_fieldcat. " 设置布局 PERFORM set_layout CHANGING ls_layout. " 显示ALV CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC' EXPORTING i_callback_program = sy-repid i_callback_top_of_page = 'TOP_OF_PAGE' is_layout_lvc = ls_layout it_fieldcat_lvc = lt_fieldcat TABLES t_outtab = gt_output 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. *&---------------------------------------------------------------------* *& Form CREATE_FIELD_CATALOG *&---------------------------------------------------------------------* FORM create_field_catalog CHANGING ct_fieldcat TYPE lvc_t_fcat. DATA: ls_fieldcat TYPE lvc_s_fcat. " 清空字段目录 REFRESH: ct_fieldcat. " 1. 左侧科目列 (LEFT_ITEM) CLEAR ls_fieldcat. ls_fieldcat-fieldname = 'LEFT_ITEM'. ls_fieldcat-ref_table = 'SYST'. ls_fieldcat-ref_field = 'TEXT'. ls_fieldcat-coltext = 'Assets Item Description'. ls_fieldcat-scrtext_l = 'Assets Item Description'. ls_fieldcat-scrtext_m = 'Assets Item'. ls_fieldcat-scrtext_s = 'Item'. ls_fieldcat-outputlen = 50. ls_fieldcat-col_opt = 'X'. " 优化列宽 APPEND ls_fieldcat TO ct_fieldcat. " 2. 左侧编号列 (LEFT_NO) CLEAR ls_fieldcat. ls_fieldcat-fieldname = 'LEFT_NO'. ls_fieldcat-ref_table = 'SYST'. ls_fieldcat-ref_field = 'INDEX'. ls_fieldcat-coltext = 'NO.'. ls_fieldcat-scrtext_l = 'NO.'. ls_fieldcat-scrtext_m = 'NO.'. ls_fieldcat-scrtext_s = 'NO.'. ls_fieldcat-outputlen = 5. ls_fieldcat-col_opt = 'X'. ls_fieldcat-emphasize = 'C510'. " 设置列颜色(绿色) ls_fieldcat-no_zero = 'X'. APPEND ls_fieldcat TO ct_fieldcat. " 3. 左侧期初余额列 (LEFT_OPENING) CLEAR ls_fieldcat. ls_fieldcat-fieldname = 'LEFT_OPENING'. ls_fieldcat-coltext = 'Assets Opening Balance'. ls_fieldcat-scrtext_l = 'Assets Opening Balance'. ls_fieldcat-scrtext_m = 'Opening Bal'. ls_fieldcat-scrtext_s = 'Open'. ls_fieldcat-outputlen = 15. ls_fieldcat-datatype = 'CURR'. " 使用货币类型,会自动显示千分符 ls_fieldcat-decimals_o = 2. " 两位小数 ls_fieldcat-no_zero = 'X'. " 不显示值为0的单元格 APPEND ls_fieldcat TO ct_fieldcat. " 4. 左侧期末余额列 (LEFT_ENDING) CLEAR ls_fieldcat. ls_fieldcat-fieldname = 'LEFT_ENDING'. ls_fieldcat-coltext = 'Assets Period Ending Balance'. ls_fieldcat-scrtext_l = 'Assets Period Ending Balance'. ls_fieldcat-scrtext_m = 'Ending Balance'. ls_fieldcat-scrtext_s = 'End'. ls_fieldcat-outputlen = 15. ls_fieldcat-datatype = 'CURR'. " 使用货币类型,会自动显示千分符 ls_fieldcat-decimals_o = 2. " 两位小数 ls_fieldcat-no_zero = 'X'. " 不显示值为0的单元格 APPEND ls_fieldcat TO ct_fieldcat. " 5. 右侧科目列 (RIGHT_ITEM) CLEAR ls_fieldcat. ls_fieldcat-fieldname = 'RIGHT_ITEM'. ls_fieldcat-ref_table = 'SYST'. ls_fieldcat-ref_field = 'TEXT'. ls_fieldcat-coltext = 'Equity & Liabilities Item Description'. ls_fieldcat-scrtext_l = 'Equity & Liabilities Item Description'. ls_fieldcat-scrtext_m = 'Equity/Liab Item'. ls_fieldcat-scrtext_s = 'Item'. ls_fieldcat-outputlen = 50. ls_fieldcat-col_opt = 'X'. APPEND ls_fieldcat TO ct_fieldcat. " 6. 右侧编号列 (RIGHT_NO) CLEAR ls_fieldcat. ls_fieldcat-fieldname = 'RIGHT_NO'. ls_fieldcat-ref_table = 'SYST'. ls_fieldcat-ref_field = 'INDEX'. ls_fieldcat-coltext = 'NO.'. ls_fieldcat-scrtext_l = 'NO.'. ls_fieldcat-scrtext_m = 'NO.'. ls_fieldcat-scrtext_s = 'NO.'. ls_fieldcat-outputlen = 5. ls_fieldcat-col_opt = 'X'. ls_fieldcat-emphasize = 'C510'. " 设置列颜色(绿色) ls_fieldcat-no_zero = 'X'. APPEND ls_fieldcat TO ct_fieldcat. " 7. 右侧期初余额列 (RIGHT_OPENING) CLEAR ls_fieldcat. ls_fieldcat-fieldname = 'RIGHT_OPENING'. ls_fieldcat-coltext = 'Equity & Liabilities Opening Balance'. ls_fieldcat-scrtext_l = 'Equity & Liabilities Opening Balance'. ls_fieldcat-scrtext_m = 'Opening Bal'. ls_fieldcat-scrtext_s = 'Open'. ls_fieldcat-outputlen = 15. ls_fieldcat-datatype = 'CURR'. " 使用货币类型,会自动显示千分符 ls_fieldcat-decimals_o = 2. " 两位小数 ls_fieldcat-no_zero = 'X'. " 不显示值为0的单元格 APPEND ls_fieldcat TO ct_fieldcat. " 8. 右侧期末余额列 (RIGHT_ENDING) CLEAR ls_fieldcat. ls_fieldcat-fieldname = 'RIGHT_ENDING'. ls_fieldcat-coltext = 'Equity & Liabilities Ending Balance'. ls_fieldcat-scrtext_l = 'Equity & Liabilities Ending Balance'. ls_fieldcat-scrtext_m = 'Ending Balance'. ls_fieldcat-scrtext_s = 'End'. ls_fieldcat-outputlen = 15. ls_fieldcat-datatype = 'CURR'. " 使用货币类型,会自动显示千分符 ls_fieldcat-decimals_o = 2. " 两位小数 ls_fieldcat-no_zero = 'X'. " 不显示值为0的单元格 APPEND ls_fieldcat TO ct_fieldcat. ENDFORM. *&---------------------------------------------------------------------* *& Form SET_LAYOUT *&---------------------------------------------------------------------* FORM set_layout CHANGING cs_layout TYPE lvc_s_layo. CLEAR cs_layout. " 基本布局设置 cs_layout-zebra = 'X'. " 斑马线 cs_layout-cwidth_opt = 'X'. " 优化列宽 cs_layout-stylefname = 'STYLE_MAKTX'. ENDFORM. *&---------------------------------------------------------------------* *& Form USER_COMMAND *&---------------------------------------------------------------------* FORM user_command USING r_ucomm TYPE sy-ucomm rs_selfield TYPE slis_selfield. ENDFORM. *&---------------------------------------------------------------------* *& Form TOP_OF_PAGE *&---------------------------------------------------------------------* FORM top_of_page. DATA: lt_listheader TYPE slis_t_listheader, ls_listheader TYPE slis_listheader. " 主标题 CLEAR ls_listheader. ls_listheader-typ = 'H'. ls_listheader-info = |{ p_bukrs } BALANCE SHEET |. APPEND ls_listheader TO lt_listheader. " 公司信息 CLEAR ls_listheader. ls_listheader-typ = 'S'. ls_listheader-key = 'Company Code:'. ls_listheader-info = gv_bukrs. APPEND ls_listheader TO lt_listheader. CLEAR ls_listheader. ls_listheader-typ = 'S'. ls_listheader-key = 'Ledger:'. ls_listheader-info = gv_ldnr. APPEND ls_listheader TO lt_listheader. CLEAR ls_listheader. ls_listheader-typ = 'S'. ls_listheader-key = 'Fiscal Year:'. ls_listheader-info = gv_year. APPEND ls_listheader TO lt_listheader. CLEAR ls_listheader. ls_listheader-typ = 'S'. ls_listheader-key = 'Period:'. ls_listheader-info = |{ gv_from } to { gv_to }|. APPEND ls_listheader TO lt_listheader. " 调用函数显示页眉 CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE' EXPORTING it_list_commentary = lt_listheader. ENDFORM. *&---------------------------------------------------------------------* *& Form SET_EXCLUDE_FUNCTIONS *&---------------------------------------------------------------------* FORM set_exclude_functions CHANGING ct_exclude TYPE ui_functions. ENDFORM.
版权声明: 本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若内容造成侵权/违法违规/事实不符,请联系邮箱:809451989@qq.com进行投诉反馈,一经查实,立即删除!
网站建设 2026/7/30 15:15:26

3D工业相机量化管控耳机充电弹针关键尺寸

在TWS耳机等消费电子产品的制造中&#xff0c;&#xff08;Pogo Pin&#xff09;是实现可靠电气连接的核心微构件。其性能高度依赖于几何尺寸的精确控制。传统的接触式测量易损伤镀层&#xff0c;且效率低下&#xff1b;而2D视觉检测无法获取关键的高度与空间姿态信息&#xff…

作者头像 李华
网站建设 2026/7/30 20:29:29

springboot vue2校园兼职平台设计与实现

博主介绍&#xff1a;翰文编程 专注于Java&#xff08;springboot ssm 等开发框架&#xff09; vue .net php phython node.js uniapp 微信小程序 等诸多技术领域和课设项目实战、企业信息化系统建设&#xff0c;从业十八余年开发设计教学工作 ☆☆☆ 精彩专栏推荐订阅☆☆…

作者头像 李华
网站建设 2026/7/31 23:00:19

YOLO11-ReCalibrationFPN-P345实现酒液品牌识别与分类_1

1. YOLO11-ReCalibrationFPN-P345实现酒液品牌识别与分类 在当今快速发展的零售行业&#xff0c;酒类产品的品牌识别与分类对于库存管理、销售统计和防伪验证具有重要意义。本文将介绍如何使用YOLO11-ReCalibrationFPN-P345模型实现酒液品牌的自动识别与分类系统&#xff0c;该…

作者头像 李华
网站建设 2026/8/1 12:17:16

赋能矿业智能化转型,ManageEngine卓豪助力招金矿业停机时间减少 70%

当前&#xff0c;中国矿业正经历快速数字化转型 ——《2025 年中国矿业发展研究报告》显示&#xff0c;2025 年中国矿业智能化开采装备普及率已达 48%&#xff0c;较 2024 年提升 10 个百分点。2025 年 8 月&#xff0c;《“人工智能 ” 行动意见》更是明确提出&#xff0c;到 …

作者头像 李华
网站建设 2026/8/1 13:09:13

基于EmotiVoice的语音情感迁移实验全过程记录

基于EmotiVoice的语音情感迁移实验全过程记录 在虚拟主播直播带货时突然“愤怒”反击黑粉&#xff0c;或是智能客服察觉用户焦虑后主动放缓语速、语气转为温和——这些曾属于科幻场景的“共情式语音交互”&#xff0c;正随着情感语音合成技术的突破逐渐成为现实。传统TTS系统生…

作者头像 李华