2007 Jul 14 11:44 AM
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
2007 Jul 14 11:54 AM
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
2007 Jul 14 11:54 AM
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
2007 Jul 14 12:02 PM
actually i want to exit from the main loop stmt when the if condition true.
pls give me suggestion.
Thanks in advance,
Regards
Rajaram
2007 Jul 14 12:05 PM
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
2007 Jul 14 1:30 PM
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |