2008 Nov 12 5:36 PM
HI,
i use gui upload fm to upload file the problem is that i get it in one line (its cut)
i.e. if i have in the file 10 lines i get only 1 and its cut (in data_tab),
i try to declare data_tab with bigger length but it's not working.
like below .
i want to get all the string but it seems that it cutting it because the length.
how can i get all the data in the table ?
Regards
one time like:
TYPES: BEGIN OF itab ,
fld1(262143) TYPE C,
END OF itab.
DATA: it_tab TYPE TABLE OF itab.
and other :
DATA: it_tab TYPE TABLE OF string.
CALL METHOD cl_gui_frontend_services=>gui_upload
EXPORTING
filename = fir_file
* filetype = 'BIN'
* has_field_separator = 'X'
* header_length = 0
read_by_line = 'X'
* dat_mode = SPACE
* codepage = SPACE
* ignore_cerr = ABAP_TRUE
* replacement = '#'
* virus_scan_profile =
* IMPORTING
* filelength =
* header =
CHANGING
data_tab = it_tab
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
not_supported_by_gui = 17
error_no_gui = 18
OTHERS = 19
.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
HI,
i use gui upload fm to upload file the problem is that i get it in one line (its cut)
i.e. if i have in the file 10 lines i get only 1 and its cut (in data_tab),
i try to declare data_tab with bigger length but it's not working.
like below .
i want to get all the string but it seems that it cutting it because the length.
how can i get all the data in the table ?
Regards
one time like:
TYPES: BEGIN OF itab ,
fld1(262143) TYPE C,
END OF itab.
DATA: it_tab TYPE TABLE OF itab.
and other :
DATA: it_tab TYPE TABLE OF string.
CALL METHOD cl_gui_frontend_services=>gui_upload
EXPORTING
filename = fir_file
* filetype = 'BIN'
* has_field_separator = 'X'
* header_length = 0
read_by_line = 'X'
* dat_mode = SPACE
* codepage = SPACE
* ignore_cerr = ABAP_TRUE
* replacement = '#'
* virus_scan_profile =
* IMPORTING
* filelength =
* header =
CHANGING
data_tab = it_tab
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
not_supported_by_gui = 17
error_no_gui = 18
OTHERS = 19
.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
2008 Nov 12 5:45 PM
Hi
once yout get data in to it_tab
loop at it_tab into wa_tab.
split wa_tab at '|' into wa_final-f1 wa_final-f2 wa_final-f3 wa_final-f4...
....
append itab_final from wa_final.
endloop.
2008 Nov 12 7:17 PM
Hi J@Y ,
thanks ,
the problem is with the data that i get from the method ,
in data_tab i get just 1 line from the file insted of 10 line
what can be the problem ?
as my previous post i try do declare it_tab in 2 diff ways(i think that the problem is with the size of the field) and i still get the same data in the it_tab.
what can be the problem?
Regards
2008 Nov 12 7:23 PM
when you are writing the file,, the one which you are uplaoding does it have any logic to add line feed or page breaker.. if not you need to have that.. when you are writing the file..
search the forum for page breaker or line feed you will get good info...
2008 Nov 12 7:27 PM
Hi J@Y ,
thnaks,
i don't want to write to the file ,what i want is to get the data from txt file that in the server.
and with this method i get just some of the file .
Regards
2008 Nov 12 7:32 PM
Hi ViJ@Y
I am saying to check if you are uploading the file which is good,,i.e. in correct format...
correct format file1:
lhldhflskd sdfsdgf asdfsdf ';k;'ip[p [pi[i[sidfg mashdfksg <PB>
lhldhflskd sdfsdgf asdfsdf ';k;'ip[p [pi[i[sidfg mashdfksg <PB>
lhldhflskd sdfsdgf asdfsdf ';k;'ip[p [pi[i[sidfg mashdfksg <PB>
lhldhflskd sdfsdgf asdfsdf ';k;'ip[p [pi[i[sidfg mashdfksg <PB>output:
lhldhflskd sdfsdgf asdfsdf ';k;'ip[p [pi[i[sidfg mashdfksg
lhldhflskd sdfsdgf asdfsdf ';k;'ip[p [pi[i[sidfg mashdfksg
lhldhflskd sdfsdgf asdfsdf ';k;'ip[p [pi[i[sidfg mashdfksg
lhldhflskd sdfsdgf asdfsdf ';k;'ip[p [pi[i[sidfg mashdfksg "perfect in line
Not correct format file:
lhldhflskd sdfsdgf asdfsdf ';k;'ip[p [pi[i[sidfg mashdfksg
lhldhflskd sdfsdgf asdfsdf ';k;'ip[p [pi[i[sidfg mashdfksg
lhldhflskd sdfsdgf asdfsdf ';k;'ip[p [pi[i[sidfg mashdfksg
lhldhflskd sdfsdgf asdfsdf ';k;'ip[p [pi[i[sidfg mashdfksg"Page breaker is missing
output:
lhldhflskd sdfsdgf asdfsdf ';k;'ip[p [pi[i[sidfg mashdfksg lhldhflskd sdfsdgf asdfsdf ';k;'ip[p [pi[i[sidfg mashdfksg lhldhflskd sdfsdgf asdfsdf ';k;'ip[p [pi[i[sidfg mashdfksg lhldhflskd sdfsdgf asdfsdf ';k;'ip[p [pi[i[sidfg mashdfksg " not breaking in betweenHope you understood.
2008 Nov 12 7:47 PM
hi J@Y
from what u say i have to get the text file with separator ?
are u sure ?
Regards
2008 Nov 12 8:02 PM
the first question you need to ask yuor FC, is what kind of file will I get
delimitors:
Tab
pipe |
CSV comma ,
space seperated etc..
and if some other program is writing the file, make sure line feed or page breaker is placed at the end of each row.
2008 Nov 12 8:13 PM
Hi J@Y ,
thanks ,
the real problem is that i don't get the first raw OK
it cut it in the middle ,this is what i get in it_tab.
i don't talk about the other raw that i don't get any of them.
Regards
p.s.
if i success in geting the file in gui_upload and don't with open dataset (sy-subrc = 😎
what does it mean?
Regards
2008 Nov 12 8:22 PM
to use open dataset the path always need to be in existing in AL11 tr., the path what you gave for open dataset does not exist.. so the sy-subrc was returning 8.
if the file is already in al11 existing.. then use open dataset.
if the file is in local drive ( in ur lappy, on the desktop) use Gui_upload gui_download
if the file is in server FTP windows based server use FTP Fm's
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |