Show TOC

Defining Table Joins with the Help of GraphicsLocate this document in the navigation structure

Prerequisites

On the InfoSet: Title and Database or Create QuickView: Select Data Source screen you selected the data source Table Join ( Using Table).

If the corresponding software requirements have been met, the graphical join definition is the standard setting.

Note

When maintaing InfoSets you can select Start of the navigation path Settings Next navigation step Settings End of the navigation path on the InfoSet: Initial Screen whether you want to define a table join with or without graphical support. Set the relevant flag in the checkbox Graphical Join Definition.

For more information, see Defining Table Joins without the Help of Graphics.

Context

If several tables are all linked within a SELECT statement, this is known as a join. The result set is a table, the lines of which contain all the fields of all the tables used in the join.

The links between the various tables used in the join are all specified separately. You use these conditions to specify which combinations of records from the individual tables are included in the result set.

Table joins must be defined already, before you maintain InfoSets and QuickViews.

Procedure


  1. You are in the Join Definition screen. You can choose from the following functions for defining table joins:

    Inserting a Table

    Add table In the Add Table dialog box, specify the name of the table that you want to add. Choose Continue.

    The table is displayed in a window: The table fields are displayed along with their corresponding long texts. Key fields are marked with a symbol. You can move the position of the window however you like.

    Propose join conditions

    The system proposes the standard default table joins. The proposals are determined from the foreign key dependencies stored in the dictionary, or from the key fields in the tables that are used in the join.

    The join conditions between the individual tables in the join are displayed as lines.

    Create join condition

    Select the field where the join condition starts. Use the Drag&Relate function to join this field with its target field. If the join condition is valid, the join is displayed as a line.

    Define the type of join condition

    You can choose from the following functions when you open the context menu for the join-line:

    • Display Join Condition You get to the Join Condition dialog box. This is where you define the type of join:

      • Internal

        If according to the join conditions of a record in the first table, there is a corresponding record in the second table, this second record is included in the result set also.

      • Left-outer

        All of the records in the first table are included in the result set.

        If, in the second table, there is no record corresponding to a record in the first table, a record containing fields with initial values (blank fields) is used in the second table.

        Note

        We recommend that you do not add additional tables to tables that have been joined using a left-outer join.

    • Delete join condition

    Delete table

    You get to the Delete Table dialog box. Specify the name of the table that you want to delete. Choose Continue.

    Note

    Clicking on the pushbutton that closes the window in the title bar of the table window is another way of removing a table.

    Alias Tables

    The dialog window InfoSet: Alias Names for Tables appears. You use this function if you want to include the same table twice in a join. Choose Create. Specify an alias for the table. You can include the table in your join under both its original name and its alias.

    For more information, see Assigning Additional Tables.

    Check

    The system checks the validity of the join conditions between the tables you have selected, and looks for any tables that have been added but not joined.

    Reference Field

    When you place your cursor on an quantity field or a currency field and choose the Reference field function, the system displays the reference table that contains the corresponding unit of measure or currency for this field.

    Field Documentation

    Select a field from a table. Click on the Field documentation function to display information on the technical definition of a field.

    Two fields sharing the same domain can always be joined.

    Two fields sharing the same data type (including length attributes) in the data dictionary, can also be joined.

    For more information on restrictions and rules governing the use of joins, see Defining Table Joins Without the Help of Graphics.

  2. When you have finished defining a table join, save your work according to the following:

    • Table joins for a QuickView:

      In the Join Definition screen, choose Back.

      The join definition is saved together with your QuickView.

    • Table joins for an InfoSet:

      In the Join Definition screen, choose Back.

      Save your entries on the following screen.

  3. You can change the table join and the join conditions at any time. Choose Join. This takes you back to the Join Definition screen.

    With a table join as a data source for an InfoSet, you can:

    • Delete each table from a table join, provided that no fields from the deleted table are assigned to field groups.

    • Move each table to a different position in the join, so that a different table becomes the first table in the join.

    • Delete all but one of the tables from a table join.

    • Add an extra table to define a table join (with InfoSets that use a single table).

Results

The result of a table join is again a (flat) table. You cannot, therefore, use a table join to analyze hierarchical relationships between tables. We recommend you use logical databases in this case.

For more information see the online documentation on the SELECT ABAP statement.