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

Reading data from application server based on selection screen

former_member853013
Participant
0 Likes
542

Hi All,

I have a file in application server with 6 million records.

I have to retrieve data from that file based on selection screen.

the following code is what I have used,

********

DO.

READ DATASET p_fname INTO fs_file.

MOVE-CORRESPONDING fs_file TO t_data.

APPEND t_data.

ENDDO.

loop at t_data where kunnr in so_kunnr.

move-corresponding t_data to t_final.

append t_final.

endloop.

****************

reading total data is taking more time.

Is it possible to filter the data at the time of reading only?

Regards,

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
425

Hi Eswar,

There are two ways:

1.

*********

DO.

READ DATASET p_fname INTO fs_file.

MOVE-CORRESPONDING fs_file TO t_data.

if t_data-kunnr in so_kunnr.

APPEND t_data.

else.

clear t_data

ENDDO.

*********

This way you will append only required records.

2.

********

DO.

READ DATASET p_fname INTO fs_file.

MOVE-CORRESPONDING fs_file TO t_data.

APPEND t_data.

ENDDO.

delete t_data where kunnr in so_kunnr.

********

This way you will be left with relevant records.

But in both ways, you will have to read the entire file at least once.

Reward points if useful.

3 REPLIES 3
Read only

Former Member
0 Likes
425

Hi,

While reading the data from application server itself, move the values to an Internal table or work area.

You can filter there itself based on conditions and append the success records to an Internal table.

Avoid using Looping and MOVE-TO CORRESPONDING FIELDS, since its hits a performance Issue.

You can move by fields to an Internal table.

Hope it helps you.

Regards,

Anbalagan

Read only

Former Member
0 Likes
426

Hi Eswar,

There are two ways:

1.

*********

DO.

READ DATASET p_fname INTO fs_file.

MOVE-CORRESPONDING fs_file TO t_data.

if t_data-kunnr in so_kunnr.

APPEND t_data.

else.

clear t_data

ENDDO.

*********

This way you will append only required records.

2.

********

DO.

READ DATASET p_fname INTO fs_file.

MOVE-CORRESPONDING fs_file TO t_data.

APPEND t_data.

ENDDO.

delete t_data where kunnr in so_kunnr.

********

This way you will be left with relevant records.

But in both ways, you will have to read the entire file at least once.

Reward points if useful.

Read only

Former Member
0 Likes
425

Hi,

First declare the internal table with fields in the order of flat file on application server.

This helps in avoiding the MOVE-CORRESPONDING.

Instead you can use MOVE.

MOVE-CORRESPONDING is a performance issue. As you have mentioned that nearly 6 million records are there, it affects severly.

Now follow the logic.

DO.

READ DATASET p_fname INTO fs_file.

MOVE fs_file TO t_data.

APPEND t_data.

ENDDO.

loop at t_data where kunnr in so_kunnr.

move t_data to t_final.

append t_final.

endloop.

Otherwise use the logic given by Mr Sailesh nut put NOT .

DO.

READ DATASET p_fname INTO fs_file.

MOVE fs_file TO t_data.

APPEND t_data.

ENDDO.

delete t_data where kunnr not in so_kunnr.

This will put only selected values in internal table.

Hope this is clear.

Reward points if helpful.

Thanks and Regards.