Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

uploading text file

Former Member
0 Likes
638

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?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
593

u can used GUI_Upload function module

5 REPLIES 5
Read only

Former Member
0 Likes
593

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...

Read only

Former Member
0 Likes
593

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

Read only

Former Member
0 Likes
593

the itabfields should be of the same order as in text file.

so that it ill be faster.

also use GUI_Upload

Read only

Former Member
0 Likes
594

u can used GUI_Upload function module

Read only

Former Member
0 Likes
593

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