Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

read from flat file --> internal table please help.

Hello ABAP Experts,

I have a requirement to read a text file containing three fields and read them into the internal table. Could you show me a sample code.

Any help is highly appreciated.

Any docs or code mail to mgmswsol@gmail.com

Thanks,

BWer

Tags:
Former Member
Former Member replied

Hello,

Just create an internal table with your 3 fields

data: begin of ti_data occurs 0,

fld1 type c,

fld2 type c,

fld3 type c,

end of ti_data.

To read the file just call this FM:

ALL FUNCTION 'TB_LIMIT_WS_UPLOAD'

EXPORTING

filename = Root to your file

filetype = 'ASC'

IMPORTING

filelength = length

TABLES

data_tab = ti_data.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

Hope this helps

Gabriel

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question