SAP Data Objects
SAP Data Objects
SAP data objects one can create in SAP Data Dictionary. Now many peoples are confuse in 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.
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
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:
Data Elements
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.
Data 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:
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
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.
Views
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:
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.