ABAP Cursosentenciadoenddo
<html>
<head> <title>DO .. ENDDO</title> </head> <BODY BGCOLOR="#000000" TEXT="#FFFFFF" LINK="#0099FF" VLINK="#AA0000"> <p align="left">⚠ <b><span class="titulo">DO .. ENDDO</span>⚠ </b></p>
<p align="left">⚠ <b>Definicin⚠ </b></p>
<p align="left">Ejecucin de sentencias indefinidamente hasta
que se procese la sentencia⚠ <a href="exit.htm" tppabs="exit.htm">EXIT⚠ </a>,⚠ <a href="stop.htm" tppabs="stop.htm">STOP⚠ </a>o⚠ <a href="reject.htm" tppabs="reject.htm">REJECT⚠ </a>.</p>
<p align="left">⚠ <b>Sintaxis:⚠ </b></p>
<bloque-de-sentencias>
ENDDO.</pre>
<p>La sentencia DO sin clusulas ejecuta el bloque de sentenciasindefinidamente, o hasta que se procese una sentencia⚠ <a href="exit.htm" tppabs="exit.htm">EXIT⚠ </a>,⚠ <a href="stop.htm" tppabs="stop.htm">STOP⚠ </a>o⚠ <a href="reject.htm" tppabs="reject.htm">REJECT⚠ </a>. Para limitar el nmero de pasos de un bucle se puede utilizar la opcin TIMES. <n> puede ser un literal o una variable. Si <n> es 0 o negativo, el sistema no procesar el bucle.</p>
<ul>
<li>La clusula ENDDO es obligatoria (marca el fin del bloque
de sentencias). La variable SY-INDEX contiene el nmero de veces que el bucle
ha sido ejecutado.</li>
<li>Utilizando la opcin VARYING se pueden ir asignando valores
a una variable <c> a partir de un conjunto de campos del mismo tipo
y longitud de memoria por cada paso de bucle. En una sentencia DO se pueden
utilizar varias opciones VARYING.</li>
</ul>
<p>⚠ <b>Ejemplo:⚠ </b></p>
<pre>DO.
WRITE: / 'SY-INDEX - Inicio:', (3) SY-INDEX.
IF SY-INDEX = 10.
EXIT.
ENDIF.
WRITE: 'Fin:', (3) SY-INDEX.
ENDDO.</pre>
<span>⚠ <b>Vase tambin:⚠ </b> ⚠ <a href="while_endwhile.htm" tppabs="while_endwhile.htm">WHILE⚠ </a>,
⚠ <a href="stop.htm" tppabs="stop.htm">STOP⚠ </a>, ⚠ <a href="exit.htm" tppabs="exit.htm">EXIT⚠ </a>, ⚠ <a href="reject.htm" tppabs="reject.htm">REJECT⚠ </a>.
</span>
</body>
</html>