‎2009 Mar 10 3:15 PM
Hi.
I have a item master data table and a transaction table.
For a given criteria I have to find items from master data table which do no exits in transaction table.
I have listed my flow below, can you please advice if there is any other optimal way of doing it.
1. For the given criteria read items from master data table into internal table 1. Sort the internal table 1.
2. For the given criteria read items from transaction table into internal table 2. Sort and remove duplicates from the internal table 2.
3. Loop at internal table 1, and check if item exists in internal table 2. Append items not in internal table 2 into another internal table 3.
At the end internal table 3 will have the items I am interested in. I can sort and use binary search addition, but is there any other efficient way of doing this task.
Thank you,
CD
‎2009 Mar 11 10:32 AM
Don't use standard tables !!!!!!! They are o.k. in old coding in new coding you should
use only sorted and hashed tables and performance works automatically !!!
Forget about sorting and deleting duplicates !
> remove duplicates from the internal table 2.
use a hashed table with a unique key and collect you entries in the hash table,
Use sorted tables if the key is non-unique, or if the need also parts of the key!
Use hashed tables if the key must be unique.
Even for the append it is possible to APPEND into a sorted table, the records must come in a sort
order, i.e. if they come from a sorted table then it is o.k.
What I write is not imagination but the only really commendable way of handling internal tables.
Siegfried
‎2009 Mar 10 3:18 PM
‎2009 Mar 10 3:21 PM
Thanks, both master and transaction table are very large,
Though I will as much selections I can while loading internal table,
But just want to figure out if there is any better alogorithm to do this task.
thanks,
CD
‎2009 Mar 10 3:28 PM
Your flow is correct . Go ahead . To avoid Performance Issues try to get the values of all the key fields of the table from the user via Selection Screen , so that your DB fetch will be faster . Looping and finding out the odd with not take much time.
‎2009 Mar 10 3:30 PM
Moved to the proper forum.
Also please try to use an informative subject.
Rob
‎2009 Mar 11 10:32 AM
Don't use standard tables !!!!!!! They are o.k. in old coding in new coding you should
use only sorted and hashed tables and performance works automatically !!!
Forget about sorting and deleting duplicates !
> remove duplicates from the internal table 2.
use a hashed table with a unique key and collect you entries in the hash table,
Use sorted tables if the key is non-unique, or if the need also parts of the key!
Use hashed tables if the key must be unique.
Even for the append it is possible to APPEND into a sorted table, the records must come in a sort
order, i.e. if they come from a sorted table then it is o.k.
What I write is not imagination but the only really commendable way of handling internal tables.
Siegfried