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: 

How to read the last statement of the file.

Former Member
0 Kudos

Hello All

I am using the open dataset command for opening the file from the server,

My requirement is to read the last statement of the file directly, instead of checking the whole file contents.

Can anybody tell me how I can achieve this ??

3 REPLIES 3

Former Member
0 Kudos

Hi Sachin,

Anyway your data will be in internal table only after reading from application server.

Then count the number of records in the internal table by using DESCRIBE into variable 'count'.

Then read that internal table with the index of 'count'.

then it will read the last record of the file.

Regards

Mani

0 Kudos

Hello Mani

I am not transferring the data of the file into internal table.

We can get any structure ( variables fields ) in the file.(it is  Dynamic )

Is there any other way to do that.

former_member209120
Active Contributor
0 Kudos

Hi SACHIN JAIN,

First find the number of records in the file using

DESCRIBE TABLE it_itab LINES wa_lines.

Now read the  last line

read table it_itab index w_lines.