08-08-2012 8:29 AM
Hi,
i am downloding data using the below code
SELECT lifnr name1 ort01 FROM lfa1 INTO TABLE i_lfa1 UP TO 3 ROWS.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
* BIN_FILESIZE =
filename = 'D:\a.txt'
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 = i_lfa1.
* 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.
And again i am uploding the same data as like
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = 'D:\a.txt'
filetype = 'ASC'
has_field_separator = ' '
* HEADER_LENGTH = 0
* READ_BY_LINE = 'X'
* DAT_MODE = ' '
* CODEPAGE = ' '
* IGNORE_CERR = ABAP_TRUE
* replacement = 'X'
* CHECK_BOM = ' '
* VIRUS_SCAN_PROFILE =
* NO_AUTH_CHECK = ' '
* IMPORTING
* FILELENGTH =
* HEADER =
TABLES
data_tab = itab
* EXCEPTIONS
* FILE_OPEN_ERROR = 1
* FILE_READ_ERROR = 2
* NO_BATCH = 3
* GUI_REFUSE_FILETRANSFER = 4
* INVALID_TYPE = 5
* NO_AUTHORITY = 6
* UNKNOWN_ERROR = 7
* BAD_DATA_FORMAT = 8
* HEADER_NOT_ALLOWED = 9
* SEPARATOR_NOT_ALLOWED = 10
* HEADER_TOO_LONG = 11
* UNKNOWN_DP_ERROR = 12
* ACCESS_DENIED = 13
* DP_OUT_OF_MEMORY = 14
* DISK_FULL = 15
* DP_TIMEOUT = 16
* OTHERS = 17
.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
now the problem is i am getting the data with '#' symbol instead of TAB space. how can i overcome this
Plaz help me .
Thanks & regards,
Subba.R
08-08-2012 8:49 AM
08-08-2012 9:16 AM
08-08-2012 10:54 AM
Hi,
Thank you for your answer ,
i pass
has_field_separator = '#' in 'GUI_UPLOAD' FM..
now i am getting the data but the problem is i want to get data without field legnth space.
means here field Name1 having 20 characters but value is 12 characters only remaining 8 characters i want to remove.
how can i upload data like this,
08-08-2012 9:32 AM
08-08-2012 9:45 AM
Hello,
the # Symbol, do you see this in Debugger? TAB is a Char which can't be displayed, so the Debugger replaces it with the # Symbol. So, it could be, that everything is working fine.
If you want to split the data, you can use the "has_field_separator" Parameter, if you have an structured Table (here itab). If not, you must split it with
split line at cl_abap_char_utilities=>tab into table.
Regards,
Bastian Stritt
08-08-2012 10:33 AM
thank you for your reply,
But my requirement is only with TAB space ,without field legnth spacei ahve to upload .
that means if a field have 20 character space but value in that field is 12 characters ,then remaining 8 character space is remove.
in text file data will be with Tab spaces only.
08-08-2012 10:48 AM
In your downloaded file ,if your are getting values tab dilimeted,then while uploading you can use below code in GUI Upload
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = 'D:\a.txt'
filetype = 'ASC'
has_field_separator = cl_abap_char_utilities=>horizontal_tab
TABLES
data_tab = itab .
.
This should work
08-08-2012 10:55 AM
Use CONDENSE statement to truncate the space.
In FM pass has_field_separator = 'X'.
08-08-2012 9:46 AM
Set the value has_field_separator = 'X'.
in 'GUI_UPLOAD' FM..
Ex:
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = 'D:\a.txt'
filetype = 'ASC'
has_field_separator = ' X'
08-08-2012 10:31 AM
as already mentioned ,please set the has_field_separator in GUI_UPLOAD FM
either try has_field_separator = '#' or has_field_separator = 'X'
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = 'D:\a.txt'
filetype = 'ASC'
has_field_separator = '# '