1、模板导入的程序:REPORT ZEXCELTEMPLATEUPLOAD.TABLES: ZHROFFICE.SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.PARAMETERS SRTFD LIKE ZHROFFICE-SRTFD OBLIGATORY. "关键字(报表事务代码)PARAMETERS FILENAME LIKE ZHROFFICE-FILENAME OBLIGATORY. "文件名SELECTION-SCREEN END OF BLOCK B1.AT SEL
2、ECTION-SCREEN ON VALUE-REQUEST FOR SRTFD. PERFORM GETF4HELP1 USING SRTFD.AT SELECTION-SCREEN ON VALUE-REQUEST FOR FILENAME. PERFORM GET_PC_FILENAME USING FILENAME 'O'.START-OF-SELECTION. DATA F(128) OCCURS 0 WITH HEADER LINE. DATA LC TYPE I. DATA: L_PGMNA LIKE ZHROFFICE-
3、FILEDESC, L_TTEXT LIKE TSTCT-TTEXT. SELECT A~PGMNA B~TTEXT FROM TSTC AS A LEFT JOIN TSTCT AS B ON SPRSL = '1' AND B~TCODE = A~TCODE INTO (L_PGMNA,L_TTEXT) WHERE A~TCODE = SRTFD. ENDSELECT. IF SY-SUBRC <> 0. MESSAGE '事务代码不存在!' TYPE 'S' DISPLAY LIKE 'E'
4、. STOP. ENDIF. SPLIT FILENAME AT '' INTO TABLE F. DESCRIBE TABLE F LINES LC. READ TABLE F INDEX LC. ZHROFFICE-FILENAME = F. ZHROFFICE-FILEDESC = L_TTEXT. ZHROFFICE-AEDAT = SY-DATUM. ZHROFFICE-USERA = SY-UNAME. DATA: DATA_CONTAINER LIKE SOLI OCCURS 0 WITH HEADER
5、LINE. DATA: LENGTH TYPE I. CLEAR DATA_CONTAINER. REFRESH DATA_CONTAINER. CALL FUNCTION 'WS_UPLOAD' EXPORTING FILENAME = FILENAME FILETYPE = 'BIN' IMPORTING FILELENGTH = LENGTH TABLES DATA_TAB = DATA_CO