Show TOC

 Creating a Database ViewLocate this document in the navigation structure

Procedure
  1. Enter an explanatory short text in the field Short text.

    You can for example find the view at a later time using this short text.

  2. In column Tables on the Tables/Join conditions tab page, define the tables you want to include in the view
    Caution

    You can include only transparent tables in a database view.

  3. Link the tables with join conditions .

    If there are suitable foreign keys between the tables, you must copy the join conditions from these foreign keys. For more information, see Foreign Key Relationships and Join Conditions .

    1. Position the cursor on a table name and choose Relationships.

      All foreign keys to other tables defined for this table are displayed.

    2. Select the foreign keys and choose Copy.

      The join condition is now derived from the definitions in the foreign key.

      If you want to see only the foreign key relationship existing between two tables, you must first select these two tables by clicking on the first column of the input area Tables and then choosing Relationships.

  4. On the View fields tab page, select the fields that you want to copy to the view.
    1. Choose Table fields.

      All the tables contained in the view are displayed in a dialog box.

    2. Select a table.

      All the fields contained in this table are displayed.

    3. To copy fields, select the corresponding indicators and choose Copy.

    You can also include an entire table in the view. For more information, see Includes in Database Views .

  5. On the Selection conditions tab page, you can (optionally) formulate restrictions for the data records to be displayed with the view. For more information, see Maintaining Selection Conditions for Views .

    The selection conditions define the data records that can be selected with the view.

  6. By choosing Goto → Technical settings, you can (optionally) maintain the technical settings of the database view.

    You can define whether and how the database view is buffered here. Proceed as for the technical settings of a table. For more information, see Maintaining Technical Settings .

    Note

    Only the settings for buffering can be maintained for database views.

  7. On the Maintenance status tab page, select the maintenance status of the database view.
    Note

    If the view contains more than one table, the maintenance status read-only cannot be altered.

  8. Choose  with the quick info text Save.

    You are asked to assign the view to a package.

    You can change this package later by choosing Goto → Object directory entry.

  9. Choose  with the quick info text Activate.
Result

When a database view is activated, the system automatically creates the corresponding view in the database if the base tables of the view were already created there.

At activation, a log is written. It can be displayed with Utilities → Activation log. If errors or warnings occur when the view is activated, the system displays them directly in the activation log.

If the base tables are not yet created in the database, this is recorded in the activation log. The view is nevertheless activated in the ABAP Dictionary. In this case you can create the relevant view on the database later with the database utility.

Additional Options

  • Create documentation:

    You can create information about using the view with Goto → Documentation. This documentation is also output for example when you print the view.

  • Change data element of a view field:

    Select the Mod (Modify) column in the View fields tab page. The Data element field is now ready for input. You can enter a data element that refers to the same domain as the data element of the assigned table field here. Cancel the Mod flag if you want to use the data element of the assigned table field again.

  • Display view data:

    With Utilities → Contents you can determine which data can be selected with the view.

  • Display create statement:

    With Extras → Create statement you can display how the view was created in the database. The system displays the statement that was executed when the version of the view you are currently editing was created in the database.

  • Check the definition of the view in the database:

    With Utilities → Database object → Check you can determine whether the definition of the view in the database is consistent with the active version of the view. With Utilities → Database object → Display you can display the definition of the view in the database.

  • Check the runtime object of the view:

    With Utilities → Runtime object → Check you can determine whether the definition of the view in the ABAP Dictionary maintenance screen is identical to the specifications in the runtime object of the view. With Utilities → Runtime object → Display you can display the runtime object of the view.

See also:

Database Views