ABAP Data/Internal Tables. ITP 321 Anthony Borquez & Jim Graver. Examples of Data Types and Objects. This example shows how to declare elementary data objects with reference to predefined ABAP types. PROGRAM demo_elementary_data_objects.
Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.
Anthony Borquez & Jim Graver
This example shows how to declare local elementary data types within a program.
The SELECT clause defines the structure of the data you want to read, that is, whether one line or several, which columns you want to read, and whether identical entries are acceptable or not.
The INTO clause determines the target area <target> into which the selected data is to be read.
The FROM clause specifies the database table or view <source> from which the data is to be selected. It can also be placed before the INTO clause.
The WHERE clause specifies which lines are to be read by specifying conditions for the selection.
GROUP BY <fields>
The GROUP-BY clause produces a single line of results from groups of several lines. A group is a set of lines with identical values for each column listed in <fields>.
The HAVING clause sets logical conditions for the lines combined using GROUP BY.
ORDER BY <cond>
The ORDER-BY clause defines a sequence <fields> for the lines resulting from the selection.
When you read several lines of a database table, you can place them in an internal table. To do this, use the following in the INTO clause:
SELECT ... INTO|APPENDING [CORRESPONDING FIELDS OF] TABLE <itab>[PACKAGE SIZE <n>] ...
The same applies to the line type of <itab>, the way in which the data for a line of the database table are assigned to a table line, and the CORRESPONDING FIELDS addition as for flat work areas (see above).
The internal table is filled with all of the lines of the selection. When you use INTO, all existing lines in the table are deleted. When you use APPENDING; the new lines are added to the existing internal table <itab>. With APPENDING, the system adds the lines to the internal table appropriately for the table type. Fields in the internal table not affected by the selection are filled with initial values.
This example uses a flat structure with the same data type as the database table SPFLI as the target area in a SELECT loop. Within the loop, it is possible to address the contents of the individual columns.