*&---------------------------------------------------------------------**&ReportZTEST13*&*&---------------------------------------------------------------------**&*&*&---------------------------------------------------------------------*REPORTztest13MESSAGE-IDzfirpt.报表名称*&---------------------------------------------------------------------**&tables&nodes*&---------------------------------------------------------------------*TABLES:t001,公司主数据bkpf,v_tcurr,faglflext.科目余额表*&---------------------------------------------------------------------**&internaltables*&---------------------------------------------------------------------*DATA:BEGINOFtb_resultOCCURS0,资产负债表结果集companyid(4)TYPEc,asset1(30)TYPEc,资产项目row1(2)TYPEc,行次start1LIKEfaglflext-hslvt,期初值end1LIKEfaglflext-hslvt,期未值asset2(30)TYPEc,资产项目row2(2)TYPEc,行次start2LIKEfaglflext-hslvt,期初值end2LIKEfaglflext-hslvt,期未值ENDOFtb_result.DATA:BEGINOFprt_resultOCCURS0,资产负债表结果集companyid(4)TYPEc,asset1(30)TYPEc,资产项目row1(2)TYPEc,行次start1(16)TYPEc,期初值end1(16)TYPEc,期未值asset2(30)TYPEc,资产项目row2(2)TYPEc,行次start2(16)TYPEc,期初值end2(16)TYPEc,期未值ENDOFprt_result.*&---------------------------------------------------------------------**&variantdeclare*&---------------------------------------------------------------------*DATA:s_butxt(50)TYPEc,公司名称s_m1(23)TYPEc,s_m2(23)TYPEc,s_m3(23)TYPEc,s_m4(23)TYPEc.**PARAMTERSFOROUTPUTFORMATDATA:i_lwidthTYPEiVALUE185,横线宽i_col1TYPEiVALUE35,列1宽i_col2TYPEiVALUE4,列2宽i_col3TYPEiVALUE20,列3宽i_col4TYPEiVALUE20.列4宽DATA:dynpreadLIKETABLEOFdynpreadWITHHEADERLINE.DATA:dcurrLIKETABLEOFbapi1093_0WITHHEADERLINE.TYPE-POOLS:slis.DATA:fieldcatTYPEslis_t_fieldcat_alvWITHHEADERLINE,fld_headTYPEslis_listheader,sortcatTYPEslis_t_sortinfo_alv,sortcatlnLIKELINEOFsortcat,itab_listheadTYPEslis_t_listheader,layoutTYPEslis_layout_alv,v_repidLIKEsy-repid,rt_extabTYPEslis_t_extab,eventcatTYPEslis_t_event.DATA:tmpdateLIKEsy-datum,prtdateLIKEsy-datum,tempcurrLIKEbapi1093_1-from_curr,exch_rate(10)TYPEc,txunit(10)TYPEc,errorflagTYPEc,txcurr(16)TYPEc.*&---------------------------------------------------------------------**&selection-screen*&---------------------------------------------------------------------*SELECT-OPTIONS:s_rbukrsFORbkpf-bukrsOBLIGATORY.公司代码PARAMETERS:i_gjahrLIKEbkpf-gjahrDEFAULTsy-datum+0(4)OBLIGATORY,财务年度i_monatLIKEbkpf-monatOBLIGATORY,期间*waerslikebkpf-waersOBLIGATORY.货币代码p_butxt(40)TYPEc.SELECTION-SCREENBEGINOFBLOCKb02WITHFRAMETITLEtit.选择屏幕PARAMETERS:单选按钮p_1RADIOBUTTONGROUPg1DEFAULT'X',p_2RADIOBUTTONGROUPg1,p_3RADIOBUTTONGROUPg1.SELECTION-SCREENENDOFBLOCKb02.选择屏幕结束SELECTION-SCREENBEGINOFBLOCKb01WITHFRAMETITLEtext-001.PARAMETERS:单选按钮m_1RADIOBUTTONGROUPg2DEFAULT'X',m_2RADIOBUTTONGROUPg2,waersLIKEbkpf-waers,货币代码p_flagASCHECKBOX.SELECTION-SCREENENDOFBLOCKb01.*&---------------------------------------------------------------------**&initialization*&---------------------------------------------------------------------*INITIALIZATION.tit='金额单位'.*&---------------------------------------------------------------------**&ATSELECTION-SCREENOUTPUT*&---------------------------------------------------------------------**ATSELECTION-SCREENOUTPUT.*performread_screen.*LOOPATSCREEN.*IFm_2='X'AND(screen-name='WAERS'orscreen-name='P_FLAG'*orscreen-name='%_WAERS_%_APP_%-TEXT').*screen-active=1.*ifscreen-name='WAERS'.*screen-request=1.*screen-required=1.*endif.*MODIFYSCREEN.*ENDIF.*IFm_2=''AND(screen-name='WAERS'orscreen-name='P_FLAG'*orscreen-name='%_WAERS_%_APP_%-TEXT').*screen-active=0.*ifscreen-name='WAERS'.*screen-request=0.*screen-required=0.*endif.*MODIFYSCREEN.*ENDIF.*ENDLOOP.*&---------------------------------------------------------------------**&atselection-screen*&---------------------------------------------------------------------*ATSELECTION-SCREEN.*PERFORMcheck.*SELECT*FROMt001WHEREbukrsINs_rbukrs.*errorflag=''.*AUTHORITY-CHECKOBJECT'ZFIRPT'权限判断*ID'BUKRS'FIELDt001-bukrs.*IFsy-subrc=0.*errorflag='f'.*ENDIF.*AUTHORITY-CHECKOBJECT'ZPARK'权限判断*ID'BUKRS'FIELDt001-bukrs.*IFsy-subrc=0.*errorflag='f'.*ENDIF.*IFerrorflag=''.*MESSAGEe999(z01)WITH'没有在公司代码't001-bukrs'操作的权限!'.*ENDIF.*ENDSELECT.IFi_monat1ORi_monat16.对期间值必须在1-16之间MESSAGEe004.ENDIF.*&---------------------------------------------------------------------**&start-of-selection*&---------------------------------------------------------------------*START-OF-SELECTION.CONCATENATEi_gjahri_monat'01'INTOtmpdate.组合年份CALLFUNCTION'LAST_DAY_OF_MONTHS'EXPORTINGday_in=tmpdate根据传入的参数,输出一个月的最后一天IMPORTINGlast_day_of_month=prtdateEXCEPTIONSday_in_no_date=1OTHERS=2.*获得当前汇率tempcurr=waers.CALLFUNCTION'BAPI_EXCHANGERATE_GETDETAIL'EXPORTINGrate_type='M'from_curr=tempcurrto_currncy='CNY'date=tmpdateIMPORTINGexch_rate=dcurr*RETURN=.READTABLEdcurrINDEX1.exch_rate=dcurr-exch_rate.IFp_1='X'.根据单选框的值给变量值txunit='元'.ENDIF.IFp_2='X'.txunit(*)='千元'.ENDIF.IFp_3='X'.txunit='万元'.ENDIF.*ifp_flag='X'andi_monat='12'.判断复选框*i_monat='16'.*endif.SELECTSINGLEktextINTOtxcurr根据货币单位的值返回货币名称FROMtcurtWHEREwaers=waers.IFm_1='X'.txcurr='人民币(汇总)'.ELSE.IFp_flag='X'.CONCATENAT