Entering content frame

This graphic is explained in the accompanying text Example for Views Locate the document in its SAP Library structure

Travel agencies often have to check what customer is booked on what flights (see the Structure link Flight Model). The corresponding data is distributed on several tables:

You can get an overall view of all existing bookings by creating a view on tables SCUSTOM, SBOOK and SPFLI.

You can determine all the bookings in table SBOOK for a customer number (ID) for the customer number in table SCUSTOM. Using the carrier ID (CARRID) and the flight number (CONNID), the flight information can be read from table SPFLI for a booking that is found.

This results in the following join conditions for the view:

SBOOK-MANDT = SCUSTOM-MANDT

SBOOK-CUSTOMID = SCUSTOM-ID

SPFLI-MANDT = SBOOK-MANDT

SPFLI-CARRID = SBOOK-CARRID

SPFLI-CONNID = SBOOK-CONNID

This graphic is explained in the accompanying text

The join conditions can also be derived from the existing foreign key relationships between the tables of the view (see Structure link Foreign Key Relationship and Join Condition).

If you only want to display the customer bookings that were not canceled with the view, you can do this with the selection condition SBOOK-CANCELLED <> ‘X’.

This graphic is explained in the accompanying text

Data Selection with View SCUS_BOOK

A view can be used to select data in an ABAP program.

The following example program determines the existing flight bookings for a customer. The data is selected with view SCUS_BOOK.

This graphic is explained in the accompanying text

Leaving content frame