Iteration Through Element Content
Use
Activate this option in the Attributes display for the BSP element if this element is to run through its own content repeatedly, that is, it should implement a loop.
Procedure
In addition to activating this option, you must also redefine the interface method DO_AT_ITERATION of the element handler class.
This method is called each time at the end of an iteration. Using the return parameter , you control whether the loop is ended ( RC=CO_ELEMENT_DONE ) or run through once again ( RC=CO_ELEMENT_CONTINUE).
Example
Let us assume that you wish to have a repeated text call with a simple <do>-Element. The number of iterations is set through the corresponding attribute howOften.
Example:
<loops:do howOften = "10">
Hello World !
</loops:do>
The value of the attribute howOften is used at the beginning of the element call in the method DO_AT_BEGINNING in order to initialize the loop counter count:
method IF_BSP_ELEMENT~DO_AT_BEGINNING .
if howOften > 0.
count = howOften - 1.
rc = CO_ELEMENT_CONTINUE.
else.
rc = CO_ELEMENT_DONE.
endmethod.
The implementation of DO_AT_ITERATION could look like this:
method IF_BSP_ELEMENT~DO_AT_ITERATION .
if count <> 0.
count = count - 1.
rc = CO_ELEMENT_CONTINUE.
else.
rc = CO_ELEMENT_DONE.
endif.
endmethod.