Skip to Content
0
Jul 31, 2012 at 12:16 PM

combining sy-subrc with other conditions

414 Views

i have a below code..

{}

REFRESH IT_ZVM_MARGIN.

SELECT * FROM ZVM_MARGIN

INTO TABLE IT_ZVM_MARGIN

WHERE MODEL = F_MATKL

AND PERIOD_FROM LE SY-DATUM

AND PERIOD_TO GE SY-DATUM

AND MARGIN_CODE EQ LV_MARGIN_CODE

AND DEALER = WA_VLCVEHICLE-KUNNR

AND MAINTAINED EQ XFLAG_GC.

IF SY-SUBRC = 0 AND IT_ZVM_MARGIN[] IS NOT INITIAL.

{}

in above code i used the combination of sy-subrc with internal table check... is it a wrong coding practice?? and i am not understanding the benefits of two conditions combined together i.e. sy-subrc and checking whether internal table is empty...

what is the difference in below statement performance wise ???

IF SY-SUBRC = 0 AND IT_ZVM_MARGIN[] IS NOT INITIAL.

or

IT_ZVM_MARGIN[] IS NOT INITIAL.

some people say meaning of the above statements is same.. but as per me sy-subrc should be checked...

can u pls guide on the same..

regards,