‎2008 Mar 27 2:04 PM
Hi, can You please tell me how to exit loop for one record , eg. IF condition is not OK leave this record and continue loop.
EXIT command dont help me, is there any other?
LOOP AT lt_s941 INTO ls_s941.
if ( ls_s941-bwart = '101' And ls_s941-lgort = '' ) or
( ls_s941-bwart = '101' And ls_s941-lgort = '0001' And
ls_s941-wzubb = 0 ).
??? -here how to exit loop-???
MOVE-CORRESPONDING ls_s941 TO wa_outtab.
SELECT SINGLE matnr mtart FROM mara INTO (lv_matnr, lv_mtart)
WHERE matnr = ls_s941-matnr.
MOVE: lv_mtart TO wa_outtab-mtart.
select single maktx from makt into wa_outtab-maktx
where matnr = ls_s941-matnr and spras = 'd'.
select single bklas from mbew into wa_outtab-bklas
where matnr = ls_s941-matnr and bwkey = ls_s941-werks.
IF ls_s941-spmon < p_datum-low.
wa_outtab-kolps = ls_s941-ntgew.
if ls_s941-wzubb < 0.
wa_outtab-vredps = ls_s941-wzubb * -1.
endif.
if ls_s941-wzubb > 0.
wa_outtab-vredps = ls_s941-wzubb.
endif.
endloop.
‎2008 Mar 27 2:11 PM
Hi,
Use check or continue commands as like follows.
loop at itab.
check < condition >.
endloop.
or
loop at itab.
if <condition>.
continue.
endif.
endloop.
Regards,
Sankar.
‎2008 Mar 27 2:06 PM
‎2008 Mar 27 2:08 PM
‎2008 Mar 27 2:08 PM
Hi,
You can do as below :
LOOP AT lt_s941 INTO ls_s941.
if ( ls_s941-bwart = '101' And ls_s941-lgort = '' ) or
( ls_s941-bwart = '101' And ls_s941-lgort = '0001' And
ls_s941-wzubb = 0 ).
continue. "Use collect statement
Thanks,
Sriram Ponna.
‎2008 Mar 27 2:11 PM
Hi,
Use check or continue commands as like follows.
loop at itab.
check < condition >.
endloop.
or
loop at itab.
if <condition>.
continue.
endif.
endloop.
Regards,
Sankar.