Skip to end of metadata
Go to start of metadata

WS_DOWNLOAD

WS_DOWNLOAD is obsolete function module for storing SAP data in a file in the file system of the presentation server.

CALL FUNCTION 'WS_DOWNLOAD'
  EXPORTING
*   BIN_FILESIZE                  = ' '
*   CODEPAGE                      = ' '
   FILENAME                      = filename
   FILETYPE                      = 'ASC'
*   MODE                          = ' '
*   WK1_N_FORMAT                  = ' '
*   WK1_N_SIZE                    = ' '
*   WK1_T_FORMAT                  = ' '
*   WK1_T_SIZE                    = ' '
*   COL_SELECT                    = ' '
*   COL_SELECTMASK                = ' '
*   NO_AUTH_CHECK                 = ' '
* IMPORTING
*   FILELENGTH                    =
TABLES
DATA_TAB                      = lt_datatab
*   FIELDNAMES                    =
 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
   NO_AUTHORITY                  = 10
   OTHERS                        = 11
.

So we will be using the method ` GUI_DOWNLOAD` of the class `CL_GUI_FRONTEND_SERVICES`.

DATA filename_new TYPE STRING .

MOVE filename TO filename_new.

CALL METHOD CL_GUI_FRONTEND_SERVICES=>GUI_DOWNLOAD
EXPORTING
*    BIN_FILESIZE              =
      FILENAME                  = filename_new
      FILETYPE                  = 'ASC'
*    APPEND                    = SPACE
*    WRITE_FIELD_SEPARATOR     = SPACE
*    HEADER                    = '00′
*    TRUNC_TRAILING_BLANKS     = SPACE
*    WRITE_LF                  = 'X'
*    COL_SELECT                = SPACE
*    COL_SELECT_MASK           = SPACE
*    DAT_MODE                  = SPACE
*    CONFIRM_OVERWRITE         = SPACE
*    NO_AUTH_CHECK             = SPACE
*    CODEPAGE                  = SPACE
*    IGNORE_CERR               = ABAP_TRUE
*    REPLACEMENT               = '#'
*    WRITE_BOM                 = SPACE
*    TRUNC_TRAILING_BLANKS_EOL = 'X'
*    WK1_N_FORMAT              = SPACE
*    WK1_N_SIZE                = SPACE
*    WK1_T_FORMAT              = SPACE
*    WK1_T_SIZE                = SPACE
*  IMPORTING
*    FILELENGTH                =
CHANGING
     DATA_TAB                  = lt_datatab
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
    NOT_SUPPORTED_BY_GUI      = 22
    ERROR_NO_GUI              = 23
    others                    = 24
.

  • No labels

1 Comment

  1. Can you please provide insights to the file type in this scenerios?
    That would be more helpful