unit 3 - transparent tables in the abap dictionary

30
Unit 3: Introduction to the ABAP Dictionary

Upload: dubon07

Post on 13-Apr-2017

116 views

Category:

Software


5 download

TRANSCRIPT

Page 2: Unit 3 - Transparent tables in the ABAP Dictionary

• In this lesson you will get an overview of data modeling, which has to be done before the application development. Furthermore, you will learn about the basic descriptive elements in the ABAP Dictionary.

•You will also find out when and why it is appropriate to use data types (data descriptions) from the ABAP Dictionary.

Lesson: Data Modeling and Descriptive Elements in theABAP Dictionary

Lesson Overview

Page 3: Unit 3 - Transparent tables in the ABAP Dictionary

•When you define data objects in your ABAP program, you should use the advantages of the ABAP Dictionary.

Business Example

Page 5: Unit 3 - Transparent tables in the ABAP Dictionary

• In the development of business application software, parts of the real world must be represented in data form.

•We refer to an Entity Relationship Model (ERM).

•You use this data model as the basis for implementing appropriate table definitions (transparent tables) including their relationships with each other in the ABAP Dictionary.

Page 6: Unit 3 - Transparent tables in the ABAP Dictionary

FlightSchedule

Flight

Airport

SalesOffice

TravelAgency

FlightBooking

City

City-AirportAssignment

FlightCustomer

Airline

Relational Data Model(FlightDataModel)

Page 7: Unit 3 - Transparent tables in the ABAP Dictionary

Working with the Object Navigator

•The flight data model contains entities for all business information that is logically connected, such as:

•Cities•Airports•Airlines•Flight routes•Flights• . . .

Page 8: Unit 3 - Transparent tables in the ABAP Dictionary

These entities all relate to each other in certain ways:•Each flight schedule contains exactly one airline, one departure airport,

and one destination airport.•Each bookable flight always belongs to exactly one existing flight

schedule.•Assignments can be set between cities and nearby airports.

Page 9: Unit 3 - Transparent tables in the ABAP Dictionary

MANDT CURRCODECARRID URLCARRNAME

SCARR

MANDT AIRPFROMCARRID AIRPTOCONNID

SPFLI

DEPTIME …

MANDT FLDATECARRID SEATSMAXCONNID

SPFLI

SEATSOCC …

MANDT FLDATECARRID BOOKIDCONNID

SPFLI

CUSTOMID COUNTER …

Implementation Using Transparent Tables

Page 10: Unit 3 - Transparent tables in the ABAP Dictionary

•For each entity fixed in the data model, the developer creates a transparent table in the ABAP Dictionary.

•This is merely a platform-independent description of a database table, not the database table itself.

•A transparent table contains different fields (columns) to allow you to store and manage data records in a structured way.

Page 11: Unit 3 - Transparent tables in the ABAP Dictionary

•You have to declare table fields as key fields when their content is to be used for the clear identification of data records.

•The key value of a data record is a unique ID within the table.

Page 12: Unit 3 - Transparent tables in the ABAP Dictionary

•Before we deal with the transparent table, we must first explain two other Dictionary terms: data element and domain.

Descriptive Elements in the ABAP Dictionary

Page 13: Unit 3 - Transparent tables in the ABAP Dictionary

•A data element is a total description of a field. This includes the semantic as well as the technical field attributes.

•The technical field attributes such as data type and field length are usually not specified in the actual data element but by means of a reference to a domain.

•Data elements can be used for defining program-internal variables or for describing fields of transparent tables.

Page 14: Unit 3 - Transparent tables in the ABAP Dictionary

Short Descriptions Short text for Airline

Documentation……

File IDAirline / Airline / …

Data TypeReference domain

S_CARR_ID

Search Help…

Data Elements S_CARR_ID

FormatCHAR 3

Value Range…

DOMAIN

Data Element and Domain.

Page 15: Unit 3 - Transparent tables in the ABAP Dictionary

• In the ABAP Dictionary, a transparent table is an implemented description of the corresponding database table that contains the actual application data.

Page 16: Unit 3 - Transparent tables in the ABAP Dictionary

Technical Structure of a Transparent Table

Transparent Table

Data Element

Field

Domain

Described by

Points to

Page 18: Unit 3 - Transparent tables in the ABAP Dictionary

•The fields of the transparent table form the identically-named columns of the corresponding database table.

Page 19: Unit 3 - Transparent tables in the ABAP Dictionary

•Usually, a structure in the ABAP Dictionary is used to centrally describe structure variables that are to contain the fields of various tables.

•You can then use these dictionary structures in the ABAP program to define data objects (concrete structure variables) that either serve as temporary data storage in the program or as an interface for the field transport between the screen and ABAP program.

•With structures however, we refer to component and component type as opposed to field and data element, it is posible to have a structure as the component of another structure.

Page 21: Unit 3 - Transparent tables in the ABAP Dictionary

•Such structures with included substructures as components are called complex structures. In contrast, structures with simple components are called flat.

Page 22: Unit 3 - Transparent tables in the ABAP Dictionary

Data Element

Structure Field

Table Field

Structure

Transparent Table

Using Dictionary Elements to Define Data Objects Within theProgram

Page 23: Unit 3 - Transparent tables in the ABAP Dictionary

•DATA mycarrid TYPE s_carr_id.Returns a data object (variable) of the type specified in the data element s_carr_id.

•DATA myconnid TYPE sbc400focc-connid.Returns a data object (variable) that has the same type as the structure field sbc400focc-connid.

•PARAMETERS pa_carr TYPE spfli-carrid.Returns an input field on the selection screen as well as a variable that has the same type as the table field spfli-carrid.

The definitions in the above graphic have the following meaning:

Page 24: Unit 3 - Transparent tables in the ABAP Dictionary

•DATA wa_focc TYPE sbc400focc.Returns a structure variable that has the same type as the dictionary structure sbc400focc.

•DATA wa_spfli TYPE spfli.Returns a structure variable which has the same type as a line of the table spfli.

Page 25: Unit 3 - Transparent tables in the ABAP Dictionary

•Domain describes the technical attributes such as data type and length of a table field.

•Data Element gives the field labels and documentation for the table field.

Domain

Page 26: Unit 3 - Transparent tables in the ABAP Dictionary

•Create your first table•Enter data into your table•View the data in your table

Procedure: Creating Tables

Page 27: Unit 3 - Transparent tables in the ABAP Dictionary

You should now be able to:•Explain the purpose and the benefits of using a data model in application

development•Describe the structure of data elements and domains•Describe the structure of a transparent table•Describe the structure of a structure•Use the mentioned Dictionary elements in your ABAP programs

Page 28: Unit 3 - Transparent tables in the ABAP Dictionary

Your assignment is to:

•Create a relational data model for an airline company that needs to store data from the passengers such as Name, ID, Address and Flight ; data from the flights such as ID, Origin and Destination; and data from the airline company such as ID, Airline Name and Flight numbers assigned to it.

•Create transparent tables in the ABAP Dictionary to represent your relational model.

Unit 3: Case Study – Airline Relational Data Model

Page 29: Unit 3 - Transparent tables in the ABAP Dictionary

ZTPassengers – Passengers

Pass_ID Name Address Flight_ID

ZTFlight – Flight Information

Flight_ID Origin Destination Pass_ID

ZTAirline – Airline

Air_ID Name Flight_ID

•ONE Airline can have MANY Flights (1-N)•ONE Passenger can have MANY Flights

ONE Flight can have MANY Passengers

Flight Information Relational Data Model3 Transparent Tables

Page 30: Unit 3 - Transparent tables in the ABAP Dictionary

Flight Information Relational Data Model