2013 Jan 21 3:54 PM
Hi all,
We are using the standard method, CL_GUI_FRONTEND_SERVICES=>GUI_DOWNLOAD to download data from an internal table to .txt file. We use the ECC 6 version. The downloaded file should not have a carriage return, but it should have line feed. Here are the parameters that we are passing to call the method. When it downloads the file, it does not have a carriage return which is want we want, but it does not have a line feed either. How can I put line feeds to separate the lines? The last field in the internal table is all blanks.
VL_FILENAME = S_L-FILENM.
VL_FILETYPE = 'ASC'.
VL_CODEPAGE = '1160'.
VL_TRUNC = ' '.
VL_LF = ' '.
DATA: BEGIN OF TEMPTEST2 OCCURS 0,
fld001(001) type c,
fld002(003) type n,
fld003(002) type n,
fld004(014) type n,
fld005(001) type c,
fld006(001) type c,
fld007(001) type c,
fld008(001) type c,
fld009(011) type n,
fld010(010) type n,
fld011(006) type n,
FLD012(035) TYPE C,
fld013(021) type c,
fld014(035) type c,
fld015(158) type c,
END OF TEMPTEST2.
CALL METHOD
CL_GUI_FRONTEND_SERVICES=>GUI_DOWNLOAD
EXPORTING
FILENAME = VL_FILENAME
FILETYPE = VL_FILETYPE
TRUNC_TRAILING_BLANKS = VL_TRUNC
CODEPAGE = VL_CODEPAGE
WRITE_LF = VL_LF
CHANGING
DATA_TAB = TEMPTEST2[]
EXCEPTIONS
FILE_NOT_FOUND = 1
FILE_WRITE_ERROR = 2
FILESIZE_NOT_ALLOWED = 3
INVALID_TYPE = 5
NO_BATCH = 6
UNKNOWN_ERROR = 7
OTHERS = 8.
Thanks!
2013 Jan 21 4:57 PM
Hi Anjana,
For putting line feeds using the method, try the below code
VL_LF = ' X'.
CALL METHOD
CL_GUI_FRONTEND_SERVICES=>GUI_DOWNLOAD
EXPORTING
FILENAME = VL_FILENAME
FILETYPE = VL_FILETYPE
TRUNC_TRAILING_BLANKS = VL_TRUNC
CODEPAGE = VL_CODEPAGE
WRITE_LF = VL_LF
CHANGING
DATA_TAB = TEMPTEST2[]
EXCEPTIONS
FILE_NOT_FOUND = 1
FILE_WRITE_ERROR = 2
FILESIZE_NOT_ALLOWED = 3
INVALID_TYPE = 5
NO_BATCH = 6
UNKNOWN_ERROR = 7
OTHERS = 8.
Hope this helps
2013 Jan 21 5:01 PM
Thanks Aniket...but putting the value for WRITE_LF as 'X' puts the carriage return in the file. I do not want carriage return, but want the line feed.
2013 Jan 21 5:12 PM
Hi Anjana,
You can also set VL_TRUNC = ' X'.
Please see the below link
By setting both the variables, you can fulfill your requirement
Hope this helps...
2013 Jan 21 6:36 PM
Use code as below.
VL_FILENAME = S_L-FILENM.
VL_FILETYPE = 'ASC'.
VL_CODEPAGE = '1160'.
VL_TRUNC = ' '.
VL_LF = ABAP_TRUE.
DATA: BEGIN OF TEMPTEST2 OCCURS 0,
fld001(001) type c,
fld002(003) type n,
fld003(002) type n,
fld004(014) type n,
fld005(001) type c,
fld006(001) type c,
fld007(001) type c,
fld008(001) type c,
fld009(011) type n,
fld010(010) type n,
fld011(006) type n,
FLD012(035) TYPE C,
fld013(021) type c,
fld014(035) type c,
fld015(158) type c,
END OF TEMPTEST2.
CALL METHOD
CL_GUI_FRONTEND_SERVICES=>GUI_DOWNLOAD
EXPORTING
FILENAME = VL_FILENAME
FILETYPE = VL_FILETYPE
TRUNC_TRAILING_BLANKS = VL_TRUNC
CODEPAGE = VL_CODEPAGE
WRITE_LF = VL_LF
CHANGING
DATA_TAB = TEMPTEST2[]
EXCEPTIONS
FILE_NOT_FOUND = 1
FILE_WRITE_ERROR = 2
FILESIZE_NOT_ALLOWED = 3
INVALID_TYPE = 5
NO_BATCH = 6
UNKNOWN_ERROR = 7
OTHERS = 8.
2013 Jan 21 8:20 PM
hello,
please read the below blog to understand line feed and carriage return.
Once you identify your issue you could use the solutions others have provided already to resolve your issue.
best regards,
swanand
2013 Jan 21 8:44 PM
Thanks...but so far none of the above suggestions did work. It is always "either..or" situation with carriage return and line feed.
2013 Feb 01 8:06 PM
Just for the record, I am answering my own question...
I was able to achieve the requirement of no carriage return but with a linefeed by adding a hexadecimal character field to the end of the internal table, TEMPTEST2 as,
CARRIAGE_RETURN(1) TYPE X,
Gave the value '0D' to the field as,
MOVE '0D' TO TEMPTEST2-CARRIAGE_RETURN.
All the values for exporting parameters were kept the same as before.
Thanks for all the input.