ABAP实现本地化的资产负债表和损益表.docx
《ABAP实现本地化的资产负债表和损益表.docx》由会员分享,可在线阅读,更多相关《ABAP实现本地化的资产负债表和损益表.docx(140页珍藏版)》请在冰豆网上搜索。
ABAP实现本地化的资产负债表和损益表
ABAP实现本地化的资产负债表和损益表
ABAP实现本地化的资产负债表和损益表
1.设计思路:
SAP没有提供标准的符合中国标准的资产负债表和损益表,需要我们在系统中自定义开发,我们在配置报表版本时都指定了
一个项目的编号,一个版本下面都有期其统驭的科目范围,我们可以根据这个项目编号找到相应的科目范围,然后根据科目范围
获取科目借贷汇总的值。
SAP中资产负债表的配置图示:
我们传统的资产负债表如下格式:
我们可以在程序中用项目编号找到其下面的科目范围,然后取科目汇总值,因为资产负债表是固定的,所以我们要
IFcISINITIAL.
PERFORMsetlist.
gv_name=‘爱思开实业(上海)商贸有限公司合并财务报表版本’.
c=‘X’.
gv_rp=‘资产负债表’.
ELSE.
PERFORMsetpcgUSINGp_rpv.
CASEp_rpv.
WHEN‘2070′.
gv_name=‘爱思开实业(上海)商贸有限公司合并财务报表版本’.
WHEN‘2071′.
gv_name=‘爱思开实业(上海)商贸有限公总部财务报表版本’.
WHEN‘2072′.
gv_name=‘爱思开实业(上海)商贸有限公司直营店财务报表版本’.
WHEN‘2073′.
gv_name=”.
ENDCASE.
IFp_rp=‘BS’.
gv_rp=‘资产负债表’.
ELSE.
gv_rp=‘利润表’.
ENDIF.
ENDIF.
START-OF-SELECTION.
PERFORMsynchrodata.
PERFORMget_data1.
*&———————————————————————*
*& Include ZFIR00026_TOP
*&———————————————————————*
*Datadefinition
TYPE-POOLSvrm.
TABLES:
faglflexa.
“同步数据用的凭证抬头表
DATA:
BEGINOFgt_bkpfsynOCCURS0,
gjahrLIKEbkpf-gjahr,
bukrsLIKEbkpf-bukrs,
belnrLIKEbkpf-belnr,
ENDOFgt_bkpfsyn.
DATAly(4)TYPEn.
“同步数据用的凭证行项目表(bseg)
DATA:
BEGINOFgt_bsegsynOCCURS0,
gjahrLIKEbseg-gjahr,
bukrsLIKEbseg-bukrs,
belnrLIKEbseg-belnr,
prctrLIKEbseg-prctr,
pprctLIKEbseg-pprct,
buzeiLIKEbseg-buzei,
ENDOFgt_bsegsyn.
DATA:
BEGINOFgt_fagasynOCCURS0.
INCLUDESTRUCTUREfaglflexa.
DATA:
ENDOFgt_fagasyn.
TYPES:
ch(3)TYPEc,
cf(4)TYPEc,
cgcp(12)TYPEc,
ok_codeLIKEsy-ucomm.
DATA:
c,d,
gv_bsTYPEukurs_currVALUE1,”倍数
gv_iden
(2).
“要显示的资产负债表
DATA:
BEGINOFgt_alv_bs0OCCURS0,
lct1TYPEint1,
item1TYPEzitem,
yamt1TYPEhslvt12,
ysamt1TYPEhslvt12,
lct2TYPEint1,
item2TYPEzitem,
yamt2TYPEhslvt12,
ysamt2TYPEhslvt12,
waersLIKEt001-waers,
ENDOF gt_alv_bs0.
DATA:
BEGINOFgt_bsOCCURS0,
ukursTYPEukurs_curr,
gdatuTYPEgdatu_inv,
ENDOFgt_bs.
DATA:
gv_mf(5).”Themonthfield
*Thereportversionaccountinformation.
“要显示的利润表
DATA:
BEGINOFgt_alv_is0OCCURS0,
lctTYPEint1,
itemTYPEzitem,
yamtLIKEfaglflext-hslvt,”本年累计数
mamtLIKEfaglflext-hslvt,”本月累计数
waersLIKEt001-waers,
ENDOFgt_alv_is0.
“下载数据的内表
DATA:
BEGINOFgt_alv_is01OCCURS0,
lctTYPEint1,
itemTYPEzitem,
yamtLIKEfaglflext-hslvt,”本年累计数
mamtLIKEfaglflext-hslvt,”本月累计数
ENDOFgt_alv_is01.
*利润表下钻数据内表
*–>2012.01.16CCYUSTART
DATA:
BEGINOFgt_skatOCCURS0,
saknrLIKEskat-saknr,
txt50LIKEskat-txt50,
ENDOFgt_skat.
*<–2012.01.16CCYUEND.
DATA:
BEGINOFgt_alv_is_dp1 OCCURS0,
racctLIKEfaglflexa-racct,
*–>2012.01.16CCYUSTART
txt50LIKEskat-txt50,
*<–2012.01.16CCYUEND.
hslLIKEfaglflexa-hsl,
ENDOFgt_alv_is_dp1.
*利润表下钻数据内表
DATA:
BEGINOFgt_alv_bs_dp1 OCCURS0,
racctLIKEfaglflexa-racct,
*–>2012.01.16CCYUSTART
txt50LIKEskat-txt50,
*<–2012.01.16CCYUEND.
hslLIKEfaglflexa-hsl,
ENDOFgt_alv_bs_dp1.
DATA:
BEGINOFgt_alv_bs_dp2 OCCURS0,
racctLIKEfaglflexa-racct,
*–>2012.01.16CCYUSTART
txt50LIKEskat-txt50,
*<–2012.01.16CCYUEND.
hslLIKEfaglflexa-hsl,
ENDOFgt_alv_bs_dp2.
TYPES:
BEGINOFgs_alv_bs_dp_obj,
racctLIKEfaglflexa-racct,
*–>2012.01.16CCYUSTART
txt50LIKEskat-txt50,
*<–2012.01.16CCYUEND.
hslLIKEfaglflexa-hsl,
ENDOFgs_alv_bs_dp_obj.
DATA:
gs_alv_bs_dp_obj1TYPEgs_alv_bs_dp_obj.
TYPES:
gt_alv_bs_dpTYPESTANDARDTABLEOFgs_alv_bs_dp_obj.
*利润表下钻临时数据内表
DATA:
BEGINOFgt_alv_is_dp2OCCURS0,
racctLIKEfaglflexa-racct,
*–>2012.01.16CCYUSTART
txt50LIKEskat-txt50,
*<–2012.01.16CCYUEND.
hslLIKEfaglflexa-hsl,
ENDOFgt_alv_is_dp2.
DATA:
BEGINOFgt_fagl_011zcOCCURS0,
versnLIKEfagl_011zc-versn,
ergsl LIKEfagl_011zc-ergsl,
txt45LIKEfagl_011qt-txt45,
vonktLIKEfagl_011zc-vonkt,
bisktLIKEfagl_011zc-biskt,
ENDOFgt_fagl_011zc.
DATA:
BEGINOFgt_fagl_011qtOCCURS0,
ergsl LIKEfagl_011qt-ergsl,
txt45LIKEfagl_011qt-txt45,
ENDOFgt_fagl_011qt.
DATA:
BEGINOFgt_mamt_isOCCURS0,
amtLIKEfaglflext-hslvt,
ENDOFgt_mamt_is.
RANGESgr_actFORfaglflext-racct.
DATA:
BEGINOFgt_monvOCCURS0,
month
(2)TYPEn,
valueLIKEfaglflext-hslvt,
ENDOFgt_monv.
DATA:
BEGINOFgs_hsl,
hsl01LIKEfaglflext-hslvt,
hsl02LIKEfaglflext-hslvt,
hsl03LIKEfaglflext-hslvt,
hsl04LIKEfaglflext-hslvt,
hsl05LIKEfaglflext-hslvt,
hsl06LIKEfaglflext-hslvt,
hsl07LIKEfaglflext-hslvt,
hsl08LIKEfaglflext-hslvt,
hsl09LIKEfaglflext-hslvt,
hsl10LIKEfaglflext-hslvt,
hsl11LIKEfaglflext-hslvt,
hsl12LIKEfaglflext-hslvt,
ENDOFgs_hsl.
DATA:
BEGINOFgs_hsl1,
hsl01LIKEfaglflext-hslvt,
hsl02LIKEfaglflext-hslvt,
hsl03LIKEfaglflext-hslvt,
hsl04LIKEfaglflext-hslvt,
hsl05LIKEfaglflext-hslvt,
hsl06LIKEfaglflext-hslvt,
hsl07LIKEfaglflext-hslvt,
hsl08LIKEfaglflext-hslvt,
hsl09LIKEfaglflext-hslvt,
hsl10LIKEfaglflext-hslvt,
hsl11LIKEfaglflext-hslvt,
hsl12LIKEfaglflext-hslvt,
hslvtLIKEfaglflext-hslvt,
ENDOFgs_hsl1.
DATA:
gs_alv_isTYPEREFTOcl_gui_alv_grid,”thealvobjectforisreport
gs_alv_bsTYPEREFTOcl_gui_alv_grid,”thealvobjectforbsreport
gs_alv_is_dp1TYPEREFTOcl_gui_alv_grid,”thealvobjectforbsreport
gs_alv_bs_dp1TYPEREFTOcl_gui_alv_grid,”thealvobjectforbsreport
gs_conTYPEREFTOcl_gui_custom_container,”thecontianerobject
gs_con1TYPEREFTOcl_gui_custom_container,”thecontianerobject
gs_layout TYPElvc_s_layo,”setthelayoutofthealv
gt_fieldcatTYPElvc_t_fcat,”thefieldcatelogtable
gs_fieldcatTYPElvc_s_fcat,”thefieldcatelogworkarea
g_toolbar TYPEui_functions,”thetoolbarofthealv
g_toolbar1 TYPEui_functions,”thetoolbarofthealv
gt_sort TYPElvc_t_sort,”controlthesortofthealv
gs_sort TYPElvc_s_sort.”theworkareaofthegt_sort
DATA:
gs_dyndoc_idTYPEREFTOcl_dd_document,
gs_dyndoc_id1TYPEREFTOcl_dd_document,
gs_splitterTYPEREFTOcl_gui_splitter_container,
gs_parent_htmlTYPEREFTOcl_gui_container,
gs_parent_gridTYPEREFTOcl_gui_container,
gs_splitter1TYPEREFTOcl_gui_splitter_container,
gs_parent_html1TYPEREFTOcl_gui_container,
gs_parent_grid1TYPEREFTOcl_gui_container,
gs_html_cntrlTYPEREFTOcl_gui_html_viewer.
*SCREENDEFINE
DATA ok_code.
*–>2012.01.17CCYUSTART
DATA:
BEGINOFgt_head1 OCCURS0,
t1(6),
t2(20),
t3(20),
t4(20),
t5(6),
t6(20),
t7(20),
t8(20),
ENDOFgt_head1.
DATA:
BEGINOFgt_head2 OCCURS0,
t1(6),
t2(20),
t3(20),
t4(20),
ENDOFgt_head2.
DATA:
BEGINOFgt_alv_bs01OCCURS0,
lct1TYPEint1,
item1TYPEzitem,
yamt1TYPEhslvt12,
ysamt1TYPEhslvt12,
lct2TYPEint1,
item2TYPEzitem,
yamt2TYPEhslvt12,
ysamt2TYPEhslvt12,
ENDOF gt_alv_bs01.
*<–2012.01.17CCYUEND.
SELECTION-SCREENBEGINOFBLOCKblkWITHFRAMETITLEtext-001.
“公司代码
SELECTION-SCREENBEGINOFLINE.
SELECTION-SCREENPOSITION1.
SELECTION-SCREENCOMMENT(79)text-002.
SELECTION-SCREENENDOFLINE.
“Currency
SELECTION-SCREENBEGINOFLINE.
SELECTION-SCREENPOSITION1. “从位置1开始输出
SELECTION-SCREENCOMMENT(7)text-003FORFIELDp_curr.
SELECTION-SCREENPOSITION15.
PARAMETERSp_currTYPEchASLISTBOX VISIBLELENGTH12 OBLIGATORYDEFAULT‘CNY’.
SELECTION-SCREENENDOFLINE.
“reportversion
SELECTION-SCREENBEGINOFLINE.
SELECTION-SCREENPOSITION1.
SELECTION-SCREENCOMMENT(9)text-004FORFIELDp_rpv.
SELECTION-SCREENPOSITION15.
PARAMETERSp_rpvTYPEcfASLISTBOXVISIBLELENGTH12USER-COMMANDdpOBLIGATORYDEFAULT‘2070′.
SELECTION-SCREENPOSITION28.
SELECTION-SCREENCOMMENT(60)gv_name.
SELECTION-SCREENENDOFLINE.
“profitcentergroup
SELECTION-SCREENBEGINOFLINE.
SELECTION-SCREENPOSITION1.
SELECTION-SCREENCOMMENT(12)text-005FORFIELDp_pcg.
SELECTION-SCREENPOSITION15.
PARAMETERSp_pcgTYPEcgcpASLISTBOXVISIBLELENGTH12USER-COMMANDdp1OBLIGATORY.
SELECTION-SCREENENDOFLINE.
“profitcenter
SELECTION-SCREENBEGINOFLINE.
SELECTION-SCREENPOSITION1.
SELECTION-SCREENCOMMENT(12)text-006FORFIELDp_pc.
SELECTION-SCREENPOSITION15.
PARAMETERSp_pcTYPEcgcpASLISTBOXVISIBLELENGTH12MODIFIDpc.
SELECTION-SCREENENDOFLINE.
“REPROT
SELECTION-SCREENBEGINOFLINE.
SELECTION-SCREENPOSITION1.
SELECTION-SCREENCOMMENT(12)text-007FORFIELDp_rp.
SELECTION-SCREENPOSITION15.
PARAMETERSp_rpTYPEcgcpASLISTBOXVISIBLELENGTH12USER-COMMANDrpOBLIGATORYDEFAULT‘BS’.
SELECTION-SCREENCOMMENT(12)gv_rp.
SELECTION-SCREENENDOFLINE.
“YEAR
SELECTION-SCREENBEGINOFLINE.
SELECTION-SCREENPOSITION1.
SELECTION-SCREENCOMMENT(12)text-008FORFIELDp_y.
SELECTION-SCREENPOSITION15.
PARAMETERSp_y(4)TYPEnOBLIGATORY.
SELECTION-SCREENENDOFLINE.
“MONTH
SELECTION-SCREENBEGINOFLINE.
SELECTION-SCREENPOSITION1.
SELECTION-SCREENCOMMENT(12)text-009FORFIELDp_m.
SELECTION-SCREENPOSITION15.
*PARAMETERSP_M
(2)TYPENOBLIGATORY.
*–>2012.01.11ccyuSTART
PARAMETERSp_m(3)TYPEnASLISTBOX VISIBLELENGTH4OBLIGATORY.
*<–2012.01.11ccyuEND.
SELECTION-SCREENENDOFLINE.
SELECTION-SCREENENDOFBLOCKblk.
*&———————————————————————*
*&———————————————————————*
*& ClassLCL_APP_COMPT
*&———————————————————————*
* theeventhandlerclassforalv
*———————————————————————-*
CLASSLCL_APP_COMPTDEFINITION.
PUBLICSECTION.
*thefunctionhandle_toolbarwhichhandlethetoolbareventofthealv
METHODS:
HANDLE_TOOLBARFOREVENTTOOLBAR
OFCL_GUI_ALV_GRID
IMPORTINGE_OBJECT
E_INTERACTIVE.
*thefunctionhandle_user_commandwhichhandletheuser_command
*eventofthealv
METHODS:
HANDLE_USER_COMMANDFOREVENTUSER_COMMAND
OFCL_GUI_ALV_GRID
IMPORTINGE_UCOMM.
*thefunctionhandle_topofpagewhichhandlethetopofpage
METHODS:
HANDLE_TOPOFPAGEFOREVENTTOP_OF_PAGE
OFCL_GUI_ALV_GRID
IMPORTINGE_DYNDOC_ID.
*handlethehotspot_click事件
METHODS:
HANDLE_HOTSPOT_CLICKFOREVENTHOTSPOT_CLICK
OFCL_GUI_ALV_GRID
IMPORTINGE_ROW_IDE_COLUMN_IDES_ROW_NO.
ENDCLASS. “LCL_AP