‎2007 Jul 19 1:17 PM
Hi
Please let me know if I am using CHECK statement within a loop instead of IF,ELSE; will it affect the performance of the program.
Ideally, which is better way to code with check or if.
Regards
Amit.
‎2007 Jul 19 1:23 PM
hi
u can check examples in the SAP system. that is probably the best way to have the comparison test for performance. for that u plz go to se11. in that
<b>ENVIROMNMENT->EXAMPLES->PERFORMANCE EXAMPLES</b>
regards
ravish
<b>plz dont forget to reward points if helpful</b>
‎2007 Jul 19 1:20 PM
Hi,
CHECK statement will have better effect.
Since when you use IF ENDIF, ENDLOOP statement has to be executed
where as CHECK if fails comes back to first statement in the loop for the next loop pass.
<b>But the differnece is only very less since these days most of the application servers are good in performance and CHECK and IF both will be processed in the application servers Work process there is not much difference but if you ask in minute levels CHECK Is better.
But careful to use it as it skips all the code below that statement.</b>
Regards,
Sesh
‎2007 Jul 19 1:21 PM
Hi amit,
If there is only one IF statement , then you can use CHECK statement instead of IF
if you have to IF ..ELSEIF ..ENDIF, then there is no other way you have to use If instead of CHECK
performance wise both are sam i guess
‎2007 Jul 19 1:21 PM
Hi Amit,
Yes CHECK gives u more performance that in using IF...ENDIF.
Ideally you should be using more of CHECK than IF...ENDIF. but circumstances can impact your usage.
Kiran
‎2007 Jul 19 1:22 PM
‎2007 Jul 19 1:23 PM
hi
u can check examples in the SAP system. that is probably the best way to have the comparison test for performance. for that u plz go to se11. in that
<b>ENVIROMNMENT->EXAMPLES->PERFORMANCE EXAMPLES</b>
regards
ravish
<b>plz dont forget to reward points if helpful</b>
‎2007 Jul 19 1:26 PM
Hi...
Performance should be about the same...
You can try your code out from SE30 ABAP Runtime Analysis... choose the 'Tips & Tricks' button... enter your code and execute it...
Dave...
Message was edited by:
Dave Taranovich
‎2007 Jul 19 1:30 PM
Performance wise it may be better...helping make programs maintenable it's not. When for example, inside a loop there's a lot of code, I think IF...ELSE is better for that reason. Using IF helps to understand logic easily, specially for people new to ABAP.
My two cents.
‎2007 Jul 19 1:35 PM
HI
Check statement would be performane oriented.
If you use the CHECK <expr> statement within an event block but not within a loop, and the condition <expr> is not fulfilled, the system exits the processing block immediately.
<expr> can be any logical expression or the name of a selection table. If you specify a selection table and the contents of the corresponding table work are do not fulfill the condition in the selection table, it is the same as a false logical expression.
If the CHECK statement occurs in a loop using DO, WHILE, or LOOP, it is the loop that terminates, not the processing block.
Within a GET event block, this means the next GET event at the same hierarchical level. When it leaves the event block, the logical database reads the next line of the current node, or the next-highest node if it has already reached the end of the hierarchy level. Nodes that are lower down in the hierarchical structure of the logical database are not processed.
Inside GET events, you can use an extra variant of the CHECK statement:
CHECK SELECT-OPTIONS.
This statement checks the contents of the table work area of the current node against all selection tables linked to that node.
Note that CHECK statements for checking database contents in GET events are only processed after the data has been read from the logical database. For performance reasons, you should therefore avoid using checks of this kind. Instead, try to check before the data is read, for example, by using dynamic selections.
‎2007 Jul 19 4:37 PM