Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to remove white spaces with GUI_Download FM

Former Member
0 Kudos
1,137

Hi Gurus,

I need to download my text file using GUI_DOWNLOAD FM without leading white spaces, can u pls advice me.

I am giving the code I am using below.

-


CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

  • BIN_FILESIZE =

filename = l_filename

  • filetype = 'ASC'

  • APPEND = ' '

WRITE_FIELD_SEPARATOR = 'X'

  • HEADER = '00'

TRUNC_TRAILING_BLANKS = 'X'

  • WRITE_LF = 'X'

  • COL_SELECT = ' '

  • COL_SELECT_MASK = ' '

  • DAT_MODE = ' '

  • CONFIRM_OVERWRITE = ' '

  • NO_AUTH_CHECK = ' '

  • CODEPAGE = ' '

  • IGNORE_CERR = ABAP_TRUE

  • REPLACEMENT = '#'

  • WRITE_BOM = ' '

  • 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 = gt_temp

  • FIELDNAMES =

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.

6 REPLIES 6

koolspy_ultimate
Active Contributor
0 Kudos
194

can you elobrate your requirement little more?

sjeevan
Active Contributor
0 Kudos
194

loop at i_filename.

shift i_filename-first_field left deleting leading ' '.

endloop.

Insert this code before passing the i_filename to the FM. Here I'm assuming that the first field is introducing the leading spaces.

lcpaiva
Explorer
0 Kudos
194

Please, send file line sample.

Edited by: Luciano Paiva on Aug 2, 2011 8:43 PM

koolspy_ultimate
Active Contributor
0 Kudos
194

hi , try this,


REPORT  ZMP_SALES_HEDER_DOWLNLOAD.
types:begin of ty_vbak,
      vbeln type vbeln,
      erdat type erdat,
      ernam type ernam,
      netwr type netwr_ak,
      vkorg type vkorg,
      kunnr type kunnr,
      end of ty_vbak.

data:it_vbak type table of ty_vbak,
     wa_vbak type ty_vbak.

select-options:s_vbeln for wa_vbak-vbeln.

 start-of-selection.

 select vbeln
        erdat
        ernam
        netwr
        vkorg
        kunnr from vbak
        into table it_vbak
        where vbeln in s_vbeln.

   CALL FUNCTION 'GUI_DOWNLOAD'
     EXPORTING
*      BIN_FILESIZE                    =
       FILENAME                        = 'C:/temp.XLS'
*      FILETYPE                        = 'ASC'
*      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                        = ' '
*      IGNORE_CERR                     = ABAP_TRUE
*      REPLACEMENT                     = '#'
*      WRITE_BOM                       = ' '
*      TRUNC_TRAILING_BLANKS_EOL       = 'X'
*      WK1_N_FORMAT                    = ' '
*      WK1_N_SIZE                      = ' '
*      WK1_T_FORMAT                    = ' '
*      WK1_T_SIZE                      = ' '
*    IMPORTING
*      FILELENGTH                      =
     TABLES
       DATA_TAB                        = IT_VBAK
*      FIELDNAMES                      =
*    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 'DATA ULOADED TO temp FILE' TYPE 'I'.
   ENDIF.

Former Member
0 Kudos
194

Hi,

I have used No-Gaps in my code. It solved my problem.

Former Member
0 Kudos
194

No-Gaps solved my problem