Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

help me pls

Former Member
0 Likes
699

CLEAR lv_index.

LOOP AT lt_vbap INTO ls_vbap.

tmp = sy-dbcnt.

if tmp eq 0.

EXIT.

endif.

lv_index = lv_index + 1.

SELECT SINGLE ETTYP FROM vbep INTO lv_ettyp

WHERE vbeln = ls_vbap-vbeln

AND POSNR = ls_vbap-posnr.

If lv_ettyp = 'CN'.

ls_vbap-UPMAT = 'MRP Blocked'.

APPEND ls_vbap TO lt_vbap.

DELETE lt_vbap INDEX lv_index.

lv_index = lv_index - 1.

tmp = tmp - 1.

ENDIF.

ENDLOOP.

this is my code, i want to exit from the loop stmt when the below condition true.

if tmp eq 0.

EXIT.

endif.

But it is not working, it exits the control from the if contol only.

how can we do this.

Thanks in advance.

Regards

Rajaram

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
677

Hi Rajaram,

This should not happen. Exit will take you out from the LOOP only.

Just check in the debuging the below code.

if tmp eq 0.

write 5.

EXIT.

endif.

Just put a break point on WRITE and see if the control comes there or not.

Regards,

Atish

CLEAR lv_index.

LOOP AT lt_vbap INTO ls_vbap.

tmp = sy-dbcnt.

if tmp eq 0.

EXIT.

endif.

lv_index = lv_index + 1.

SELECT SINGLE ETTYP FROM vbep INTO lv_ettyp

WHERE vbeln = ls_vbap-vbeln

AND POSNR = ls_vbap-posnr.

If lv_ettyp = 'CN'.

ls_vbap-UPMAT = 'MRP Blocked'.

APPEND ls_vbap TO lt_vbap.

DELETE lt_vbap INDEX lv_index.

lv_index = lv_index - 1.

tmp = tmp - 1.

ENDIF.

ENDLOOP.

this is my code, i want to exit from the loop stmt when the below condition true.

if tmp eq 0.

EXIT.

endif.

But it is not working, it exits the control from the if contol only.

how can we do this.

Thanks in advance.

Regards

Rajaram

4 REPLIES 4
Read only

Former Member
0 Likes
678

Hi Rajaram,

This should not happen. Exit will take you out from the LOOP only.

Just check in the debuging the below code.

if tmp eq 0.

write 5.

EXIT.

endif.

Just put a break point on WRITE and see if the control comes there or not.

Regards,

Atish

Read only

0 Likes
677

actually i want to exit from the main loop stmt when the if condition true.

pls give me suggestion.

Thanks in advance,

Regards

Rajaram

Read only

0 Likes
677

Hi Rajaram,

Yes. EXIT will take you out from the main LOOP statement only. Not from IF statement.

Just let me know, when you put a breakpoint on the WRITE statement, does the program stopped there or not..if not then the tmp was never inital.

Or just change

<b>IF tmp IS INITIAL</b> instead of IF tmp = 0.

Regards,

Atish

Read only

Clemenss
Active Contributor
0 Likes
677

Hi Raja,

thank you for using a SUBJECT.

Regards,

Clemens