Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Regarding LOOP Statement in ABAP

Hi,

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.

  • Some Code

ENDLOOP.

IF sy-subrc <> 0.

APPEND i_sdata.

CLEAR i_sdata.

ENDIF.</b>

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,

Prasad.

Tags:
replied

Hi Prasad,

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.

Regards

Srikanth

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question