SAP ABAP Data Element VIKEYFLAG (Flag for field belonging to key area)
Hierarchy
SAP_BASIS (Software Component) SAP Basis Component
   BC-DWB-DIC-AC (Application Component) Activation Program, Conversion Program, DB Utility, MC, SPDD
     SDVI (Package) ABAP/4 Dictionary: Views, Lock Objects
Basic Data
Data Element VIKEYFLAG
Short Description Flag for field belonging to key area  
Data Type
Category of Dictionary Type D   Domain
Type of Object Referenced     No Information
Domain / Name of Reference Type KEYFLAG    
Data Type CHAR   Character String 
Length 1    
Decimal Places 0    
Output Length 1    
Value Table      
Further Characteristics
Search Help: Name    
Search Help: Parameters    
Parameter ID   
Default Component name    
Change document    
No Input History    
Basic direction is set to LTR    
No BIDI Filtering    
Field Label
  Length  Field Label  
Short 10 Key 
Medium 15 Key field 
Long 20 Key field 
Heading Key 
Documentation

Definition

Since views can be used in the R/3 System like tables, the key attribute for the fields is assigned analogously as for tables.

The key of a view is important in the following ABAP commands:

UPDATE <view> and INSERT <view>. In this short form of the UPDATE and INSERT commands, the contents of the key fields are used to create the WHERE clause.

SELECT ... FOR ALL ENTRIES ... . With this command, the data can be sorted and compressed internally, whereby the key area is used as unique sorting criterium.

SELECT ... ORDER BY PRIMARY KEY. Sorting is by the fields marked as key field.

To satisfy all these situations, the key must have the following attributes:

  1. All the key feilds must be together at the beginning of the view. If this is not the case, the fields in between are also assigned the key flag in some cases.
  2. The key must guarantee that the records read in the key area are unique. To do so, the key is automatically defined for database and projection views. If a unique key cannot be computed, all the fields are considered to be key fields. The uniqueness of the records in the key is thus guaranteed if there are no duplicate data records.

History
Last changed by/on SAP  19970321 
SAP Release Created in