Show TOC

Obtaining Additional InformationLocate this document in the navigation structure

Use

In some cases, the information that a data source supplies is insufficient. In such cases, new information could be gained by making simple calculations. If, for example, the maximum number of seats and the number of bookings for a particular flight are known, the number of unoccupied seats can be calculated easily. Such information can be useful for different query evaluations.

There are three options available when maintaining infosets for obtaining additional information: Additional Tables, Additional Structures, and Additional Fields.

Procedure

Additional tables read a record from a table. This table's fields can then be evaluated. The keywords that will allow you to choose the record must be provided by the data source. Additional fields allow you to calculate new values from existing information. With this, additional fields have the limitation that they must have a simple (scalar) data type. Additional structures are actually additional fields with a non-scalar type of data. This data type must always be a (flat) structure from the ABAP Dictionary.

In every case it is important to choose the right time for either reading the record or performing the calculation. Here, the 'right time' stands for a table in the logical database. At this time all information necessary to read the record or run the calculation must be available to the system.

Obtaining additional information is thus very much dependent upon these 'times', that is upon the logical databases tables. You can assign as many additional tables, additional structures and additional fields to a logical database table as you want.

The fields from these additional tables and the additional fields themselves are retrieved when the logical database table is filled. Thus they are also contained in the field list that corresponds to the logical database table and can be assigned to a field group just like the table's fields.

Proceed as follows when creating or changing additional information:

  1. On the screen for maintaining InfoSets, choose the table of the data source, for which you wish to maintain additional information, by double clicking.

  2. Choose Extras. Alternatively, you can use the context menu.

The additional information on the selected node is displayed in the top right window.

This window contains the name of the additional information, its type (additional table, additional structure, additional field, code) and a long text.

The window's first column contains a number. This number determines the order in which the code for each individual, additional piece of information within the query is executed.

Note

The sequence numbers of the various individual pieces of additional information do not have to be different. You can find more information about sequence numbers in Creating Additional Fields.

This window also allows you to Define, Change, or Delete additional information. When using Define and Delete, you must place your cursor on the appropriate additional information entry. If you are trying to change an entry's attributes, double-click on it to branch to the additional information maintenance screen.

When connecting additional tables, additional fields and additional structures to logical databases, you must bear in mind the following points:

  • Queries read linked additional tables using the ABAP statement

    SELECT SINGLE * FROM <table> WHERE...

  • You have to specify when to read the additional table.

    You determine this by assigning the additional table to a particular logical database table. For example, it makes no sense to assign the table SCUSTOM (customer data) to the table SPFLI (flight connections) of the logical database F1S, since no meaningful values can be assigned to the key field SCUSTOM-ID (customer number) during the event that processes SPFLI data. Only when processing data from the database table SBOOK (bookings) can you use the customer number and then, for example, retrieve the customer name.

  • You must fill all key fields.

  • You must assign all additional table fields used in queries to a field group in the same way as table fields for a data source of a field group.

    You can link any tables as additional tables, provided they are defined in the ABAP Dictionary and can be read with ABAP Open SQL.

Pay attention to the following when defining additional fields:

  • You must specify when the calculation is to be performed.

    You do this by assigning the calculation to a logical database table. It makes no sense to calculate the number of free seats on a flight from the fields SFLIGHT-SEATSMAX (maximum occupancy) and SFLIGHT-SEATSOCC (occupied seats) when processing the data of the table SPFLI because these fields only contain values at the level of processing for table SFLIGHT.

  • You must specify the ABAP code for the field.

  • You must assign the field to a field group.

Pay attention to the following when defining additional structures:

  • Assign the structure to a node of the data source. You can find all individual fields from the additional structure in this node of the data source. Additional fields offer a simple way of calculating more than one additional field at the same time.

  • Enter a calculation formula.

  • You must assign the fields to a field group.

More Information

The following topics provide information on linking additional tables and defining additional structures and fields:

If you want to provide an InfoSet, which was not created using a logical database, with additions, refer to the procedures in the following sections:

Defining Table Joins,

Reading Tables Directly,

Using Programs to Retrieve Data, and

Special Features.