04-01-2008 7:37 AM
Hi all,
I have to upload a file from application server into internal file.
The data in the file are not tab delimited, So Split at command will not work.
Since the exact length of each fileds are not known is there any other way to upload file into my internal table ?
Thanks
Dhurga R
04-01-2008 7:45 AM
Hi,
U want to split the data from the file and want to store it into an internal table. But for storing also it should be of TYPE of structure of the file . Find out the file contaits are of which TYPE.
because without knowing it's type,is is not possible to split and store.
regards,
Anuja
04-01-2008 7:43 AM
report zamtest
line-size 170
line-count 65 no standard page heading.
data : fname(30) value 'C:\ZFCHR1.TXT'.
data : str(255).
open dataset fname for input in binary mode .
read dataset fname into itab.
do.
if sy-subrc ne 0.
exit.
endif.
append itab.
enddo
close dataset fname.
Regards,
V.Balaji
Reward if Usefull...
Edited by: Balaji V on Apr 1, 2008 8:44 AM
04-01-2008 7:43 AM
HI,
You can read the file in internal table just by mentioning only one field with maximum length or string.
Award Points If Useful
04-01-2008 7:45 AM
Hi,
U want to split the data from the file and want to store it into an internal table. But for storing also it should be of TYPE of structure of the file . Find out the file contaits are of which TYPE.
because without knowing it's type,is is not possible to split and store.
regards,
Anuja
04-01-2008 7:58 AM
Hi,
By using the following code,you can upload the flat file data
into internal table having one field of maximum size.
Later based on ur file u need use either place holders or split
functionality.
DATA: fname(25) VALUE 'd:\abap eve\file1.txt'.
DATA: str(255).
OPEN DATASET fname FOR INPUT IN TEXT MODE ENCODING DEFAULT.
IF sy-subrc <> 0.
WRITE:/ 'sorry'.
ELSE.
DO.
READ DATASET fname INTO str.
IF sy-subrc = 0.
WRITE:/ str.
ELSE.
EXIT.
ENDIF.
ENDDO.
ENDIF.
close dataset fname.
If you need complete code,just give me your flat file sample data.i will try to send full code.
Regards,
Chandu