Skip to Content
author's profile photo
Former Member

GUI_DOWNLOAD --> WRITE_FIELD_SEPARATOR

Hi,

I am using this code to save/download table to txt file.

I am using WRITE_FIELD_SEPARATOR = ';' but stil separator is SPACE??

Can someone help. plz..

  DATA: ldf_filename TYPE string,
  ldf_path TYPE string,
  ldf_fullpath TYPE string,
  ldf_fname TYPE string.

  CALL METHOD cl_gui_frontend_services=>file_save_dialog
  EXPORTING
* WINDOW_TITLE =
* DEFAULT_EXTENSION =
  default_file_name = ldf_fname
* FILE_FILTER =
* INITIAL_DIRECTORY =
* WITH_ENCODING =
* PROMPT_ON_OVERWRITE = 'X'
  CHANGING
  filename = ldf_filename
  path = ldf_path
  fullpath = ldf_fullpath
* USER_ACTION =
* FILE_ENCODING =
  EXCEPTIONS
  cntl_error = 1
  error_no_gui = 2
  OTHERS = 4.

  IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.


  CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
*   BIN_FILESIZE                  =
      filename                      = ldf_filename
   FILETYPE                      = 'ASC'
*   APPEND                        = ' '
   WRITE_FIELD_SEPARATOR         = ';'
*   HEADER                        = '00'
*   TRUNC_TRAILING_BLANKS         = ' '
*   WRITE_LF                      = 'X'
*   COL_SELECT                    = ' '
*   COL_SELECT_MASK               = ' '
*   DAT_MODE                      = ' '
* IMPORTING
*   FILELENGTH                    =
    TABLES
      data_tab                      = lt_spoollst
* 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
            .
  IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

4 Answers

  • Best Answer
    Posted on Aug 23, 2007 at 06:45 AM

    Hi Adibo...

    Here WRITE_FIELD_SEPERATOR can be either 'X' OR ' '.

    'X' means Tab delimiter will be used.

    ' ' Means No delimiter

    We cannot give other Characters like ; here.

    So in the Internal Table itself you store the Data using this delimiter and then pass the Itab to Internal table.

    DATA: IT_DATA TYPE TABLE OF STRING.

    LOOP AT ITAB INTO WA.

    CONCATENATE WA-FIELD1 WA-FIELD2 SEPARATED BY ';'.

    APPEND WA TO IT_DATA.

    ENDLOOP.

    Now pass the DATA_TAB = IT_DATA

    and WRITE_FIELD_SEPERATOR = ' '

    <b>Reward if Helpful</b>

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Posted on Aug 23, 2007 at 06:45 AM

    Hi Adibo,

    I hope you have to use file type as DAT. Try it.

    If work out award with points.

    kishore

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Posted on Aug 23, 2007 at 06:52 AM

    try it with ASC as the type of file( as it doesnt work for DAT) and use either 'X' or '' for tab lemited or space.

    u cant use others as far as i know

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Posted on Aug 23, 2007 at 07:00 AM

    Adibo,

    WRITE_FIELD_SEPARATOR parameter in the FM GUI_DOWNLOAD supports only 2 values.

    'X' : Write separator.

    SPACE : Do not write separator.

    If you want to get tab-delimitted files you have to pass this parameter with 'X' as a value.

    Hope it helps... Reward points if found useful

    Balaji

    Add comment
    10|10000 characters needed characters exceeded