How the System Transfers Data Values 

With the LOOP AT <internal table> statement, the screen table need not be declared as the internal table. Screen tables can also be database tables, structures or other program fields. If you don’t define the screen table as an internal table, you must make sure that the correct fields are moved to and from the internal table header as needed during looping.

Note also that the fields you use in the screen table may be only a subset of the corresponding dictionary or internal table fields. The system transfers fields as needed in the screen table. Processing (in detail) is as follows:

  1. A row of the internal table is placed in the header area.
  2. All loop statements are executed for that row.
  3. Loop statements are most often calls to ABAP modules. Where necessary, these modules should move the internal table fields to the relevant program fields (dictionary table or other fields).

    Example transaction TZ60 does this in the DISPLAY_FLIGHTS routine:

    MODULE DISPLAY_FLIGHTS OUTPUT.
      SFLIGHT-FLDATE = INT_FLIGHTS-FLDATE.
      SFLIGHT-PRICE = INT_FLIGHTS-PRICE.
      SFLIGHT-CURRENCY = INT_FLIGHTS-CURRENCY.
      SFLIGHT-PLANETYPE = INT_FLIGHTS-PLANETYPE.
      SFLIGHT-SEATSMAX = INT_FLIGHTS-SEATSMAX.
      SFLIGHT-SEATSOCC = INT_FLIGHTS-SEATSOCC.
    ENDMODULE.

  4. The system transfers values from the program fields to the screen fields with the same names.
  1. A row of the internal table is placed to the internal table header area.
  2. All screen table fields are transferred to the ABAP program fields with the same names.
  3. All loop <actions> are executed for the current internal table row.

Again, <actions> is usually a call to an ABAP module. Where necessary, this module should first move the program field values to the header area for the internal table. This step overwrites data values from the internal table with those from the screen. Step 1 is necessary for cases where the screen table fields are only a subset of the fields defined for the internal table. If you want to update the internal table with new screen values, you must have the original table row as a basis in the header area.

Remember: If you want to update the internal table with the contents of the header area, use the MODIFY statement in the ABAP module. The system does not automatically do it for you.

Note that there is a screen language MODIFY statement and an ABAP MODIFY statement. Do not use the screen language MODIFY to update internal tables.