This tutorial video provides a comprehensive guide on how to use the LOOP statement in SAP ABAP. The LOOP statement is an iterative statement that performs a block of codes repeatedly until it satisfies an exit criteria. The video covers how to create a structure, an internal table, a work area, and how to update these with entries. It also explains how to display data from an internal table on the output screen using the LOOP statement.
Key topics covered in the video session:
- Creating a Structure and Internal Table: The video starts by explaining how to create a structure, an internal table, and a work area. The work area can hold only one record at a time, while the internal table can hold multiple records. To append a record into an internal table, you first need to fill your work area and then append that work area into the internal table.
- Updating the Work Area: The tutorial demonstrates how to update the work area with some entries and then append that work area into the internal table. After updating the entry in the internal table, the work area is cleared to make it ready for new values.
- Displaying Data from Internal Table: The video then moves on to explain how to display data from the internal table on the output screen. This is done using the LOOP statement. The LOOP statement performs a block of statements continuously until it reaches the end of the data in the internal table.
- Writing the LOOP Statement: The tutorial provides a detailed explanation on how to write the LOOP statement. The LOOP statement is used to read each record from the internal table and write it on the output screen. The LOOP statement will continue to execute until there are no further records available in the internal table.
- Printing Records on the Output Screen: The video demonstrates how to print records on the output screen using the WRITE statement. The WRITE statement is used to print each column information on the output screen.
- Understanding the LOOP Iteration: The tutorial explains how the LOOP iteration works. When the LOOP statement is executed, it assigns the first line into the work area. Using this work area, it reads each column information and writes it on the output screen. The system will then move to the next record and perform the same operation until it reaches the end of the records in the internal table.
- Next Steps – Select Statement: The video concludes by mentioning that the next topic to be covered is the SELECT statement. In real scenarios, data is not manually inserted into the internal table. Instead, data is fetched from some database tables into the internal table, and operations are performed on top of it. This will be covered in the next tutorial.