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: 

GUI_DOWNLOAD Trailing Space

Former Member
0 Kudos

Hi All,

I have one issue and i need to download the data into .txt file at my desktop.

I will get the data from diffrent tables and using gui_download function and i get in file.

simple code here

data : begin of itab_data occurs 0 ,

matnr like mara-matnr,

maktx like makt-maktx,

end of itab_data.

itab_data-matnr = '000000000000000098'.

itab_data-maktx = '1234567890'.

append itab_data.

and i am calling gui_download

I am getting output like this

0000000000000000981234567890( here i need get space )

after material description user will use -> symbol at keyboard,right now it is not going.when i put some delimter it is going.

but my case i should not use delimter and it is 4.6C .

I got output in 5.00 Vresion and my current sytem is 4.6C and can anyone give me the idea how to do.

Thanks

Seshu

1 ACCEPTED SOLUTION

ferry_lianto
Active Contributor
0 Kudos

Hi Seshu,

How did you declare field CR? Is it type X with value '0D' (zero and D)?

Regards,

Ferry Lianto

8 REPLIES 8

ferry_lianto
Active Contributor
0 Kudos

Hi,

Have you set TRUNC_TRAILING_BLANKS_EOL to space in FM GUI_DOWNLOAD?

Regards,

Ferry Lianto

0 Kudos

Yes I am using.

below my sample code .

data : begin of itab_data occurs 0 ,

matnr like mara-matnr,

maktx like makt-maktx,

end of itab_data.

start-of-selection.

itab_data-matnr = '0000000000000000098'.

itab_data-maktx = '1234567890'.

append itab_data.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

  • BIN_FILESIZE =

FILENAME = 'C:\testddd.txt'

FILETYPE = 'ASC'

  • APPEND = ' '

WRITE_FIELD_SEPARATOR = ' '

  • HEADER = '00'

TRUNC_TRAILING_BLANKS = 'X'

  • WRITE_LF = 'X'

  • COL_SELECT = ' '

  • COL_SELECT_MASK = ' '

  • DAT_MODE = ' '

  • IMPORTING

  • FILELENGTH =

TABLES

DATA_TAB = itab_data

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.

<b>Current Output is :

0000000000000000981234567890

but i have to get like

0000000000000000981234567890(here should space) and user will use key -> then it should go.</b>

Thanks

Seshu

ferry_lianto
Active Contributor
0 Kudos

Hi,

Please try this ...


data: begin of itab_data occurs 0 ,
        matnr like mara-matnr,
        maktx like makt-maktx,
        cr    type x value '0D',              <-- add this line
end of itab_data.

start-of-selection.

itab_data-matnr = '0000000000000000098'.
itab_data-maktx = '1234567890'.
append itab_data.

CALL FUNCTION 'GUI_DOWNLOAD'
  EXPORTING
    FILENAME = 'C:testddd.txt'
    FILETYPE = 'ASC'
    WRITE_FIELD_SEPARATOR = ' '
    TRUNC_TRAILING_BLANKS = ' '               <--  set to space
  TABLES
    DATA_TAB = itab_data
  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.

Regards,

Ferry Lianto

0 Kudos

Thank you for quick reply,

when i look at text file

output is

0000000000000000091234567890 0D( OD should not be in text file )

Thanks

Seshu

ferry_lianto
Active Contributor
0 Kudos

Hi Seshu,

How did you declare field CR? Is it type X with value '0D' (zero and D)?

Regards,

Ferry Lianto

0 Kudos

Yes ,I declared

cr type x value '0D' ,zero D .

Thanks

Seshu

0 Kudos

Thanks Ferry, It works for me.

Can you please let me know what does field CR mean? With type X and value '0D'?

Former Member
0 Kudos

Hi,

Try declaring a single character field at the end of the internal table...

data: begin of itab_download occurs 0 ,

matnr like mara-matnr,

maktx like makt-maktx,

<b>dummy,</b>

end of itab_download.

Thanks,

Naren