Entering content frame

Formatting data Locate the document in its SAP Library structure

This section shows how you can use internal tables and extracts, using an example of how to format data for display as a list. The data that you format is usually read from database tables or from an external file, or you can create your own generic data in the program. Formatting data for a list usually means sorting it, calculating sums, finding out the number of items, and so on. The example of formatted data shows a list whose output data has been processed like this.

There are two ways of formatting data - during and after data retrieval.

Formatting Data During Retrieval

When you create your own datasets or read data from the database using Open SQL statements, the data may already be sufficiently formatted when you read it.

Formatting Data After Retrieval

When using logical databases to access database tables, when reading data from sequential files, or if the options of Open SQL are not comprehensive enough, the retrieved data often appears in a sequence and structure you need to refine. To refine this data later on, you need to store it in a temporary dataset. The formatting process is independent of the process of retrieving data. The flow of a program that can be directly executed is adapted to this procedure.

ABAP allows you to use internal tables and extracts to save temporary datasets.

Internal Tables

It makes sense to use internal tables whenever the dataset has the same structure as the underlying data structure, and when you want to access individual entries individually.

Extract Datasets

It makes sense to use an extract dataset whenever you want to process large amounts of data entirely and repeatedly.


Formatting Data During Reading

Formatting Data Using Internal Tables

Formatting Data Using Extracts



Leaving content frame