Relationships between tables increase the power of queries. In QUERY, relationships, or joins, are created automatically when multiple tables are added to the query builder area, if a primary key link or a check table link exists between the tables.
A check table link exists when two tables are linked by foreign key fields. One table assigns some of its fields to be the primary keys of another table, called the check table.
A primary key join is possible when the primary keys in the tables have the same field name, and are of the same data type and field size. The primary is indicated by a key icon . Indexes are indicated by a blue inverted key
.
If a primary key and index key have matching data fields, the application creates automatic joins between the primary key and the index key. The tables must contain the same field name, field size, and be of the same data type.
NOTE: If primary keys are linked, index keys are not joined automatically.
In QUERY, you can create and remove joins if the administrator grants permission to do so. In addition to creating joins on regular tables, you can join cluster and pool tables, and views. You can also join a table to itself.
The administrator must grant permission for all joins. For more information, see Admin options.
NOTE: Automatic and user-created joins appear only on SAP systems where the function module is installed. For all other setups, only single-table downloads are possible.
To create a join between two tables
All downloads from joined tables are by an inner join--all matching records are downloaded.
Important: If you use multiple tables, they must be joined. If the tables that you query are not joined, the query will not run.
To join a table to itself
All downloads from joined tables are by an inner join--all matching records are downloaded.
You can create left outer joins in the QUERY builder. This would allow data to be returned from one table even though there are no matching records in the second table. Note that outer joins can degrade performance.
Recognizing left outer joins
You can recognize a left outer join in QUERY by the join line with an arrow pointing to the left table.
In case two tables are added with left outer joins, the joining arrow may not appear accurately. However, this does not affect the function of the join.
To convert to left outer joins
A warning messages displays stating that converting to left outer join may degrade the performance.
To remove or convert an outer join
Enabling left outer joins
Outer Join retains the data of the table on the left in addition to the mapped fields. You can enable the feature through the following steps:
To delete a join
You can use only one Infoset/SAP query on query builder area at a time. Joining of more than one Infoset/SAP query with tables is not supported.