业务背景:
在FAGLL03行项目报表中,显示总账科目名称、功能范围名称等。
解决方案:
Se11:Append Structure to faglposx
SE19 实现FAGL_ITEMS_CH_DATA
加入code实现:
METHOD if_ex_fagl_items_ch_data~change_items.
DATA: wa_items TYPE faglposx,
zztxt20 TYPE faglposx-zztxt20,"科目名称
zzktext TYPE cskt-ktext,"成本中心文本.
zzfkbtx TYPE faglposx-zzfkbtx,"功能范围名称
zzrstgr TYPE faglposx-u_rstgr,"原因代码
zzrstgr_t TYPE faglposx-zzrstgr_t."原因代码名称
LOOP AT ct_items INTO wa_items.
"获取科目名称
SELECT SINGLE txt20 FROM skat
INTO zztxt20
WHERE ktopl = '1000'
AND saknr = wa_items-konto
AND spras = '1'.
IF sy-subrc = 0.
wa_items-zztxt20 = zztxt20.
ENDIF.
"获取成本中心名称
SELECT SINGLE ktext FROM cskt
INTO zzktext
WHERE kostl = wa_items-kostl.
IF sy-subrc = 0.
wa_items-zzktext = zzktext.
ENDIF.
"获取功能范围名称
SELECT SINGLE fkbtx FROM tfkbt
INTO zzfkbtx
WHERE fkber = wa_items-fkber
AND spras = '1'.
IF sy-subrc = 0.
wa_items-zzfkbtx = zzfkbtx.
ENDIF.
"获取原因代码名称
IF wa_items-konto(4) EQ '1001'
OR wa_items-konto(4) EQ '1002'
OR wa_items-konto(4) EQ '1012'.
SELECT SINGLE rstgr FROM bseg
INTO zzrstgr
WHERE bukrs = wa_items-bukrs
AND gjahr = wa_items-gjahr
AND belnr = wa_items-belnr
AND buzei = wa_items-buzei.
IF sy-subrc = 0.
SELECT SINGLE txt20 FROM t053s
INTO zzrstgr_t
WHERE bukrs = wa_items-bukrs
AND rstgr = zzrstgr
AND spras = '1'.
IF sy-subrc = 0.
wa_items-zzrstgr_t = zzrstgr_t.
ENDIF.
ENDIF.
ENDIF.
MODIFY ct_items FROM wa_items.
ENDLOOP.
ENDMETHOD.
保存激活。 到此为止,已经可以实现对FAGLL03报表的任意设置,任意TABLE,任意field。
参考资料:
Note 1034354 - FAGLL03 Display of offsetting account information.pdf