2009 Feb 04 11:25 AM
Moderator message: please use a more meaningful subject in future
Hi,
I've a internal table it_po with structure as follows,
po no , po item , vendor , quantity.
I want to get unique list of vendors in another internal table it_vendors from above table. Kindly suggest me which approach is better,
1. Declare it_vendors containg only one field vendor.
loop at it_po.
append all vendors found in table it_vendors
endloop.
sort it_vendors by vendor code.
delete adjacent duplsicates from it_vendors comparing vendor code.
2. declare it_vendors with structre same as it_po.
it_vendors[] = it_po[].
sort it_vendors by vendor code.
delete adjacent duplsicates from it_vendors comparing vendor code.
First approach will consume less memory as it has less no. of fields .
second approach will execute fast.
Kindly advice.
Edited by: Matt on Feb 4, 2009 1:25 PM
2009 Feb 04 11:30 AM
Hello Mac,
First approach will consume less memory as it has less no. of fields .
second approach will execute fast.
You have answered one-half of your question. I dont think having 10-15 extra fields doesnot cost you much memory.
My personal opinion is: "Execution time should be less" )
Awaiting other replies.
BR,
Suhas
2009 Feb 04 11:30 AM
Hello Mac,
First approach will consume less memory as it has less no. of fields .
second approach will execute fast.
You have answered one-half of your question. I dont think having 10-15 extra fields doesnot cost you much memory.
My personal opinion is: "Execution time should be less" )
Awaiting other replies.
BR,
Suhas
2009 Feb 04 11:32 AM
Hi,
Follow the 2nd approach. It'll be better than first one.
2009 Feb 04 11:33 AM
well in general whenever we talk of performance. its always trade off between memory and execution time and we always choose to save execution time. so no need to have second thoughts about it.
кu03B1ятu03B9к
2009 Feb 04 11:33 AM
From performance point of view definitely approach 2 would be better...
2009 Feb 04 11:34 AM
HI ,
I would like you to advise to follow second option .Since there is a orderly manner of deleting duplicates in it .
(In business point of view a same vendor can be there at 2 places since the material that was procurred from him will be for different work center or added for diff cost center ..
In COMPARING ADDITION please provide some more key fields to have a narrow values .)
2009 Feb 04 11:53 AM
Either first or Second ,
Because if your Logic Continues further and fetches more data u should go for one which consumes less memory.
If Your data is not huge, then go for the one whcih executes faster.
After all u r searching for overall performance ,not only to this block of code act accordingly.