sap报表开发
展开全部
是要向一个位置下载文件吧,下面这一段内置了这个功能.函数WS_FILENAME_GET,
直接调用了WINDOWS本身的功能,让用户自己决定是否创建新文件夹或者选择文件夹.
WS_DOWNLOAD函数会根据指定自动创建文件和文件夹,如果不存在则创建.
DATA: BEGIN OF I_DOWNLOAD OCCURS 10, "下载用内表
STRING(1024) TYPE C, "下载字符串
END OF I_DOWNLOAD.
I_DOWNLOAD-STRING = 'helloword'.
APPEND I_DOWNLOAD.
CLEAR I_DOWNLOAD.
DATA p_file1 LIKE rlgrap-filename.
CALL FUNCTION 'WS_FILENAME_GET'
EXPORTING
mask = ',*.*,*.*.'
IMPORTING
filename = p_file1
EXCEPTIONS
OTHERS = 1.
CONCATENATE P_FILE1 '.TXT' INTO P_FILE1.
CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
FILENAME = p_file1
FILETYPE = 'DAT'
COL_SELECT = 'X'
COL_SELECTMASK = 'XXXXX'
* MODE = 'A'
TABLES
DATA_TAB = I_DOWNLOAD
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_WRITE_ERROR = 2
INVALID_FILESIZE = 3
INVALID_TYPE = 4
NO_BATCH = 5
UNKNOWN_ERROR = 6
INVALID_TABLE_WIDTH = 7
GUI_REFUSE_FILETRANSFER = 8
CUSTOMER_ERROR = 9.
REFRESH I_DOWNLOAD.
直接调用了WINDOWS本身的功能,让用户自己决定是否创建新文件夹或者选择文件夹.
WS_DOWNLOAD函数会根据指定自动创建文件和文件夹,如果不存在则创建.
DATA: BEGIN OF I_DOWNLOAD OCCURS 10, "下载用内表
STRING(1024) TYPE C, "下载字符串
END OF I_DOWNLOAD.
I_DOWNLOAD-STRING = 'helloword'.
APPEND I_DOWNLOAD.
CLEAR I_DOWNLOAD.
DATA p_file1 LIKE rlgrap-filename.
CALL FUNCTION 'WS_FILENAME_GET'
EXPORTING
mask = ',*.*,*.*.'
IMPORTING
filename = p_file1
EXCEPTIONS
OTHERS = 1.
CONCATENATE P_FILE1 '.TXT' INTO P_FILE1.
CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
FILENAME = p_file1
FILETYPE = 'DAT'
COL_SELECT = 'X'
COL_SELECTMASK = 'XXXXX'
* MODE = 'A'
TABLES
DATA_TAB = I_DOWNLOAD
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_WRITE_ERROR = 2
INVALID_FILESIZE = 3
INVALID_TYPE = 4
NO_BATCH = 5
UNKNOWN_ERROR = 6
INVALID_TABLE_WIDTH = 7
GUI_REFUSE_FILETRANSFER = 8
CUSTOMER_ERROR = 9.
REFRESH I_DOWNLOAD.
追问
谢谢!这段是添加在WS_DOWNLOAD函数之后麽?
form sub_putlog tables outtab using outfile.
call function 'WS_DOWNLOAD'
追答
我写的本来已经是成品了。
如果要加的话应该是加在之前。你可以用 SUB_PUTLOG方法写在WS_DOWNLOAD之前,
用方法来调用WS_DOWNLOAD。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询