Application Development 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: 

Uploading File

Former Member
0 Kudos

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

1 ACCEPTED SOLUTION

Former Member
0 Kudos

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

4 REPLIES 4

Former Member
0 Kudos

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

Former Member
0 Kudos

HI,

You can read the file in internal table just by mentioning only one field with maximum length or string.

Award Points If Useful

Former Member
0 Kudos

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

Former Member
0 Kudos

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