Download a text file with FM GUI_DOWNLOAD/WS_DOWNLOAD

Question: Hi everybody,
I am trying to download an internal table by using the function modules
above. However, I need that the last column keep its length, it means, if
the last column is defined as char 10 and its value length is only 3,
the 7 left must be blanks.

Look at this,
MATNR 18 characters
WERKS 04 characters
VALUE 10 characters
A line of my text file must be something like this:

"200040493_________VE11VEB_______"


but I get:
"200040493_________VE11VEB"
where "_" is a blank

Thanks in advance

pd: It must be a text file (type 'ASC') and not binary (type
'BIN'). I already have tried with an hex. variable to complete the
string but it only works if , in the function modules, I enable/complete the
binary file options

Answer:
Hi Cesarbe,

As an alternative solution, what you can do is add a 4th column to you internal table which is one character in length and default it with some fixed value. Basically it is treated as a line-break or end of line indecator.

data: begin of itab occurs 0,
matnr ...,
werks ...,
value ...,
eol type char01 value ';',
end of itab.

This way, in your downloaded file ; would be the last character of every line and you will have fixed column width.


Hope this works for you.

Sumant.

Answer:
Hi Sumant,
Good idea but in this case the text file is going to be used for other system and it is mandatory that the internal table's structure has a defined width (I can not add a new column or increase the length of existing columns)
It is a particular case...
anyway many thanks

Answer:
I remembered that I need to call up a subroutine on some standard program to get this to work. I'm not on SAP right now and couldn't check what subroutine you need to call .. but go to WS_DOWNLOAD or GUI_DOWNLOAD and check their main program .. most probably the subroutine is there.

Answer:
Quick google search returns this:

Maintaining Trailing spaces when downloading to PC

Before calling DOWNLOAD or WS_DOWNLOAD, do a perform SET_TRAIL_BLANKS(saplgrap) using 'X'

To set the length of each record including your blanks add this code: perform SET_FIXLEN(saplgrap) using '0' '100'

Answer:
Excellent, master!...for the album!

Answer:
I have just the same problem like this, except i have to use the function "GUI_DOWNLOAD". The trick to use those perform routines that was told in this chain earlier does not work when using GUI_DOWNLOAD, so anybody have any ideas how to get it working?

Answer:
Did you investigate the parameter TRUNC_TRAILING_BLANKS?
Copyright ?2007 - 2008 www.jt77.com