‎2008 Feb 09 12:30 AM
Hi,
Which is better in performance ? if endif or case endcase?
I have an if endif condition in which i am checking 20 values like
if wa-var1 = '1' OR wa-var = '2' OR
............................................
...........................................
wa-var1 = '19' OR wa-var = '20'.
molga = '26'
endif.
This code is in a userexit and the std application is taking a lot of time to complete.
Would a case endcase help ?
Thanks
Pranati.
‎2008 Feb 09 1:14 AM
It is always advisable to use case endcase as far as possible.
When testing fields "equal to" something, one can use either the nested IF or the CASE statement
The CASE is better for two reasons. It is easier to read and after about five nested IFs the performance of the CASE is more efficient.
‎2008 Feb 09 1:14 AM
It is always advisable to use case endcase as far as possible.
When testing fields "equal to" something, one can use either the nested IF or the CASE statement
The CASE is better for two reasons. It is easier to read and after about five nested IFs the performance of the CASE is more efficient.
‎2008 Feb 10 9:27 PM
Using CASE will not help. When there are only two alternatives (as here) it might take longer.
This statement cannot possibly be the source of the problem.
Rob