2008 Feb 26 1:57 PM
Hi
I am working with r/3 version 4.6 B . I ma using gui_upload to read the data froma text file from desktop. the text file contains tow columns of data separated by tab space. when i pass this to the gui_upload the two columns data is going into first column of the internal table. the code is shown below
DATA : BEGIN OF itab_bdc OCCURS 0,
konob LIKE table-konob,
matnr LIKE table-matnr,
END OF itab_bdc
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = p_file1
filetype = 'ASC'
has_field_separator = 'X'
HEADER_LENGTH = 0
read_by_line = 'X'
DAT_MODE = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
CHECK_BOM = ' '
VIRUS_SCAN_PROFILE =
NO_AUTH_CHECK = ' '
IMPORTING
FILELENGTH =
HEADER =
TABLES
data_tab = itab_bdc
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_READ_ERROR = 2
NO_BATCH = 3
GUI_REFUSE_FILETRANSFER = 4
when i see the internal table itab_bdc the field konob contains both the columns data of the text file. It is not splitting the konob and matnr data into two different columns. what shd i do ?? I tried with has_field_separator = ' ' also , butno use. basically what i have observed is that the konob field is 18 char length. so if i have more than 18 characters in total , then whatever is left is going to the matnr field.
Also I think i have used this FM with success in a similar kind of situation. is it something to do with the r/3 version 4.6 B
thanks
sankar
2008 Feb 26 2:20 PM
Hi
I am working with r/3 version 4.6 B . I ma using gui_upload to read the data froma text file from desktop. the text file contains tow columns of data separated by tab space. when i pass this to the gui_upload the two columns data is going into first column of the internal table. the code is shown below
DATA : BEGIN OF itab_bdc OCCURS 0,
konob LIKE table-konob,
matnr LIKE table-matnr,
END OF itab_bdc
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = p_file1
filetype = 'ASC'
has_field_separator = 'X'
HEADER_LENGTH = 0
read_by_line = 'X'
DAT_MODE = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
CHECK_BOM = ' '
VIRUS_SCAN_PROFILE =
NO_AUTH_CHECK = ' '
IMPORTING
FILELENGTH =
HEADER =
TABLES
data_tab = itab_bdc
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_READ_ERROR = 2
NO_BATCH = 3
GUI_REFUSE_FILETRANSFER = 4
when i see the internal table itab_bdc the field konob contains both the columns data of the text file. It is not splitting the konob and matnr data into two different columns. what shd i do ?? I tried with has_field_separator = ' ' also , butno use. basically what i have observed is that the konob field is 18 char length. so if i have more than 18 characters in total , then whatever is left is going to the matnr field.
Also I think i have used this FM with success in a similar kind of situation. is it something to do with the r/3 version 4.6 B
thanks
sankar
2008 Feb 26 2:00 PM
2008 Feb 26 2:02 PM
Hi,
use field separator as '#'.I think this will solve your problem.
<REMOVED BY MODERATOR>
Regards,
Sowmya.
Edited by: Alvaro Tejada Galindo on Feb 26, 2008 11:03 AM
2008 Feb 26 2:06 PM
Hi
Can u elaborate more on that. I mean what should i chane in the coding exactly.
thanks
sankar
2008 Feb 26 2:14 PM
hi
I have just realised that the gui_upload in 4.6 B does not contain the "has_field_separator" import parameter at all. I think i have copied the code from the newer versions of r/3 that is the problem. The Fm in 4.6 B looks like this
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = ' '
FILETYPE = 'ASC'
IMPORTING
FILELENGTH =
TABLES
data_tab =
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_READ_ERROR = 2
NO_BATCH = 3
GUI_REFUSE_FILETRANSFER = 4
INVALID_TYPE = 5
OTHERS = 6
so when i executed it there is a # symol that comes between konob and matnr values, which means that tab space is replaced by #. Now how do i split this data and fill the internal table itab_bdc??
thanks
sankar
2008 Feb 26 2:19 PM
I had a simmilar problem uploading from ECC to 4.5, Gui_upload was not separating the fields right.
What I did was using an internal table with a string in it, so all the fields go to that string and later used FM TEXT_CONVERT_TXT_TO_SAP.
This FM takes a string table and converts it to an internal table, separating the fields with any custom i_field_separator so you can use
other separators also, because Gui_upload only works with tabs
2008 Feb 26 2:20 PM
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |