What is Loops on an internal table

Basic form

LOOP AT itab.
LOOP AT itab INTO wa.

Additions

1. ... FROM n1
2. ... TO n2
3. ... WHERE logexp
4. ... TRANSPORTING NO FIELDS

Effect

Processes an internal table (DATA ) in a loop which begins with LOOP and ends with END LOOP . Each of the internal table entries is sent to the output area in turn.When LOOP AT itab. is used, the header line of the internal table itab is used as output area. In the case of LOOP AT itab INTO wa , there is an explicitly specified work area wa .

If the internal table is empty, all the statements between LOOP and ENDLOOP are ignored. In each loop pass, SY-TABIX contains the index of the current table entry. After leaving a LOOP , SY-TABIX has the same value as it had before. Inserting and/or deleting lines in a LOOP affects subsequent loop passes.

You can use the CONTINUE statement to leave the current loop pass prematurely and continue with the next loop pass. To leave loop processing altogether, you use EXIT . At the end of loop processing (i.e. after ENDLOOP ), the return code value of SY-SUBRC specifies whether the loop
was actually processed.

SY-SUBRC = 0 The loop was executed at least once.
SY_SUBRC = 4 The loop was not executed, either because there was no entry at all or because there was no entry which satisfied the conditions.

Example

The table T is defined as follows:

DATA: BEGIN OF T OCCURS 100,
BAREA(2), BLNCE TYPE P,
END OF T.
After the table has been filled with data (using APPEND ), it is
then output:
LOOP AT T.
WRITE: / T-BAREA, T-BLNCE.
ENDLOOP.

If an internal table is processed only on a restricted basis (with the additions FROM , TO and /or WHERE ), you should not use the control structures for control break processing because the interaction of a restricted LOOP and the AT statement is undefined at present.

If SUM is used in a LOOP and an explicit output area wa has also been specified, this output area must be compatible with the line type of the internal table itab .(91.4)

What is a Idoc?
Outbound process overview
Outbound process via message control
EDI outbound process
EDI inbound process overview

No comments :

Post a Comment