‎2006 Sep 25 7:51 AM
I have a text file with at least 5 column.
Using upload fm and transfer to internal table.
However, is there a faster way to upload whereby the columns from the text file will flow into the respective itab column directly?
‎2006 Sep 25 8:10 AM
‎2006 Sep 25 8:00 AM
hi,
we first read the text file into an internal table itab1 and then we fill itab2 in the order of columns.
using FM get text into itab1.
loop at itab1.
itab2-var1 = itab1+0(4).
and so on...
append itab2.
endloop.
reward if useful...
‎2006 Sep 25 8:07 AM
Declare ur internal table with 5 fields and use GUI_UPLOAD FM
data : begin of itab occurs 0,
col1(15),
col2(15),
col3(15),
col4(15),
col5(15),
end of itab.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = 'C:Text.txt'
FILETYPE = 'DAT'
* has_field_separator = 'X'
* HEADER_LENGTH = 0
* READ_BY_LINE = 'X'
* DAT_MODE = ' '
* CODEPAGE = ' '
* IGNORE_CERR = ABAP_TRUE
* REPLACEMENT = '#'
* CHECK_BOM = ' '
* IMPORTING
* FILELENGTH =
* HEADER =
TABLES
data_tab = itab
‎2006 Sep 25 8:08 AM
the itabfields should be of the same order as in text file.
so that it ill be faster.
also use GUI_Upload
‎2006 Sep 25 8:10 AM
‎2006 Sep 25 8:11 AM
if your text file is having any field seperator like TAB seperated or comma seperated,then you can use GUI_UPLOAD function module and put
HAS_FIELD_SEPERATOR = 'X' this parameter in GUI_UPLOAD,then automatically values will be populated to your Internal table.
Regards,
Srikanth