Download Text File with Space

Umumnya bila mendowload file text dimana akhir dari masing-masing line berupa space, maka space akan terpotong.
Misalkan data yang diturunkan adalah ‘hello word    ‘ with three space after letter d. Those three space will be vanished dan data yang terdownload dalah ‘hello word’.

Untuk mengatasi hal ini, pada FM GUI_DOWNLOAD set export parameter yang berkaitan dengan space di belakang data seperti contoh di bawah ini (perhatikan comment dengan tanda seru !!!) :

  CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
      filename                    = filename
      filetype                    = 'ASC'
      trunc_trailing_blanks       = ' ' "!!!
      TRUNC_TRAILING_BLANKS_EOL   = ' ' "!!!
      write_lf                    = 'X' "!!!
    TABLES
      data_tab                    = data_tab
    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 'I' NUMBER SY-MSGNO
           WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.

Hope it helps.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s