Professional Documents
Culture Documents
Demonstration
Exercises HelpMe
5
India SAP CoE, Slide 2
Demonstration
Exercises HelpMe
5
India SAP CoE, Slide 3
Introduction
ABAP dictionary is the central repository for creation and management of definitions used in ABAP. ABAP dictionary is integrated in ABAP workbench and therefore all tools of the workbench like Programs, Screens, function modules can actively access objects defined in data dictionary. ABAP workbench is an integrated tool for creating an ABAP application.
ABAP Dictionary
We shall see the each of the following Functions of the dictionary Tables in the ABAP dictionary Performance in table access Consistency through input checks Search helps Lock objects Views
Demonstration
Exercises HelpMe
5
India SAP CoE, Slide 6
Type definitions
Analogous to the predefined ABAP types such as C or I , one may define user-defined types in the dictionary. The following user-defined types are allowed Data elements: Describe an elementary type by defining the data type, length and possibly decimal places. Structures: Consist of components that can have any type.
Type Definitions
Any complex user-defined type may be built using the previously mentioned basic types.
Database Objects
F1-> Documentation for the data element F4-> Input help for screen fields
India SAP CoE, Slide 13
A database table is the central data structure of the ABAP/4 data dictionary.
A domain defines a field technically and therefore it may be used at different business levels.
Append structures allow you to attach fields to a table without actually having to modify the table itself. You can use the fields in append structures in ABAP programs just as you would any other field in the table.
India SAP CoE, Slide 27
Click on the append structure tab and opt to create new structure.
Customers can add their own fields to any table or structure they want.
Some of the tables and structures delivered with the R/3 standard contain special include statements. These are often inserted in those standard tables that need to have customer-specific fields added to them. Such includes are Customizing includes. (CI).
India SAP CoE, Slide 30
A Customizing include is a structure that satisfies a special naming convention. (name begins with CI_).
India SAP CoE, Slide 31
Customers can add their own fields to any table or structure they want.
Table buffering Advantages of buffering Concept of buffering Buffering types Buffer synchronization
Structure of an Index
Buffering allows you to access data quicker by letting you access it from the application server instead of the database.
Advantages of buffering
Table buffering increases the performance when the records of the table are read. As records of a buffered table are read directly from the local buffer of the application server on which the accessing transaction is running, time required to access data is greatly reduced. The access improves by a factor of 10 to 100 depending on the structure of the table and on the exact system configuration.
Concept of buffering
Buffering types
Buffering types
Buffering types
Value table
Value Table
A foreign key creates a link between two tables T1 and T2. Every primary key field from T2 (check table) is assigned a field from table T1 (foreign key field). The fields from T1 assigned to primary key fields are marked as foreign key fields.
India SAP CoE, Slide 52
The foreign key is defined for field SBOOK-COUNTER (check field), which means that the entry in this field is checked. Field COUNTER is therefore called the check field for this foreign key.
Example: A new entry is to be written in table SPFLI (flight schedule). There is a check whether the airline carrier entered is stored in table SCARR (carrier) for field SPFLI-CARRID. The record is only copied to table SPFLI (foreign key table) if this is the case. A foreign key is defined for field SPFLI-CARRID (check field), i.e. the checks are on this field. The corresponding check table is table SCARR with the primary key fields MANDT and CARRID.
Semantic Attributes
Text Table
Text Table feature Table SMEAL contains the meals served to the passengers
during a flight. The meal names are maintained in table SMEALT.
Table SMEALT is the text table for table SMEAL since the key of SMEALT consists of the key of SMEAL and an additional language key field (field with data type LANG).
Table SMEALT can contain explanatory text in several languages for each key entry of SMEAL. To link the key entries with the text, the text table SMEALT must be linked with table SMEAL using a foreign key. Key fields of a text table must be chosen for the type of the foreign key fields. The foreign key relationship is defined from SMEALT to SMEAL. Only one text table can be created for a table.
Search Helps
Search helps
Standard search help Types of search helps Concept of search help Search Help Interface Dialog behavior of search helps Selection method for search helps Performance of search helps Attaching search helps Hierarchy of search helps
The input help (F4 help) is a standard function of the R/3 System. It permits the user to display a list of possible values for a screen field. A value can be directly copied to an input field by list selection.
Context data: You first have to define the context data to be used in the input help process. The context contains the information obtained in previous dialog steps and the entries already made by the user in the current input mask. This information is normally used to restrict the possible values for the current input field.
Search help interface determines how the exchange of values between the screen template and the selection method is implemented.
A hit list might contain plentiful number of entries. A dialog provides the user with an option to restrict the entries displayed on the hit list.
India SAP CoE, Slide 71
Dialog Types
The dialog type of an elementary search help defines how the hit list is displayed when the input help is called. It defines the dialog steps executed for input help.
Dialog Types
The following dialog types are possible: Immediate value display: The hit list is immediately displayed when the input help is called. This is only meaningful if the hit list usually only contains a few entries. Complex dialog with value restriction: The dialog window for restricting values is offered immediately. Choose this option if the list of possible entries is usually very large. If the user limits the amount of data to be processed, the hit list will become more comprehensible and the system load during value selection will be reduced. Dialog depending on number of values: If the hit list contains less than 100 entries, it is displayed immediately. If the hit list contains more than 100 entries, the dialog box for restricting values is displayed.
Selection method refers to the database object (database table or view) from which data is selected and displayed in the hit list.
India SAP CoE, Slide 74
We must ensure that the hit list is displayed in minimum time with minimum load on the system.
Choose the field name, click on search help tab and provide the name of the search help.
The search help ZSTRAVELAG_NAME is therefore directly attached to the field AGENCYNUM of table ZSTRAVELAG.
Provide the search help name and the parameter name under the further characteristics tab of the data element.
A Collective search help provides alternative search Paths by combining elementary search helps.
A collective search help also has interface parameters like an elementary search help.
Parameter assignment needs to be done for each of the Included search helps.
User may choose the tab and thus the elementary search method.
India SAP CoE, Slide 86
Lock objects
Lock Objects
Lock object concept Lock modes Creating a lock object (example) Lock object sample code
Lock Objects
SAP data dictionary provides you with a locking mechanism to synchronize simultaneous data access by different users.
Lock Objects
Lock objects are created in SE11. Customer lock objects must begin with EY or EZ .
Lock Mode
Lock Mode E (Extensible) X (Exclusive) S (Shared) Meaning Lock for data change (accumulative exclusive lock) Lock for data change (exclusive write lock) Lock for protected data display (shared lock)
Lock Mode
Lock mode E: This sets a lock for changing data for single user. This lock can be accumulated. Lock mode X: This mode is used like mode E for changing data. The only technical difference from mode E is that the respective lock does not allow accumulation.
SAP AG 2002
Lock mode S: This mode ensures that data displayed in your program cannot be changed by other users during the entire display time. Here you do not want to change the data yourself (allows read only access for data).
India SAP CoE, Slide 91
Enter table names containing data records that should be locked and the lock mode.
The primary keys of the specified tables are automatically selected as lock parameters.
If another user (say abap2) tries to access the same data i.e. matnr = 000000000000000012,via a program or a transaction it would deny him read or write access.
Values
'E' 'X' 'S'
Meaning
Exclusive lock (accumulative) Exclusive lock (not accumulative) Shared lock (accumulative) Field value to be used for locking Lock acc. to corresponding lock parameter (Default) Lock for table line with initial field value Lock remains in program Lock passed to V1 update (default) Lock in program + passed to V1 update If external lock, no further lock attempt (default) If external lock, second lock attempt Setting lock without local lock container (default) Setting lock with local lock container
_scope
_wait
SPACE 'X'
_collect
SPACE 'X'
SAP AG 2002
Views
Views
Importance/Use of views Join/Projection/Selection w.r.t views Inner and Outer joins Types of views Database view Projection view Maintenance view Help view
Importance/Use of Views
Data for an application object is often distributed on several database tables. Database systems therefore provide you with a way of defining application-specific views on the data contained in several tables. These are called views. Data from several tables can be combined in a meaningful way using a view (join). You can also hide information that is of no interest to you (projection) or only display those data records that satisfy certain conditions (selection).
Each record of TABA is first combined with each record of TABB. If a join condition is not defined, the cross product of tables TABA and TABB is displayed with the view.
India SAP CoE, Slide 102
View Types
Four different view types are supported. These differ in the way in which the view is implemented and in the methods permitted for accessing the view data . Database views are implemented with an equivalent view on the database. Projection views are used to hide fields of a table (only projection). Help views can be used as selection method in Search help. Maintenance views permit you to maintain the data distributed on several tables for one application object at one time.
Database Views
Database views should be created if want to select logically connected data from different tables simultaneously. Database views implement an inner join. Application programs can access the data of a database view using the database interface. (Just as we write select queries on database tables, we can write them for views as well.)
You have the following options for the contents of the table fields not contained in the view: If the field is defined on the database with NOT NULL as initial value, the field is filled with the corresponding initial value.
If the field is defined on the database as NOT NULL without initial value, an insert is not possible. This results in a database error.
If the field is not defined on the database as NOT NULL, there will be a NULL value in this field.
Projection Views
Projection views are used to hide fields of a table. This can minimize interfaces; for example when you access the database, you only read and write the field contents actually needed
Maintenance Views
A maintenance view permits you to maintain the data of an application object together. The maintenance status determines which accesses to the data of the underlying tables are possible with the maintenance view.
Maintenance Status
The maintenance status of a view controls whether data records can also be changed or inserted in the tables contained in the view. The maintenance status can be defined as follows: Read only: Data can only be read through the view. Read, change, delete, insert: Data of the tables contained in the view can be changed, deleted, and inserted through the view. Read and change: Existing view entries can be changed. However, records cannot be deleted or inserted. Read and change (time-dependent views): Only entries whose non-time dependent part of the key is the same as that of existing entries may be inserted.
Help Views
Help view is created if a view with outer join is needed as selection method of a search help.
Append Views
Append views are used for enhancements of database views of the SAP standard. With an append view, fields of the base tables of the view can be included in the view without modifications. This is analogous to enhancing a table with an append structure. An append view is assigned to exactly one database view. More than one append view can be created for a database view.
Demonstration
Exercises HelpMe
5
India SAP CoE, Slide 117
Demonstration
1) Steps to create a Transparent Table 2) Steps to create a Data Element. 3) Steps to create a Domain 4) Steps to create a Database View 5) Steps to create an Elementary Search Help 6) Steps to create a Collective Search Help
Go to transaction SE11. Enter name of table you want to create (beginning with Y or Z) and click on create pushbutton
India SAP CoE, Slide 119
Enter the name of the table field and the data element. The System automatically populates the technical details for existing data elements.
India SAP CoE, Slide 121
To create a data element simply double click on it. Alternately create a data element by simply choosing the data type radio button on SE11 initial screen.
India SAP CoE, Slide 122
The system prompts you to create a new data element. Choose the Yes pushbutton.
India SAP CoE, Slide 123
Under the data type tab enter the domain name which determines the technical characteristics of the field.
India SAP CoE, Slide 124
Create domain
If the domain does not exist in the data dictionary the system prompts you to create one.
India SAP CoE, Slide 125
Create domain
Give the technical characteristics under the definition tab. Value range allows you value restriction at domain level.
India SAP CoE, Slide 126
A currency or a quantity field must be assigned a reference field from a reference table containing applicable qty unit or currency unit.
India SAP CoE, Slide 127
A field containing currency amounts (data type CURR) must be assigned a reference field including the currency key (data type CUKY).
India SAP CoE, Slide 128
Enter the table names and the join conditions for the database view.
Under the tab View Flds, specify the names of the fields from either table whose data you want to access using the view.
India SAP CoE, Slide 132
The system allows you to enter data restricting conditions under the tab Selection conditions.
Choose elementary search help radio button option as the search help type.
Enter the search help parameters, the selection method and activate the search help.
India SAP CoE, Slide 137
Choose Collective search help radio button option as the search help type.
Instead of the selection method, we enter the included search helps for the collective search help.
Collective search help offers the user to obtain F4 help using any of the included search helps.
India SAP CoE, Slide 144
Demonstration
Exercises HelpMe
5
India SAP CoE, Slide 145
Exercises
1 Foreign Key Relationship I Maintain the foreign key relationships of your tables ZEMPLOYxx and ZFUNCTIONxx. Define a foreign key check for each of the following fields: ZEMPLOYxx-Client ZEMPLOYxx-Carrier ZEMPLOYxx-Function or ZFUNCTIONxx-Client ZFUNCTIONxx-Carrier or ZSALARYxx-Client ZSALARYxx-Carrier ZSALARYxx-Function ZSALARYxx-Currency
India SAP CoE, Slide 146
Use the tables of the flight model or tables T000 (client) and TCURC (currency codes) in addition to your tables to define the foreign key. Maintain the data for your table ZEMPLOYxx. Reconsider the settings made for Problem 1! 2 Foreign Key Relationship II Some employees of carriers work in travel agencies in order to sell flights for their companies there. Enhance table ZEMPLOYxx by a field that is assigned to each employee or to the travel agency in which he or she works.
Enhance table ZEMPLOYxx accordingly. Maintain the foreign key relationship and some data records.
Exercise
3 Foreign Key Relationship III (Supplementary exercise) Create a text table ZFUNCTIONTxx for table ZFUNCTIONxx to define the function of the employees of the carriers in all countries.
Create the corresponding table and use the standard data elements SPRAS and S_TEXT for the field definition. Maintain the foreign key relationships.
Demonstration
Exercises HelpMe
5
India SAP CoE, Slide 149
HelpMe
HelpMe
Tips and Tricks
Some useful transaction codes: 1) Dictionary maintenance (SE11) 2) Dictionary display (SE12) 3) R/3 Repository Information System (SE84) 4) Repository Information System ABAP Dictionary (SE15) 5) Data display/maintenance (Data Browser) (SE16) 6) Technical settings (SE13) 7) Database utility (SE14) 8) Table view generation (SE54) 9) Extended table maintenance (SM30)
HelpMe
Start
Additional Info
Are temp. inconsistencies in the read data acceptable? Are most accesses read only? Yes
Table may be buffered.
No
Is the expected table size smaller than 8KB? No Is the table mostly accessed with SELECT SINGLE? No Is the expected table size larger than 1MB (>> 1000 records)? No
Yes
Full buffering
Yes
Single-record buffering Buffering depends on installation. Further considerations must be made: Full or generic buffering possible? Secondary indexes or buffering? Generic buffering with suitable number of generic key fields Full buffering
Yes
Yes Is a left-justified part of the key usually specified when the table is accessed?
SAP AG 2002
No
HelpMe
Base table 1
Additional Info
Base table 2
DB view
Primary table
Secondary table
Help view
SAP AG 2002
HelpMe