`
evangxli
  • 浏览: 231507 次
  • 性别: Icon_minigender_1
  • 来自: 大连
社区版块
存档分类
最新评论

SAP Function module - GUI_DOWNLOAD

阅读更多
用这个function module 可以下载文件到本地,实现数据的local处理。
1。 首先,提两个相关的function module,涉及到参数CODEPAGE,影响文件的输出格式。
function module SCP_CODEPAGE_BY_EXTERNAL_NAME,可以转换输出文件格式,例,输入'UTF-8',返回4110,输入'GBK',返回8400。
function module NLS_GET_FRONTEND_CP,输入语言,返回参数CODEPAGE的四位数字值,例:输入'ZH',返回1160这个四位阿拉伯数字。
平时我们所用的,只要输入这四个参数就可以使用了。
DATA : C_FULLPATH TYPE STRING.

例如,
CALL FUNCTION 'GUI_DOWNLOAD'
  EXPORTING
    BIN_FILESIZE = 255
    FILENAME     = C_FULLPATH
    FILETYPE     = 'BIN'
    APPEND       = ''
  IMPORTING
    FILELENGTH   = ''
  TABLES
    DATA_TAB     = ''.
 



CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
        BIN_FILESIZE              = 255
        FILENAME                  = C_FULLPATH
        FILETYPE                  = 'DAT'
        APPEND                    = ' '
        WRITE_FIELD_SEPARATOR     = 'X'
        HEADER                    = '00'
        TRUNC_TRAILING_BLANKS     = ' '
        WRITE_LF                  = 'X'
        COL_SELECT                = ' '
        COL_SELECT_MASK           = ' '
        DAT_MODE                  = ' '
        CONFIRM_OVERWRITE         = ' '
        NO_AUTH_CHECK             = ' '
        CODEPAGE                  = '4103'
        IGNORE_CERR               = ABAP_TRUE
        REPLACEMENT               = '#'
        WRITE_BOM                 = 'X'
        TRUNC_TRAILING_BLANKS_EOL = 'X'
        WK1_N_FORMAT              = ' '
        WK1_N_SIZE                = ' '
        WK1_T_FORMAT              = ' '
        WK1_T_SIZE                = ' '
        WRITE_LF_AFTER_LAST_LINE  = ABAP_TRUE
        SHOW_TRANSFER_STATUS      = ABAP_TRUE
   IMPORTING
        FILELENGTH                = TABLES
        DATA_TAB                  = IT_KNA1
        FIELDNAMES                = IT_FILEDNAME[]
   EXCEPTIONS
        FILE_WRITE_ERROR          = 1
        NO_BATCH                  = 2
        GUI_REFUSE_FILETRANSFER   = 3
        INVALID_TYPE              = 4
        NO_AUTHORITY              = 5
        UNKNOWN_ERROR             = 6
        HEADER_NOT_ALLOWED        = 7
        SEPARATOR_NOT_ALLOWED     = 8
        FILESIZE_NOT_ALLOWED      = 9
        HEADER_TOO_LONG           = 10
        DP_ERROR_CREATE           = 11
        DP_ERROR_SEND             = 12
        DP_ERROR_WRITE            = 13
        UNKNOWN_DP_ERROR          = 14
        ACCESS_DENIED             = 15
        DP_OUT_OF_MEMORY          = 16
        DISK_FULL                 = 17
        DP_TIMEOUT                = 18
        FILE_NOT_FOUND            = 19
        DATAPROVIDER_EXCEPTION    = 20
        CONTROL_FLUSH_ERROR       = 21
        OTHERS                    = 22.
分享到:
评论
1 楼 695165987 2011-07-25  
用逗号分割,是改变那个参数。

相关推荐

Global site tag (gtag.js) - Google Analytics