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

read file

Former Member
0 Likes
819

hi experts,

i have a file which gets uploaded to itab using gui_upload FM. the problem is the entire file is directly loaded whereas i need to to read one line at time, and processes it.

By this i mean when one line is read, if its read properly,the status is stored in a status field of itab as in 1, if not field sud store '0'.

thanks in advance

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
784

You can upload the entire file into application server first (using CG3Z) and then make use of :

<opendataset>

Read dataset (between a DO and ENDDO) which will help u to read one line after another.

<closedataset>

Reward points if Helpful

7 REPLIES 7
Read only

Former Member
0 Likes
784

u can also process it by gettting all the items at a time , any how u are not modifying the file.

call GUI_UPLOAD.

loop at itab.

checkings

display errors to correct

endloop.

Regards

prabhu

Read only

Former Member
0 Likes
784

Hi Bijal,

Uploading data from presentation server line by line is not possible,

as this blocks so much of resources.

Once the entire data is uploaded into itab, u can loop at ITAB & check for your conditions.

Regards,

Vaibhav.

Read only

Former Member
0 Likes
784

Hi bijal,

One of the way you can do the same thing,

as you are saying that it get's populated into the internal table as you are using some function module.... so in your code you can do one thing is that you can transfer the whole data to another internal table compairing the values you want and for the fields not matching ur criteria you can set a ' 0 ' at the starting ...

as the secong internal table will have status as it's first field... Beacuse operations between two internal tables will be quite easy......

I hope that you are a bit satisfied...... it can be one of the methods you can do you solution

Read only

Former Member
0 Likes
784

Hi,

Reading a file line by line from Presentation server is not possible.

U need to gather all the data into one internal table and modify the internal

table by looping at the same.

loop at it_table.

it_table-field1 = 'X'.

modify it_table index sy-tabix.

clear it_table.

endloop.

Regards,

GSR.

Read only

Former Member
0 Likes
784

hi all,

if file contains a INT field, which gets filled in a CHAR field of itab,

it gives a error and no uploading occurs..

file should read all data even after it has encountered an error, and store corresponding data.

and if this is not possible using GUI_UPLOAD, can a file in presentation server be read by OPEN DATASET.

thanks a lot.

Read only

0 Likes
784

Hi,

Is ur issue solved ? if yes please close the thread.

If no what type of error it gives, can u copy paste few rows of your file & structure of your internal table.

Regards,

Vaibhav.

Read only

Former Member
0 Likes
785

You can upload the entire file into application server first (using CG3Z) and then make use of :

<opendataset>

Read dataset (between a DO and ENDDO) which will help u to read one line after another.

<closedataset>

Reward points if Helpful