版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
在SAP中用承諾項(xiàng)目出現(xiàn)金流量表(報(bào)表開(kāi)發(fā)源代碼)可能使用到的外部數(shù)據(jù)或SAP數(shù)據(jù)表數(shù)據(jù)的格式、字段等:fkrs
財(cái)務(wù)管理范圍主記錄表fops
承諾項(xiàng)目主記錄表fmmp
現(xiàn)金預(yù)算管理行項(xiàng)目表lfa1
供應(yīng)商主記錄表kna1
客戶主記錄表bsis
總帳未清項(xiàng)表t001
公司代碼主記錄表usr21
用戶主記錄表adrp
用戶地址表bkpf
財(cái)務(wù)憑證抬頭表bseg
財(cái)務(wù)憑證行項(xiàng)目表glt0
總帳科目期間余額表
直接法通過(guò)分析憑證的承諾項(xiàng)目來(lái)取數(shù),SAP為該項(xiàng)功能定義了一個(gè)邏輯數(shù)據(jù)庫(kù)C1F.本程序開(kāi)始部分的邏輯數(shù)據(jù)庫(kù)取數(shù)部分是SAP的標(biāo)準(zhǔn)程序,其功能是將與現(xiàn)金流量相關(guān)的數(shù)據(jù)裝入內(nèi)部表G_T_FMMP,這部分程序禁止修改。
直接法:1、裝入金流量表定義參數(shù)(FORMfill_item_direct)該子程序?qū)⒌默F(xiàn)金流量表項(xiàng)和其對(duì)應(yīng)的承諾項(xiàng)目裝入內(nèi)部表INT_CASHFLOW.2、裝入與現(xiàn)金流量相關(guān)的數(shù)據(jù)這部分是邏輯數(shù)據(jù)庫(kù)裝入,屬于SAP標(biāo)準(zhǔn)程序,數(shù)據(jù)關(guān)系比較復(fù)雜,建議不要做任何改動(dòng)。3、計(jì)算現(xiàn)金流量計(jì)算的基本思路是對(duì)表G_T_FMMP進(jìn)行循環(huán),查找其中每條記錄的承諾項(xiàng)目屬于INT_CASHFLOW的表項(xiàng)后,把其金額累計(jì)到相應(yīng)表項(xiàng)。REPORTzcmrp001
NOSTANDARDPAGEHEADINGLINE-SIZE220.TABLES:fkrs,fpos,fmmp,lfa1,kna1,bsis,
t001,usr21,adrp,bkpf,bseg,glt0.DATA:BEGINOFg_t_fmmpOCCURS300,
fikrs
LIKEfmmp-fikrs,
bukrs
LIKEfmmp-bukrs,
fipos
LIKEfmmp-fipos,
wrttp
LIKEfmmp-wrttp,
gjahr
LIKEfmmp-gjahr,
perio
LIKEfmmp-perio,
zhldt
LIKEfmmp-zhldt,
budat
LIKEfmmp-budat,
gsber
LIKEfmmp-gsber,
vo_saknrLIKEfmmp-vo_saknr,
lifnr
LIKEfmmp-lifnr,
kunnr
LIKEfmmp-kunnr,
fwaer
LIKEfmmp-fwaer,
fkbtr
LIKEfmsu-btr001,
zbelnr
LIKEcooi-refbn,
zbuzei
LIKEcooi-rfpos,
vo_bukrsLIKEfmmp-vo_bukrs,
vo_gjahrLIKEfmmp-vo_gjahr,
fitxt
LIKEfkrs-fitxt,
fname
LIKEffnd-fname,
cname
LIKEfctr-cname,
pname
LIKEfpos-pname,
wtext
LIKEfmmp-wtext,
ENDOFg_t_fmmp.DATA:BEGINOFg_t_fkrsOCCURS20,
fikrsLIKEfkrs-fikrs,
fitxtLIKEfkrs-fitxt,
ENDOFg_t_fkrs.DATA:BEGINOFg_t_fposOCCURS200,
fiposLIKEfpos-fipos,
pnameLIKEfpos-pname,
ENDOFg_t_fpos.DATA:BEGINOFg_t_lfa1OCCURS200,
lifnrLIKElfa1-lifnr,
sortlLIKElfa1-sortl,
ENDOFg_t_lfa1.DATA:BEGINOFg_t_kna1OCCURS200,
kunnrLIKEkna1-kunnr,
sortlLIKEkna1-sortl,
ENDOFg_t_kna1.RANGES:r_kunnrFORkna1-kunnr,
r_lifnrFORlfa1-lifnr,
r_fiposFORfmmp-fipos.DATA:BEGINOFint_cashflowOCCURS100,
desc(66)
TYPEc,
r_fipos(66)
TYPEc,
com_fkbtr
LIKEfmmp-fkbtr,
fi_fkbtr
LIKEfmmp-fkbtr,
fi_fwaer
LIKEfmmp-fwaer,
ENDOFint_cashflow.DATA:BEGINOFg_t_t001OCCURS300,
bukrsLIKEt001-bukrs,
butxtLIKEt001-butxt,
ENDOFg_t_t001.DATA:
pos
TYPEiVALUE0,
num_of_bukrsTYPEiVALUE0.DATA
cashflow_detail.DATA:min_budat
LIKEfmmp-budat,
max_budat
LIKEfmmp-budat,
z_min_budat
LIKEsy-datum,
z_max_budat
LIKEsy-datum,
z_bukrs
LIKEfmmp-bukrs,
z_profit
LIKEbseg-dmbtr,
"凈利潤(rùn)
z_bad_debit
LIKEbseg-dmbtr,
"壞帳準(zhǔn)備及計(jì)提的資產(chǎn)減值準(zhǔn)備
z_asset_dep
LIKEbseg-dmbtr,
"固定資產(chǎn)折舊
z_intang_dep
LIKEbseg-dmbtr,
"無(wú)形資產(chǎn)攤銷(xiāo)
z_longpaid_depLIKEbseg-dmbtr,
"長(zhǎng)期待攤費(fèi)用攤銷(xiāo)
z_paid_dec
LIKEbseg-dmbtr,
"待攤費(fèi)用減少
z_accrul_inc
LIKEbseg-dmbtr,
"預(yù)提費(fèi)用增加
z_asset_pro
LIKEbseg-dmbtr,
"固定資產(chǎn),長(zhǎng)期資產(chǎn)處置損失
z_asset_scr
LIKEbseg-dmbtr,
"固定資產(chǎn)報(bào)廢損失
z_fi_expen
LIKEbseg-dmbtr,
"財(cái)務(wù)費(fèi)用
z_invest_loss
LIKEbseg-dmbtr,
"投資損失
z_defer_tax
LIKEbseg-dmbtr,
"遞延稅款貸項(xiàng)
z_stock
LIKEbseg-dmbtr,
"存貨減少
z_ar
LIKEbseg-dmbtr,
"經(jīng)營(yíng)性應(yīng)收減少
z_ap
LIKEbseg-dmbtr,
"經(jīng)營(yíng)性應(yīng)付增加
z_other
LIKEbseg-dmbtr,
"其他
z_production
LIKEbseg-dmbtr,
"經(jīng)營(yíng)活動(dòng)產(chǎn)生的現(xiàn)金凈額
z_loss
LIKEbseg-dmbtr,
"總公司下?lián)軓浹a(bǔ)虧損
z_asset_debit
LIKEbseg-dmbtr,
"以固定資產(chǎn)償還債務(wù)
z_invest_debitLIKEbseg-dmbtr,
"以投資償還債務(wù)
z_asset_investLIKEbseg-dmbtr,
"以固定資產(chǎn)投資
z_stock_debit
LIKEbseg-dmbtr,
"以存貨償還債務(wù)
z_asset_rentedLIKEbseg-dmbtr,
"融資租賃固定資產(chǎn)
z_donation
LIKEbseg-dmbtr,
"接受捐贈(zèng)非現(xiàn)金資產(chǎn)
z_debit_shortLIKEbseg-dmbtr,
"償還的經(jīng)營(yíng)性債務(wù)
z_debit_equit
LIKEbseg-dmbtr,
"債務(wù)轉(zhuǎn)為資本
z_bond_due
LIKEbseg-dmbtr,
"一年內(nèi)到期的可轉(zhuǎn)換公司債券
z_money_init
LIKEbseg-dmbtr,
"貨幣資金期初余額
z_money_end
LIKEbseg-dmbtr,
"貨幣資金期末余額
z_cashs_init
LIKEbseg-dmbtr,
"現(xiàn)金等價(jià)物期初余額
z_cashs_end
LIKEbseg-dmbtr,
"現(xiàn)金等價(jià)物期末余額
z_all_money
LIKEbseg-dmbtr.
"貨幣資金及現(xiàn)金等價(jià)物凈變動(dòng)DATA:BEGINOFitb0OCCURS0,
txt(70)TYPEc,
num
LIKEbseg-dmbtr,
ENDOFitb0,
mtxt(70)TYPEc.**INITIALIZATION.PERFORMfill_item_direct.*START-OF-SELECTION.GETfkrs.g_t_fkrs-fikrs=fkrs-fikrs.g_t_fkrs-fitxt=fkrs-fitxt.APPENDg_t_fkrs.GETfpos.g_t_fpos-fipos=fpos-fipos.g_t_fpos-pname=fpos-pname.COLLECTg_t_fpos.GETfmmp.MOVE-CORRESPONDINGfmmpTOg_t_fmmp.CASEfmmp-wrttp.
WHEN'50'OR'51'.
"purchaseorder
g_t_fmmp-zbelnr=fmmp-ebeln.
g_t_fmmp-zbuzei=fmmp-ebelp.
WHEN'64'.
"paymenttransfer
g_t_fmmp-zbelnr=fmmp-kblnr.
g_t_fmmp-zbuzei=fmmp-kblpos.
WHEN'65'.
"fundscommitments
g_t_fmmp-zbelnr=fmmp-kblnr.
g_t_fmmp-zbuzei=fmmp-kblpos.WHENOTHERS.
"Fidocuments
g_t_fmmp-zbelnr=fmmp-vo_belnr.
g_t_fmmp-zbuzei=fmmp-vo_buzei.ENDCASE.APPENDg_t_fmmp.IFNOTfmmp-kunnrISINITIAL.
r_kunnr-sign='I'.
r_kunnr-option='EQ'.
r_kunnr-low
=fmmp-kunnr.COLLECTr_kunnr.ENDIF.IFNOTfmmp-lifnrISINITIAL.r_lifnr-sign
='I'.
r_lifnr-option='EQ'.
r_lifnr-low=fmmp-lifnr.
COLLECTr_lifnr.ENDIF.END-OF-SELECTION.SORTg_t_fmmpBYfikrs
bukrs
fipos
wrttp
gjahrperio
zhldt
zbelnr
zbuzeibukrs
vo_saknr.RANGES:lr_lifnrFORlfa1-lifnr,
lr_kunnrFORkna1-kunnr.DATA:l_cnt_from
LIKEsy-tabixVALUE1,
l_cnt_to
LIKEsy-tabixVALUE50,
l_cnt_linesLIKEsy-tabix.*"/LesenKreditoren-TexteausStammdaten-TabelleIFNOTr_lifnrISINITIAL.LOOPATr_lifnrWHERElow='*'.
DELETEr_lifnr.
ENDLOOP.DESCRIBETABLEr_lifnrLINESl_cnt_lines.
"<-insert
IFl_cnt_lines<=50.
"<-insert*
"/Lieferanten-Kurztexteaufeinmaleinlesen
"<-insertSELECTlifnrsortlFROMlfa1
INTOCORRESPONDINGFIELDSOFTABLEg_t_lfa1
WHERElifnrINr_lifnr.
ELSE.
"<-insert*
"/Lieferanten-KurztexteinBloeckeneinlesen
"<-insert
DO.
"<-insert*
"/Bloeckezuje50Leferantenbilden
"<-insert
REFRESHlr_lifnr.
"<-insert
LOOPATr_lifnrFROMl_cnt_fromTOl_cnt_to.
"<-insert
lr_lifnr=r_lifnr.
"<-insert
APPENDlr_lifnr.
"<-insert
ENDLOOP.
"<-insert
IFsy-subrcNE0.
"<-insert
EXIT.
"<-insert
ENDIF.
"<-insert
l_cnt_from=l_cnt_to
+1.
"<-insert
l_cnt_to
=l_cnt_from+50.
"<-insert*
"/Lieferanten-Kurztextelesen
"<-insert
SELECTlifnrsortlFROMlfa1
"<-insert
APPENDINGCORRESPONDINGFIELDS
"<-insert
OFTABLEg_t_lfa1
"<-insert
WHERElifnrINlr_lifnr.
"<-insert
ENDDO.
"<-insert
ENDIF.
"<-insertENDIF.*"/LesenDebitoren-TexteausStammdaten-TabelleIFNOTr_kunnrISINITIAL.
LOOPATr_kunnrWHERElow='*'.
DELETEr_kunnr.
ENDLOOP.
DESCRIBETABLEr_kunnrLINESl_cnt_lines.
"<-insert
IFl_cnt_lines<=50.
"<-insert*
"/Kunden-Kurztexteaufeinmaleinlesen
"<-insert
SELECTkunnrsortlFROMkna1
INTOCORRESPONDINGFIELDSOFTABLEg_t_kna1
WHEREkunnrINr_kunnr.
ELSE.
"<-insert*
"/Kunden-KurztexteinBloeckeneinlesen
"<-insert
DO.
"<-insert*
"/Bloeckezuje50Kundenbilden
"<-insert
REFRESHlr_kunnr.
"<-insert
LOOPATr_kunnrFROMl_cnt_fromTOl_cnt_to.
"<-insert
lr_kunnr=r_kunnr.
"<-insert
APPENDlr_kunnr.
"<-insert
ENDLOOP.
"<-insert
IFsy-subrcNE0.
"<-insert
EXIT.
"<-insert
ENDIF.
"<-insert
l_cnt_from=l_cnt_to
+1.
"<-insert
l_cnt_to
=l_cnt_from+50.
"<-insert*
"/Kunden-Kurztextelesen
"<-insert
SELECTkunnrsortlFROMkna1
"<-insert
APPENDINGCORRESPONDINGFIELDS
"<-insert
OFTABLEg_t_kna1
"<-insert
WHEREkunnrINlr_kunnr.
"<-insert
ENDDO.
"<-insert
ENDIF.
"<-insertENDIF.SELECTbukrsbutxtFROMt001
INTOCORRESPONDINGFIELDSOFTABLEg_t_t001.DATA:l_sav_wrttp_text(30),
l_sav_fwaerLIKEfmmp-fwaer,
l_sav_butxtLIKEt001-butxt,
l_sav_hide_row_type(4).num_of_bukrs=0.max_budat=0.min_budat='99991231'.LOOPATg_t_fmmp.
IFmin_budat>g_t_fmmp-budat.
min_budat=g_t_fmmp-budat.
ENDIF.
IFmax_budat<g_t_fmmp-budat.
max_budat=g_t_fmmp-budat.
ENDIF.
l_sav_fwaer=g_t_fmmp-fwaer.
ATNEWfikrs.
LOOPATint_cashflow.
CLEARint_cashflow-fi_fkbtr.
MODIFYTABLEint_cashflow.
CLEARint_cashflow.
ENDLOOP.
ENDAT.
ATNEWbukrs.PERFORMread_bukrs_textUSINGg_t_fmmp-bukrs
CHANGINGg_t_t001-butxt.
l_sav_butxt=g_t_t001-butxt.
LOOPATint_cashflow.
CLEARint_cashflow-com_fkbtr.
MODIFYTABLEint_cashflow.
CLEARint_cashflow.
ENDLOOP.
ENDAT.
LOOPATint_cashflow.
PERFORMinput_rangeUSINGint_cashflow-r_fipos.
LOOPATr_fipos.
IFr_fipos-option='EQ'.
IFr_fipos-low=g_t__cashflow-fi_fkbtr
=int_cashflow-fi_fkbtr
+g_t_fmmp-fkbtr.
int_cashflow-com_fkbtr=int_cashflow-com_fkbtr
+g_t_fmmp-fkbtr.
ENDIF.
ENDIF.
IFr_fipos-option='BT'.
IFg_t_fmmp-fipos>=r_fipos-lowAND
g_t_fmmp-fipos<=r__cashflow-fi_fkbtr
=int_cashflow-fi_fkbtr
+g_t_fmmp-fkbtr.
int_cashflow-com_fkbtr=int_cashflow-com_fkbtr
+g_t_fmmp-fkbtr.
ENDIF.
ENDIF.
ENDLOOP.MODIFYTABLEint_cashflow.
CLEARint_cashflow.
CLEARr_fipos.
REFRESHr_fipos.
ENDLOOP.
ATENDOFbukrs.PERFORMcal_indirectUSINGg_t_fmmp-bukrs.
PERFORMoutput_infoUSING'COM'.
num_of_bukrs=num_of_bukrs+1.
ENDAT.
ATENDOFfikrs.
IFnum_of_bukrsNE1.
CLEARl_sav_butxt.PERFORMoutput_infoUSING'FI'.
ENDIF.
WRITE:/text-103.
ENDAT.ENDLOOP.TOP-OF.IFNOT(s_budat-lowISINITIAL).
min_budat=s_budat-low.ENDIF.IFNOT(s_budat-highISINITIAL).max_budat=s_budat-high.ENDIF.SKIP2.WRITE:/100'現(xiàn)
金流
量
表'.WRITE:/.WRITE:/210'會(huì)年企03表'.*
IFmin_budat(6)=max_budat(6).*
WRITE:/104min_budat(4),'年',min_budat+4(2),'月',*
202'報(bào)表編號(hào):會(huì)商03表'.*
ELSE.*
WRITE:/097'日期:',*
103min_budat,113'-',115max_budat,*
202'報(bào)表編號(hào):會(huì)商03表'.*
ENDIF.*WRITE:/012'編制單位:',l_sav_butxt,
100
max_budat(4),'年',max_budat+4(2),'月',
max_budat+6(2),'日',
212'單位:元'.WRITE:
/011sy-uline.WRITE:/011sy-vline,
040'
項(xiàng)
目',
085sy-vline,
087'行次',
093sy-vline,
095'
金
額
',116sy-vline,
148'補(bǔ)充資料',
190sy-vline,
192'行次',
198sy-vline,
'
金
額',
220sy-vline.WRITE:/011sy-uline.************************************************************************ATLINE-SELECTION.CHECKl_sav_hide_row_type='EPOS'.CALLFUNCTION'FM_DOCUMENT_DISPLAY'
EXPORTINGi_wrttp=g_t_fmmp-wrttp
i_belnr=g_t_fmmp-zbelnri_blpos=g_t_fmmp-zbuzei
i_bukrs=g_t_fmmp-vo_bukrs
i_gjahr=g_t_fmmp-vo_gjahr.************************************************************************ATUSER-COMMAND.CASEsy-ucomm.
WHEN'SELE'.
SETPF-STATUS'SELE'.
CALLFUNCTION'FM_SELECTION_CRITERIA_PRINT'
EXPORTING
i_report_name='RFFMIEP5'
EXCEPTIONS
OTHERS
=1.ENDCASE.*&**&
Form
READ_FIKRS_TEXT*&*FORMread_fikrs_textUSINGu_fikrs
CHANGINGc_fitxt.g_t_fkrs=space.g_t_fkrs-fikrs=u_fikrs.READTABLEg_t_fkrs.IFsy-subrc=0.
c_fitxt=g_t_fkrs-fitxt.ENDIF.ENDFORM.
"READ_FIKRS_TEXT*&**&
Form
READ_FIPOS_TEXT*&*FORMread_fipos_textUSINGu_fipos
CHANGINGc_pname.g_t_fpos=space.g_t_fpos-fipos=u_fipos.READTABLEg_t_fpos.IFsy-subrc=0.
c_pname=g_t_fpos-pname.ENDIF.ENDFORM.
"READ_FIPOS_TEXT*&**&
Form
READ_BUKRS_TEXT*&*FORMread_bukrs_textUSINGu_bukrs
CHANGINGc_butxt.g_t_t001=space.g_t_t001-bukrs=u_bukrs.READTABLEg_t_t001.IFsy-subrc=0.
c_butxt=g_t_t001-butxt.ENDIF.ENDFORM.
"READ_FIPOS_TEXT*&**&
Form
GET_KUNNR_LIFNR_TEXT*&*FORMget_kunnr_lifnr_textUSINGvalue(u_kunnr)
value(u_lifnr)
CHANGINGc_text.CLEARc_text.IFNOTu_kunnrISINITIAL.
IFu_kunnr='*'.
c_text='*'.
ELSE.*
"/LesenDebitor-TextausinternerTabelle
g_t_kna1=space.
g_t_kna1-kunnr=u_kunnr.
READTABLEg_t_kna1.
IFsy-subrc=0.
c_text=g_t_kna1-sortl.
ENDIF.
ENDIF.ENDIF.IFNOTu_lifnrISINITIAL.IFu_lifnr='*'.
c_text='*'.
ELSE.*
"/LesenKreditor-TextausinternerTabelle
g_t_lfa1=space.g_t_lfa1-lifnr=u_lifnr.
READTABLEg_t_lfa1.
IFsy-subrc=0.
c_text=g_t_lfa1-sortl.
ENDIF.
ENDIF.ENDIF.ENDFORM.
"GET_KUNNR_LIFNR_TEXT***********************************************************FORMinput_rangeUSINGvalue(rfipos).DATA:offTYPEi,offsetTYPEi,doingTYPEi.DATA:item(20),str(10).off=0.offset=0.
doing=1.WHILEdoing<>0.
SHIFTrfiposBYoffsetPLACES.SEARCHrfiposFOR','.
IFsy-subrc=0.
offset=sy-fdpos.
MOVErfipos(offset)TOitem.
offset=offset+1.
ELSE.
MOVErfiposTOitem.
doing=0.
ENDIF.
SEARCHitemFOR'-'.
IFsy-subrc=0.
off=sy-fdpos.
MOVEitem(off)TOstr.
off=off+1.
r_fipos-sign
='I'.
r_fipos-option='BT'.
r_fipos-low
=
str.
SHIFTitemBYoffPLACES.
MOVEitemTOstr.
r_fipos-high
=
str.
ELSE.
MOVEitemTOstr.
r_fipos-sign='I'.
r_fipos-option='EQ'.
r_fipos-low
=
str.ENDIF.
APPENDr_fipos.ENDWHILE.ENDFORM.*******FORMoutput_infoUSINGfi_value.DATAzcashflowLIKEfmmp-fkbtr.DATA:iLIKEsy-tabix,
jLIKEsy-tabix,
kLIKEsy-tabix,
lLIKEsy-tabix.i=0.
j=0.k=32.LOOPATint_cashflowFROM1TO32.
IFfi_value='COM'.zcashflow=int_cashflow-com_fkbtr.
ELSEIFfi_value='FI'.zcashflow=int_cashflow-fi_fkbtr.
ENDIF.
i=i+1.
j=j+1.k=k+1.
WRITE:/011sy-vline,014int_cashflow-desc,
085sy-vline,088(2)i,093sy-vline.
IFzcashflow<>0.
WRITE:099zcashflowCURRENCYg_t_fmmp-fwaer.
ENDIF.
IFi<3.
l=i+32.
READTABLEint_cashflowINDEXl.
IFfi_value='COM'.
zcashflow=int_cashflow-com_fkbtr.ELSEIFfi_value='FI'.
zcashflow=int_cashflow-fi_fkbtr.ENDIF.
WRITE:116sy-vline,118(60)int_cashflow-desc,
190sy-vline,193(2)k,198sy-vline.
IFzcashflow<>0.
WRITE:204zcashflowCURRENCYg_t_fmmp-fwaer.
ENDIF.ELSE.
l=i-2.
READTABLEitb0INDEXl.
IFsy-subrc<>0.CLEARitb0.ENDIF.
WRITE:116sy-vline,118(60)itb0-txt,
190sy-vline,193(2)k,198sy-vline.IFitb0-num<>0.
WRITE:204itb0-numCURRENCYg_t_fmmp-fwaer.
ENDIF.
ENDIF.
WRITE:220sy-vline.
WRITE:/011sy-uline.
IFj>=25.
j
=0.
PERFORMout_footer.
NEW.
ENDIF.ENDLOOP.PERFORMout_footer.ENDFORM.***
FORMout_footer
****
***FORMout_footer.DATA:usrname(80)TYPEc.SELECTSINGLE*FROMusr21WHEREbname=sy-uname.SELECTSINGLE*FROMadrp
WHEREpersnumber=usr21-persnumberAND
date_from<=sy-datum
AND
date_to
>=sy-datum.CONCATENATEadrp-name_lastadrp-name_firstINTOusrname.CONDENSEusrnameNO-GAPS.WRITE:/012'制表人員:',(12)usrname,
110'打印日期:',sy-datum,
202'打印時(shí)間:',sy-uzeit.ENDFORM.******************************************************************************************計(jì)算科目段在指定日期的起始余額************************************************************************************************
**********參數(shù):mdate1
開(kāi)始日期(含此天)
**********
mdate2
結(jié)束日期(不含此天)
**********
mstrin科目編號(hào)的匹配模式字符串
**********結(jié)果:znum
**********算法:某日余額=年初余額+一月余額+...+
**********
上月余額+本月到mdate2余額
**********
****************************************************************************FORMcal_dates_amountUSINGmdate1mdate2mstringCHANGINGznum.DATA:BEGINOFiglt0OCCURS0.
INCLUDESTRUCTUREglt0.DATA:ENDOFiglt0.DATA:BEGINOFitmpOCCURS0,
num
LIKE
bseg-dmbtr,
ENDOFitmp.DATA:i
LIKEsy-tabix.SELECT*FROMglt0INTOTABLEiglt0
WHEREbukrs
=z_bukrs
AND
ryear
=mdate1(4)
ANDracctLIKEmstring.LOOPATiglt0.
REFRESHitmp.itmp-num=iglt0-hslvt.
APPENDitmp.
itmp-num=iglt0-hsl01.
APPENDitmp.
itmp-num=iglt0-hsl02.
APPENDitmp.
itmp-num=iglt0-hsl03.
APPENDitmp.
itmp-num=iglt0-hsl04.
APPENDitmp.itmp-num=iglt0-hsl05.
APPENDitmp.
itmp-num=iglt0-hsl06.
APPENDitmp.
itmp-num=iglt0-hsl07.
APPENDitmp.
itmp-num=iglt0-hsl08.
APPENDitmp.
itmp-num=iglt0-hsl09.
APPENDitmp.itmp-num=iglt0-hsl10.
APPENDitmp.
itmp-num=iglt0-hsl11.
APPENDitmp.
LOOPATitmpFROM1TOmdate1+4(2).
znum=znum+itmp-num.
ENDLOOP.ENDLOOP.SELECT*FROMbkpfWHEREbukrs=z_bukrs
AND
budat>=mdate1
AND
budat<mdate2.
SELECT*FROMbsisWHEREgjahr=bkpf-gjahrAND
belnr=bkpf-belnrAND
hkontLIKEmstring.
IFbsis-shkzg='S'.
znum=znum+bsis-dmbtr.
ELSE.
znum=znum-bsis-dmbtr.
ENDIF.
ENDSELECT.ENDSELECT.ENDFORM.DEFINEcal_data.types:beginofdatatype,
dnum
likebseg-dmbtr,
"借方金額
cnum
likebseg-dmbtr,
"貸方金額
endofdatatype.data:masset
typedatatype,
"固定資產(chǎn)數(shù)據(jù)
minvesttypedatatype,
"投資數(shù)據(jù)
mlib
typedatatype,
"短期負(fù)債數(shù)據(jù)
mstock
typedatatype,
"庫(kù)存數(shù)據(jù)
mllib
typedatatype,
"長(zhǎng)期負(fù)債數(shù)據(jù)
mequit
typedatatype.
"權(quán)益數(shù)據(jù)loopattab2.
casetab2-hkont(4).
when'1501'or'1701'.
"固定資產(chǎn)和無(wú)形資產(chǎn)
iftab2-shkzg='S'.
addtab2-dmbtrtomasset-dnum.
else.addtab2-dmbtrtomasset-cnum.
endif.
when'1101'or'1401'or'1402'.
"短期投資與長(zhǎng)期投資
iftab2-shkzg='S'.
addtab2-dmbtrtominvest-dnum.
else.
addtab2-dmbtrtominvest-cnum.
endif.
when'1221'or'1231'or'1243'.
"庫(kù)存科目
iftab2-shkzg='S'.
addtab2-dmbtrtomstock-dnum.
else.
addtab2-dmbtrtomstock-cnum.
endif.
when'2111'or'2121'or'2181'.
"經(jīng)營(yíng)性負(fù)債
iftab2-shkzg='S'.
addtab2-dmbtrtomlib-dnum.
else.
addtab2-dmbtrtomlib-cnum.
endif.
when'2321'.
"長(zhǎng)期負(fù)債
iftab2-shkzg='S'.addtab2-dmbtrtomllib-dnum.
else.
addtab2-dmbtrtomllib-cnum.
endif.
when'3105'or'3111'.
"所有者權(quán)益
iftab2-shkzg='S'.
addtab2-dmbtrtomequit-dnum.
else.
addtab2-dmbtrtomequit-cnum.
endif.
endcase.endloop.ifmasset-dnum>0.
"固定資產(chǎn)增加
ifmllib-cnum>0.
"融資租賃固定資產(chǎn)
ifmasset-dnum<mllib-cnum.
z_asset_rented=z_asset_rented+masset-dnum.
mllib-cnum
=mllib-cnum
-masset-dnum.masset-dnum
=0.
else.
z_asset_rented=z_asset_rented+mllib-cnum.
masset-dnum
=masset-dnum
-mllib-cnum.mllib-cnum
=0.
endif.
endif.endif.ifmasset-cnum>0.
"固定資產(chǎn)減少
ifmlib-dnum>0.
"固定資產(chǎn)償還債務(wù)(經(jīng)營(yíng)性)
ifmasset-cnum>mlib-dnum.
z_asset_debit=z_asset_debit+mlib-dnum.
z_debit_short=z_debit_short+mlib-dnum.
masset-cnum
=masset-cnum
-mlib-dnum.mlib-dnum
=0.
else.
z_asset_debit=z_asset_debit+masset-cnum.
z_debit_short=z_debit_short+masset-cnum.mlib-dnum
=mlib-dnum
-masset-cnum.
masset-cnum
=0.
endif.
endif.
ifmllib-dnum>0.
"固定資產(chǎn)償還債務(wù)(長(zhǎng)期)
ifmasset-cnum>mllib-dnum.
z_asset_debit=z_asset_debit+mllib-dnum.
masset-cnum
=masset-cnum
-mllib-dnum.
mllib-dnum
=0.
else.z_asset_debit=z_asset_debit+masset-cnum.
mllib-dnum
=mllib-dnum
-masset-cnum.
masset-cnum
=0.
endif.endif.
ifminvest-dnum>0.
"以固定資產(chǎn)投資
ifmasset-cnum>minvest-dnum.
z_asset_invest=z_asset_invest+minvest-dnum.
masset-cnum
=masset-cnum
-minvest-dnum.
minvest-dnum
=0.
else.
z_asset_invest=z_asset_invest+masset-cnum.
minvest-dnum
=minvest-dnum
-masset-cnum.
masset-cnum
=0.
endif.
endif.endif.ifminvest-dnum>0.
"投資增加
ifmasset-cnum>0.
"以固定資產(chǎn)投資
ifmasset-cnum>minvest-dnum.
z_asset_invest=z_asset_invest+minvest-dnum.
masset-cnum
=masset-cnum
-minvest-dnum.
minvest
=0.
else.z_asset_invest=z_asset_invest+masset-cnum.
minvest-dnum
=minvest-dnum
-masset-cnum.
masset-cnum
=0.
endif.
endif.endif.ifminvest-cnum>0.
"投資減少
ifmlib-dnum>0.
"以投資償還債務(wù)(經(jīng)營(yíng)性)
ifmlib-dnum>minvest-cnum.
z_invest_debit=z_invest_debit+minvest-cnum.
z_debit_short
=z_debit_short
+minvest-cnum.
mlib-dnum
=mlib-dnum
-minvest-cnum.
minvest-cnum
=0.else.
z_invest_debit=z_invest_debit+mlib-dnum.z_debit_short
=z_debit_short
+mlib-dnum.
minvest-cnum
=minvest-cnum
-mlib-dnum.
mlib-dnum
=0.
endif.endif.
ifmllib-dnum>0.
"以投資償還債務(wù)(長(zhǎng)期)
ifmllib-dnum>minvest-cnum.
z_invest_debit=z_invest_debit+minvest-cnum.
mllib-dnum
=mllib-dnum
-minvest-cnum.
minvest-cnum
=0.
else.
z_invest_debit=z_invest_debit+mllib-dnum.
minvest-cnum
=minvest-cnum
-mllib-dnum.mllib-dnum
=0.
endif.
endif.endif.ifmstock-cnum>0.
"存貨減少
ifmlib-dnum>0.
"以存貨償還債務(wù)(經(jīng)營(yíng)性)
ifmlib-dnum>mstock-cnum.
z_stock_debit=z_stock_debit+mstock-cnum.
z_debit_short=z_debit_short+mstock-cnum.
mlib-dnum
=mlib-dnum
-mstock-cnum.mstock-cnum
=0.
else.
z_stock_debit=z_stock_debit+mlib-dnum.
z_debit_short=z_debit_short+mlib-dnum.mstock-cnum
=mstock-cnum
-mlib-dnum.
mlib-dnum
=0.
endif.
endif.
ifmllib-dnum>0.
"以存貨償還債務(wù)(長(zhǎng)期)
ifmllib-dnum>mstock-cnum.
z_stock_debit=z_stock_debit+mstock-cnum.
mllib-dnum
=mllib-dnum
-mstock-cnum.
mstock-cnum
=0.
else.z_stock_debit=z_stock_debit+mllib-dnum.
mstock-cnum
=mstock-cnum
-mllib-dnum.
mllib-dnum
=0.
endif.endif.endif.ifmequit-cnum>0.
"資本增加
ifmlib-dnum>0.
ifmlib-dnum>mequit-cnum.z_debit_equit=z_debit_equit+mequit-cnum.
z_debit_short=z_debit_short+mequit-cnum.
mlib-dnum
=mlib-dnum
-mequit-cnum.
mequit-cnum
=0.
else.z_debit_equit=z_debit_equit+mlib-dnum.
z_debit_short=z_debit_short+mlib-dnum.
mequit-cnum
=mequit-cnum
-mlib-dnum.
mlib-dnum
=0.
endif.
endif.
ifmllib-dnum>0.
ifmllib-dnum>mequit-cnum.z_debit_equit=z_debit_equit+mequit-cnum.
mllib-dnum
=mllib-dnum
-mequit-cnum.
mequit-cnum
=0.
else.
z_debit_equit=z_debit_equit+mllib-dnum.
mequit-cnum
=mequit-cnum
-mllib-dnum.
mlib-dnum
=0.
endif.endif.endif.END-OF-DEFINITION.***
FORMcal_indirect
****
****
-->pbukrs
***FORMcal_indirectUSINGpbukrsLIKEfmmp-bukrs.DATA:BEGINOFtab1OCCURS0,
gjahr
LIKEbkpf-gjahr,
belnr
LIKEbkpf-belnr,
ENDOFtab1,
BEGINOFtab2OCCURS0,
gjahr
LIKEbseg-gjahr,
belnr
LIKEbseg-belnr,hkont
LIKEbseg-hkont,
shkzg
LIKEbseg-shkzg,
dmbtrLIKEbseg-dmbtr,
ENDOFtab2,
BEGINOFtab3OCCURS0,
gjahr
LIKEbseg-gjahr,
belnr
LIKEbseg-belnr,
hkont
LIKEbseg-hkont,
shkzg
LIKEbseg-shkzg,dmbtr
LIKEbseg-dmbtr,
ENDOFtab3.IFNOT(s_budat-lowISINITIAL).
z_min_budat=s_budat-low.ELSE.z_min_budat=min_budat.ENDIF.IFNOT(s_budat-highISINITIAL).
z_max_budat=s_budat-high.ELSE.
z_max_budat=max_budat.ENDIF.z_bukrs=pbukrs.SELECTgjahrbelnrFROMbkpf
INTO
CORRESPONDINGFIELDSOFTABLEtab1
WHEREbukrs
=z_bukrs
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 內(nèi)燃機(jī)采購(gòu)合同格式
- 水電購(gòu)銷(xiāo)合同簽訂法律要求解釋
- 標(biāo)準(zhǔn)技術(shù)外包服務(wù)合同
- 法律行動(dòng)通報(bào)書(shū)
- 小區(qū)房屋買(mǎi)賣(mài)合同實(shí)例
- 招標(biāo)白蟻防治工程專業(yè)工程
- 購(gòu)銷(xiāo)合同增進(jìn)友誼
- 2024年水電施工改造協(xié)議3篇
- 一位父親在女兒婚禮上的精彩致辭范文(6篇)
- 居家養(yǎng)老陪護(hù)服務(wù)合同
- 邏輯思維訓(xùn)練第三章命題
- 加油站設(shè)備及工藝管線安裝工程施工方案
- 升維:不確定時(shí)代的決策博弈
- 2023北京通州區(qū)初二上期末考生物試卷及答案
- 漁光互補(bǔ)光伏發(fā)電項(xiàng)目選址方案
- 《西式面點(diǎn)實(shí)訓(xùn)》課程標(biāo)準(zhǔn)
- 《旅游職業(yè)禮儀與交往》課程標(biāo)準(zhǔn)
- 咖啡學(xué)概論智慧樹(shù)知到答案章節(jié)測(cè)試2023年華南理工大學(xué)
- 造價(jià)咨詢公司組織機(jī)構(gòu)及人員崗位職責(zé)
- 《牛頓運(yùn)動(dòng)定律的應(yīng)用》說(shuō)課課件
- 仁愛(ài)英語(yǔ)九年級(jí)上作文范文
評(píng)論
0/150
提交評(píng)論