資源描述:
《demoexcl單頁導(dǎo)入模板程序和excel簡單示例demo》由會員上傳分享,免費(fèi)在線閱讀,更多相關(guān)內(nèi)容在工程資料-天天文庫。
1、模板導(dǎo)入的程序:REPORTZEXCELTEMPLATEUPLOAD.TABLES:ZHROFFICE?SELECTION-SCREENBEGINOFBLOCKBlWITHFRAMETITLETEXT-001.PARAMETERSSRTFDLIKEZHROFFICE-SRTFDOBLIGATORY.□關(guān)鍵字(報(bào)表事務(wù)代碼)PARAMETERSFILENAMELIKEZHROFFICE-FILENAMEOBLIGATORY.口文件名SELECTION-SCREENENDOFBLOCKBl.ATSELECTION-SCREENONVALUE-REQUESTFORSRTFD.PERF
2、ORMGETF4HELP1USINGSRTFD.ATSELECTION-SCREENONVALUE-REQUESTFORFILENAME.PERFORMGET_PC_FILENAMEUSINGFILENAMEO.START-OF-SELECTION.DATAF(128)OCCURS0WITHHEADERLINE.DATALCTYPEI.DATA:L_PGMNALIKEZHROFFICEFILEDESC,L_TTEXTLIKETSTCTTTEXT.SELECTA?PGMNAB-TTEXTFROMTSTCASALEFTJOINTSTCTASBONSPRSL='1'ANDB~TCOD
3、E=A~TCODEINTO(L_PGMNA,L_TTEXT)WHEREA~TCODE=SRTFD.ENDSELECT.IFSY-SUBRC<>0.MESSAGE'爭務(wù)彳弋碼不存在!*TYPE'S*DISPLAYLIKE'E'?STOP.ENDIF.SPLITFILENAMEAT11INTOTABLEF.DESCRIBETABLEFLINESLC.READTABLEFINDEXLC.ZHROFFICE-FILENAME=F.ZHROFFICE-FILEDESC=L_TTEXT.ZHROFFICE-AEDAT=SY-DATUM.ZHROFFICEUSERA=SYUNAME?DAT
4、A:DATA_CONTAINERLIKESOLIOCCURS0WITHHEADERLINE.DATA:LENGTHTYPEI.CLEARDATA_CONTA1:NER?REFRESHDATACONTAINER.CALLFUNCTION1WS_UPLOADfEXPORTINGFILENAMEFILENAMEFILETYPE'BIN'IMPORTINGFILELENGTHLENGTHTABLESDATATABDATACONTAINEREXCEPTIONSCONVERSION_ERROR=1FILE_OPEN_ERROR=2FILE_READ_ERROR=3INVALID_TABLE
5、_WIDTH=4INVALID_TYPE=5NO_BATCH=6UNKNOWN_ERROR=7OTHERS=8?IFSY-SUBRCNE0.CALLFUNCTION1POPUP_TO_DISPLAY_TEXT1EXPORTINGTITEL=?上載文件,TEXTLINE1='上載失敗!'EXCEPTIONSOTHERS=1.ELSE?MOVELENGTHTODATA_CONTAINER-LINE?APPENDDATA_CONTAINER.EXPORTDATA_CONTAINERTODATABASEZHROFFICE(CN)IDSRTFD.IFSY-SUBRCNE0.CALLFUN
6、CTION*POPUP_TO_DISPLAY_TEXT'EXPORTINGTITEL=,上載文件,TEXTLINE1=,更新數(shù)據(jù)庫失??!,EXCEPTIONSOTHERS=1.ELSE.MESSAGE1033(ZXO)WITH「文件.上傳成功!ENDIF.ENDIF.LEAVE?FORMget_pc_fi1ename★—*★—**——>PJNNAMEFORMGET_PC_F1LENAMEUSINGP_INNAMELIKERLGRAPFILENAMEMODE?DATA:L_VATFLIKERLGRAP-FILENAME.CALLFUNCTION1WS_FILENAME_GET1E
7、XPORTINGDEF_FILEN/kME=1'DEF_PATH=fC:1MASK=1z所有文件,*.*,Word文件,*.doc,Excel文件,*?xls.'MODE=MODETITLE=?請選擇模板文件,IMPORTINGFILENAME=L_VATF★RC=DUMMYEXCEPTIONSINV_WINSYS=1NO_BATCH=2SELECTION_CANCEL=3SELECTION_ERROR=4OTHERS=5?IFSY-SUBRCNE0.CALLFUNCTION1POPUP_