Regarding LOOP Statement in ABAP
I have small question regarding <b>LOOP ..... ENDLOOP</b> statement against <b>SY-SUBRC</b> Check.
I have a loop as below:
<b> LOOP AT i_vbap WHERE vbeln = i_vbak-vbeln.
IF sy-subrc <> 0.
Is the above <b>Code/Syntax</b> is correct one.
Can we use <b>SY-SUBRC</b> Check against <b>LOOP ... ENDLOOP</b> statement.
Is this the right way of writing the code as per standards.
Can anybody give sujjestions regarding the same.
Thanks in advance.
Thanks & Regards,
Srikanth Kidambi Maruthi replied
The stetements are absolutely right.
what it do is ,
to Check the table I_VBAP has any records for each I_VBAK-VBELN,if so appending the record to I_SDATA. else not doing any thing.
SY-SUBRC Will be 0 only when each VBAK-VBELN, have atleast 1 record in VBAP table. then only it will become 0.