2007 May 29 5:41 AM
Hi,
Do we have to check for sy-subrc & is intial chek before every READ or Select Statement.
At which points can we ignore these checks.
2007 May 29 6:27 AM
hi sneha,
good question...
yes it is necessary to check sy-subrc = 0 after READ statement else it will return a garbage value...
it is a good habbit of checking sy-subrc = 0 after read statement...
In case of check initial statement, it should be check when u are using FOR ALL ENTRIES on particular internal table....bcoz if u don't use check statement before using FOR ALL ENTRIES select query it will result in a performance issue.
hope this would solve your problem..
please reward points in case usefull..
regards,
Prashant
2007 May 29 5:43 AM
its a good practice on checking the sy-subrc for each read statement and select statements
checking the sy-subrc shows a good way of programming.
Regards
Gopi
2007 May 29 5:46 AM
for select stamt,
it will eliminate infinite loop.
like
if i_mara is not initial.
select maktx from makt into tabke i_makt
for all entries in i_mara
where matnr = i_mara-matnr.
endif.
Regards
Peram
2007 May 29 5:44 AM
if we are using for an entries statement in our select then we need to check for is initial statement and also in case if you are using any selection screen parameters also we need to check is initial statement. Yes for good programming practice we need to check for the sy-subrc statement after the read and select statement.
Regards,
Santosh
2007 May 29 5:49 AM
Hi,
IF condition after READ statement is not mandatory. If there is no record retrieved after READ statement & you want to process further then do not give IF statement.
IS INITIAL should be checked if you are using the internal table FOR ALL ENTRIES. before using FOR ALL ENTRIES, you should check whether the internal table is blank.
Best regards,
Prashant
2007 May 29 5:52 AM
Hi Sneha,
It should be checked AFTER every read and select statement.
Regards,
Atish
2007 May 29 6:27 AM
hi sneha,
good question...
yes it is necessary to check sy-subrc = 0 after READ statement else it will return a garbage value...
it is a good habbit of checking sy-subrc = 0 after read statement...
In case of check initial statement, it should be check when u are using FOR ALL ENTRIES on particular internal table....bcoz if u don't use check statement before using FOR ALL ENTRIES select query it will result in a performance issue.
hope this would solve your problem..
please reward points in case usefull..
regards,
Prashant
2007 May 29 3:38 PM
hi
it is good if u check sy-subrc value after read and select statement.it will reduces the performence issues.so it always a good habit of checking it.
we should check the itab is initial or not before using the for all entries.y beacause if the itab1 doesnot have any entries in it then itab 2 will be populated for all the values in itab1 irrespective of ur condition.
that is why its always a good habit to check sy-subrc and check intial when required.
hope this clear ur doubt.
regards
jyo