Introduction to the ABAP Data Dictionary
Lecture Overview Describe the ABAP database layer and selected core tables
A First few SAP Tables T000 is the client table T001 is the company code table Currency and language are defined here Accounting chart of accounts T006 is for measurement (unit of measure) There are tables for currency conversion BKPF and BSEG are the FI header and transaction tables
Getting Started with the ABAP Database Layer Remember that we work with data logically through ABAP, rather than operating or the physical database We do not touch the underlying (native) database The database layer supplies extensive metadata beyond most native databases
Data Dictionary Transaction Codes Transaction code SE16 gets us to the Data Browser Transaction code SE11 gets us to the ABAP Dictionary
Data Browser (Introduction) The Data Browser allows us to display data from a table By default the cryptic field name is displayed in most screens Settings / User Parameters (Data Browser tab) allows you to select the field label
Data Browser (Select Table) Select the desired table You need to know the table names and meaning of fields
Data Browser (Table Output)
Data Browser Search for table
The ABAP Dictionary (Accessing) Transaction code SE11
ABAP Dictionary Elements Tables Views A view is created from one or more tables Data types Data elements Structured types
ABAP Dictionary Elements (Illustration)
ABAP Dictionary Elements (Tables) A superset of what we usually think of as a table There are different types of tables Transparent tables are used to store business data Pool tables and cluster tables generally store applications ABAP programs are stored in the database itself in pool and cluster tables We will not work with these
ABAP Dictionary Elements (Tables - Transparent) Tables contain Fields having a field name and a data type Foreign keys describe relationships between other tables Technical settings describe how the table is created in the database Indexes are used to improve performance
ABAP Dictionary Elements (Views) In general database terms, it’s a virtual table that is not physically stored SAP has different types of views based on the underlying fundamental database operations The SAP views are semantic (more later)
ABAP Dictionary Elements (Views – Types) Database – These are views from one or many tables Projection views apply to only one table and restrict the number of fields to display Structure views are pretty much obsolete We will not talk about them here
Creating a Table (Steps) Rules for table names Creating the table Creating the fields
Creating a Table (Table Names) 16 case insensitive characters Customer (created) tables should begin with the characters Z or Y You can use anything for a field name Create data element and domain names beginning with Z or Y Other namespaces (SAP) are letter sequences enclosed by slashes /SAPPRESS/
Creating a Table (Maintenance)
Creating a Table (Attributes) Change and language information Packages group objects (including tables) They control transport behavior They organize objects Objects without a package cannot be transported
Creating a Table (Delivery and Maintenance) Descriptive information The delivery class drives the transport of data records during install, upgrade, …
Creating a Table (Delivery and Maintenance) The following controls dictionary rights
Creating a Table (Package) The Package $TMP is a special local package
Domains / Data Elements / Fields Most of you are used to database fields having some primary data type Integer, double , date, string, etc. SAP utilizes layers of indirection called domains and data elements A data element can be used in one or many table fields
Domains / Data Elements / Fields (Illustration) Fields have a data element, which belongs to a domain
Domains A domain describes the technical attributes of a field Data type Number of positions (size) Optional value range Fields belonging to a domain are changed if the domain is changed
Domains (Illustration) The Domain BUKRS is the company code
Data Elements A data element is an elementary type It defines Field label values Help information It may or may not belong to a domain If it does, then fields of the elementary type will change if the domain changes
Data Element (Illustration
Company Code (Example) One of the core SAP concepts is the Company Code The domain BUKRS defines the company code as a CHAR (4)
Company Code (Example) And the domain BUKRS is used in many places Where used button
Company Code (Example) The Data element BUKRS belongs to the domain BUKRS
Company Code (Example) And BUKRS is used in the following tables
Field Domains (Summary) Field domains are themselves stored in a table So are table fields and data elements
Field Domains (Creating) I prefer to create the domains and then create the fields Your book suggests forward navigation DON’T FORGET TO ACTIVATE THEM
Creating a Data Element (1) Select the domain to which the element applies
Creating a Data Element (2) This is where the field titles come from for forms and other places
Creating a Table (Fields) Table fields work a bit differently in SAP In SAP fields belong to a domain It’s the domain that defines The data type The value range Domains must be activated before they can be used
Creating a Table (Fields)
Creating a Table (Fields) Field name Key fields uniquely identify a row Composite keys can have a maximum of 16 key fields Give a field an initial value The Data Element field defines the field’s data type You can use predefined data types or create new ones
Dictionary Technical Settings (1) With the desired table active, select GoTo, Technical Settings These technical settings describe how the system treats the table Data Class defines the ‘physical’ area of the database where the table is stored Master data, transactional data, organizational data
Dictionary Technical Settings (2) Size category defines the number of records expected Buffering whether a record or table is buffered (prefetched into the work area) when accessed
Dictionary Technical Settings (Illustration)
Entering Data While the Display table screen is active, click Utilities / Table contents / Create Entries
Object Navigator It’s used to organize programing in the SAP integrated development environment Repository Browser is the primary code storage area The Repository Information System is used to search for programming objects The Transport Organizer manages changes made during configuration and development and propagates (transports) changes to test and production systems
Object Navigator (Illustration) Select object type from Object List
Repository Browser (Object Lists) The application hierarchy contains all development objects A package contains logically related development objects In this class, we will create local objects, which are not transported to QA / production systems
Packages (Contents) Packages contain many things Programs containing fields, events, subroutines, screens, and so on Function groups are containers for functions (external procedure calls) Dictionary objects contain (roughly speaking) references to SAP data Remember, all data is processed through the SAP API SHOW PACKAGE FARC
Classes / Interfaces SAP supports an OOP approach to development using classes and interfaces