‎2008 May 30 10:14 AM
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,
‎2008 May 30 11:14 AM
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.
‎2008 May 30 10:30 AM
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
‎2008 May 30 11:14 AM
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.
‎2008 May 30 12:04 PM
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.