位置

1.树报表增强

SAPLBSPL 动态增强点/部分 \PR:SAPLBSPL\FO:BSPL_ITEMS_ADD\SE:END\EI

2.打印增强

/CCEE/RSFI_BILA \PR:RFBILA00\EX:BEFORE_PRINT\EI

配置

OB58 配置报表版本和行项目的科目

demo

1.树报表增强

ENHANCEMENT 2 .

*IF sy-uname eq 'IBM97'.

data:l_dmbtr type dmbtr,

l_rldnr type rldnr,

lt_ztfi100 type table of ztfi100,

ls_ztfi100 type ztfi100,

ls_ztfi101 type ztfi101,

l_land1 type t001-land1.

data:l_name(50) type c.

data:ls_add_data type rfbila_alv_data.

data:lt_add_data type table of rfbila_alv_data.

data: lt_rsthie type tt_rsthie with header line.

ranges:lr_rldnr for bspl_tree_fieldcat-rldnr.

data:l_fieldname type string value '(RFBILA00)SD_RLDNR[]',

ls_rldnr like lr_rldnr.

field-symbols: <fs_rldnr> type any.

" 国家地区

select single land1 into l_land1 from t001 where bukrs = is_settings-bukrs.

"判断增强是否启用

clear ls_ztfi101.

select single * into ls_ztfi101 from ztfi101 where land1 = l_land1 and progm = is_settings-repid and zenhname = 'ZFI_BALANCE'.

if sy-subrc ne 0 or ( sy-subrc eq 0 and ls_ztfi101-zon2cle eq '' ).

SELECT *

FROM FAGL_011QT

WHERE VERSN = @is_settings-fs_version and SPRAS = @sy-langu

ORDER BY ERGSL

INTO TABLE @data(lt_FAGL_011QT).

"取分类账

assign (l_fieldname) to <fs_rldnr>.

lr_rldnr[] = <fs_rldnr>.

read table lr_rldnr into ls_rldnr index 1.

if sy-subrc eq 0.

l_rldnr = ls_rldnr-low.

else.

l_rldnr = '0L'.

endif.

"判断当前报表版本/科目是否需要重新计算余额

refresh:lt_add_data,

lt_rsthie.

loop at pt_biladata assigning <biladata>.

if not ( p_altacct is initial ).

* .... alternative account number is used

assign: <biladata>-ktop2 to <ktopl>,

<biladata>-altkt to <racct>.

elseif not ( t011-xergs is initial ).

* .... group account number is used

assign: <biladata>-kktpl to <ktopl>,

<biladata>-bilkt to <racct>.

else.

* .... default normal accounts used

assign: <biladata>-ktopl to <ktopl>,

<biladata>-racct to <racct>.

endif.

"取配置表的对应关系

clear lt_ztfi100.

select * into table lt_ztfi100

from ztfi100

where versn = is_settings-fs_version

* and ERGSL eq <biladata>-ERGSL

and ( acct eq <biladata>-altkt or acct eq <biladata>-racct ).

if sy-subrc eq 0 and lt_ztfi100 is not initial.

loop at lt_ztfi100 into ls_ztfi100.

l_dmbtr = 0.

if ls_ztfi100-ergsl = <biladata>-ergsl.

call function 'ZFM_FI_BALANCE'

exporting

i_bukrs = <biladata>-rbukrs

i_altkt = <biladata>-altkt

i_saknr = <biladata>-racct

i_gjahr = is_settings-rep_year_from "传进来的年度

i_poper = is_settings-rep_period_to "传进来的年度

is_ztfi100 = ls_ztfi100

i_rldnr = l_rldnr

importing

e_saldo = l_dmbtr.

if sy-subrc eq 0.

<biladata>-saldo = l_dmbtr.

endif.

else.

** "由于每个科目只能配置一次,所以出现不同报表行的直接添加对应行项目

clear ls_add_data.

move-corresponding <biladata> to ls_add_data.

ls_add_data-ergsl = ls_ztfi100-ergsl.

clear l_name.

l_name = ls_ztfi100-versn && ls_add_data-ergsl.

read table gt_rsthie with key name = l_name.

if sy-subrc eq 0.

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

*25.02.2022 14:25:29 chenyl for lihuan

*看这里写的,估计逻辑没理清楚,修复一下

* ls_add_data-changid = gt_rsthie-parent.

* ls_add_data-parent = gt_rsthie-parent.

* ls_add_data-id = gt_rsthie-id.

ls_add_data-changid = gt_rsthie-id.

ls_add_data-parent = gt_rsthie-id.

ls_add_data-id = gt_rsthie-CHILD. "如果没配科目,child id为空,会导致其他科目出不来

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

endif.

call function 'ZFM_FI_BALANCE'

exporting

i_bukrs = <biladata>-rbukrs

i_altkt = <biladata>-altkt

i_saknr = <biladata>-racct

i_gjahr = is_settings-rep_year_from "传进来的年度

i_poper = is_settings-rep_period_to "传进来的年度

is_ztfi100 = ls_ztfi100

i_rldnr = l_rldnr

importing

e_saldo = l_dmbtr.

if sy-subrc eq 0.

ls_add_data-saldo = l_dmbtr.

endif.

append ls_add_data to lt_add_data.

endif.

endloop.

endif.

endloop.

sort lt_add_data by ergsl.

loop at gt_rsthie.

read table lt_add_data into ls_add_data with key ergsl = gt_rsthie-name+4(10) binary search.

if sy-subrc eq 0.

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

* 25.02.2022 14:49:07 chenyl for lihuan

*项目描述,这里写的也不对,修复一下

* gt_rsthie-name = ls_add_data-ktop2 && ls_add_data-altkt.

READ TABLE lt_FAGL_011QT INTO DATA(ls_FAGL_011QT) with key ERGSL = ls_add_data-ergsl BINARY SEARCH.

IF sy-subrc = 0.

gt_rsthie-name = ls_FAGL_011QT-TXT45.

ENDIF.

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

modify gt_rsthie.

endif.

endloop.

append lines of lt_add_data to pt_biladata.

endif.

*ENDIF.

ENDENHANCEMENT.

2.打印增强

ENHANCEMENT 3  /CCEE/RSFI_BILA.    "active version

  IF x_pdfyu = 'X'.

    EXPORT scr_data

           TO MEMORY ID 'RSFI_BILA'.

    scr_print_to_form = no.

  ENDIF.

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

*02.03.2022 13:26:23 chenyl for lihuan

*资产负债表打印增强

call function 'ZFI_ZEHM_FI_BILA_PRINT'

  exporting

    iv_bilavers       = bilavers

    it_sd_bukrs       = sd_bukrs[]

    iv_bilbjahr       = bilbjahr

    it_monate         = b-monate[]

    iv_rldnr          = SD_RLDNR-LOW

*  CHANGING

*    ct_scr_data        = scr_data[]

          .

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

* C-CEE retrofit - RS localization

  INCLUDE /CCEE/RSFI_BILA_BEFORE_PRINT.

ENDENHANCEMENT.