2005 Feb 10 4:04 PM
Howdy again,
Just a quick question:
I've got the following loop:
<b>loop at bool_data-bseg into bseg.
check bseg-bukrs = '4001'.
loop at itab_setleaf_type.
check bkpf-blart LE itab_setleaf_type-valto.
endloop.
loop at itab_setleaf_vend.
check bseg-lifnr LE itab_setleaf_vend-valto.
endloop.
endloop.</b>
for the two loops within the main loop I weant the program to go onto the next record in the main loop.
Would using check do this - I don't think so...
Does anyone know a command that would?
Thanks!
2005 Feb 10 4:32 PM
As Jeet pointed out, EXIT inside a LOOP will terminate the LOOP and continue executing at the next statement following ENDLOOP.
For reference, I will call your loops - 1, 2 and 3.
So in loop 2, if you EXIT, then execution would continue with loop 3.
If you want the EXIT in loop 2 to skip loop 3 and continue loop 1, then you will need a flag.
For example:
LOOP 1
Flag = 'Y'.
LOOP 2.
IF ...
Flag = 'N'.
EXIT.
ENDIF.
ENDLOOP.
IF Flag = 'N'.
CONTINUE.
ENDIF.
LOOP 3.
IF ...
EXIT.
ENDIF.
ENDLOOP.
ENDLOOP.
Howdy again,
Just a quick question:
I've got the following loop:
<b>loop at bool_data-bseg into bseg.
check bseg-bukrs = '4001'.
loop at itab_setleaf_type.
check bkpf-blart LE itab_setleaf_type-valto.
endloop.
loop at itab_setleaf_vend.
check bseg-lifnr LE itab_setleaf_vend-valto.
endloop.
endloop.</b>
for the two loops within the main loop I weant the program to go onto the next record in the main loop.
Would using check do this - I don't think so...
Does anyone know a command that would?
Thanks!
2005 Feb 10 4:13 PM
Hello,
The following code will take away lots of performance.
First of all you can use LOOP AT ITAB where <Condn>
Then the CHECK can be replaced by IF ... ENDIF.
Please derive the program logic as per the need. I hope the above points helps you.
Regards, Murugesh AS
2005 Feb 10 4:21 PM
Steve,
I agree with Murugresh on the performance part.As far as coming out of inner loop use EXIT statement with if conditions. (Will come out only from inner loop.)
Jeet
2005 Feb 10 4:32 PM
As Jeet pointed out, EXIT inside a LOOP will terminate the LOOP and continue executing at the next statement following ENDLOOP.
For reference, I will call your loops - 1, 2 and 3.
So in loop 2, if you EXIT, then execution would continue with loop 3.
If you want the EXIT in loop 2 to skip loop 3 and continue loop 1, then you will need a flag.
For example:
LOOP 1
Flag = 'Y'.
LOOP 2.
IF ...
Flag = 'N'.
EXIT.
ENDIF.
ENDLOOP.
IF Flag = 'N'.
CONTINUE.
ENDIF.
LOOP 3.
IF ...
EXIT.
ENDIF.
ENDLOOP.
ENDLOOP.
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |