Welcome to the tutorial about SAP Data Object. This tutorial part of our free SAP ABAP course. Here we are going to review different types of SAP data objects one can create in SAP Data Dictionary. We are not going to cover ABAP CDS Objects here and will publish a separate tutorial dedicated to HANA objects and techniques in SAP. The reader also shouldn’t confuse SAP Data Objects related to SAP Data Dictionary with data objects related to ABAP, which are created by CREATE DATA statement in ABAP programs and function modules. ABAP programmatic data objects will be discussed further in a special tutorial.
All SAP Data objects are created in SE11 transaction and share one common feature: they are related to data, for data storage or data description, whether this is transactional business data or customizing data or maintenance data. This is the distinguishing feature they differ from repository objects which are related to programmatic activities and which are created by SE80 transaction. However, in some cases scopes of these transaction overlap. For example, data elements, domains and even tables can be created from SE80 too.
Database tables are one of the main objects available for creation and maintenance in SAP Data Dictionary. There are three types of tables in SAP ECC:
- Transparent tables
- Pooled tables
- Cluster tables
The first used for storing transactional and master data used in business operations, whereas the latter two are used for customizing aims. As table creation and table types were thoroughly considered in our previous dedicated tutorials (How to Create Tables in SAP and Types of Tables in SAP) I will not focus on this here.
Data elements are the most important pieces which most programmatic and database object comprise of, therefore one should pay special attention to them and get a good grasp of how they are constructed, maintained, understand their basic fields and properties.
Data elements are data types we use to construct tables, views and other SAP data objects. With the help of data elements, we can define either elementary types or reference types and their semantic properties. Referentially-typed data elements are used as reference to another type, class or elementary type. This is useful, when you have a need to declare a big set of similar data elements.
Elementary-typed data elements are technically similar to predefined dictionary types with the only significant difference: they can hold semantic meaning of the type.
From the above picture, we can see the main technical attributes that are specified by a data element:
- Domain. Domain is important entity which defines application area of a data element, it will be discussed further.
- Data type. Elementary data type which is data element based on.
- Length. Elementary type length.
It is important to keep in mind the data elements typing concept: one can specify either elementary typing for a data element or domain-based. Not both! If you select domain for a data element, Data type and Length fields will be auto-filled and become greyed out and unchangeable. For fine-tuning always use elementary types.
So, what are those semantic attributes of data element and what makes them invaluable for data definition? Here are they:
- Short text
- Field label
- Supplement documentation
- Documentation status
- Search help
- SPA/GPA parameter
- Flag for input history
- Flag for change document
The most important of them is short text, a small description which is showed in search help windows, also field labels (short, medium and long) which are showed as column labels in all ALV grids this data element is used, documentation which is pretty self-explanatory and search help. Search helps will be discussed further in this tutorial.
In other words, semantic attributes help to identify data elements, differentiate from each other, put some business sense to them. And that is the fundamental difference between them and predefined dictionary types, which can be used in specification of complex SAP data objects too.
Domains are also very important entities that used throughout the SAP Data Dictionary extensively. Domain defines the range for values that data element can hold, and the scope where this domain and all data elements based on it will be used. For the range, the following domain attributes are used.
Data type – elementary type which is the same we saw in data elements. If we select domain during data element specification, this type is applied to data element automatically.
No. Characters – data type length.
Decimal places – attribute which is used for numeric types and which shows number of decimal for number.
Output length – length of the visible area for the domain and correspondent data elements. Can be less or more than the actual length.
Conversion routine – special procedure for showing the object. Conversion routines is the extremely interesting concept inherent only to SAP. It is used for data transformation between how it is stored actually in a database and how it should be exposed to a user. The simplest example for this is binary representation of logical variables. If we want to store booleans like 1 and 0, but want them to be shown to a user like true ad false, we can write a trivial conversion routine to implement this. The closest equivalent that comes to my mind is Java Getters and Setters for Java fields.
The scope of domain and data elements based on it is specified by following attributes.
Single values – values that can be assigned to the target data element.
Intervals – ranges that can be assigned to the target data element.
Value table – developer can specify database table that can be used for domain values specification, so that data element based on this domain can hold only values from table.
As we can see, domain is a special data object used for data element specification and fine-tuning both technically (data type, length, conversion routine) and semantically (value ranges, value table). The advantage of using domains over elementary data dictionary types is that one domain with complex logic can be reused in many data elements without additional effort of specifying multiple elements.
Views is another essential type of SAP data objects used in SAP Data Dictionary for accessing database data. What are the views in fact? If you ever used JOINs in any RDBMS you are aware how they work and constructed. View in SAP is a group of columns joined in application-specific manner, in a specified order, specified sorting and with certain WHERE conditions. Of course, there are some peculiarities which will be discussed further.
There are the following types of views in SAP:
- Database views
- Projection views
- Maintenance views
- Help views
- External views (View for accessing HANA views in ABAP, which will not be considered here)
One should understand that views are purely synthetic entities which are used for more robust and comfortable access to dataset data and for hiding and exposing to user only those data which is necessary.
Views are mostly platform-independent and don’t create correspondent view object on database level, except database views type. Views can be used both for writing and reading data from database.
Database views – the only view type that create view object in database. If basis table (table it consists of) don’t exist in database, then view object is not created too. The basis table should be transparent.
Projection views – the special view type that is used only for hiding field from a single basis table. Multiple tables are not allowed, as well as where conditions.
Maintenance views – special views for writing and maintenance data in all tabled of the views. The maintenance is done through special transaction SE54 through automatically created programmatic modules. During insert into view tables all fields non-existent in view are assigned initial values.
Help view – a special view for search helps which will be discussed further.
While defining the view, first of all we specify which tables are joined and on which fields as shown below.
On the third tab, we specify which fields should present in view and in which order.
On the fourth tab, we define selection conditions for rows.
Search helps are very simple but yet the most interesting data object in SAP ECC. You may be noticed these search windows in different SAP transactions.
They are used to simplify and fine tune searches across all the SAP system. Search helps are special SAP data objects which contain information of what is searched, how it is searched and by what fields. Like all previous SAP data objects, they are created in SE11 transaction.
A typical search help looks like this:
In order to make a functional search help, a developer should specify table from which the values are fetched (Selection method field), text table (if exists) and by which fields the search is done (parameter table). In our example, the values fetched from T005 table with T005T text table by LAND1 field. So, a user enters country code (LAND1) and receives a list of countries with full names.
Here we considered simple search help which is called elementary by SAP, whilst there are also complex search helps which consist of several elementary ones.
Did you like this tutorial? Have any questions or comments? We would love to hear your feedback in the comments section below. It’d be a big help for us, and hopefully it’s something we can address for you in improvement of our free SAP ABAP tutorials.
Go to next lesson: SAP ABAP Syntax
Go to previous lesson: SAP Data Types
Go to overview of the course: SAP ABAP Training