Data Elements
Data elements define the technical attributes of fields in SAP tables and structures. They specify properties such as data type, length, and field labels.
Understanding Data Elements
Data elements are ABAP Dictionary objects that:
- Define the technical and semantic properties of fields
- Provide field labels for different output lengths
- Can be linked to domains for value range validation
- Are used in table definitions, structure definitions, and parameter interfaces
Data Element Structure
A data element consists of:
Technical Attributes
- Data Type: The technical data type (CHAR, NUMC, DEC, etc.)
- Length: The field length in characters or digits
- Decimals: The number of decimal places (for decimal types)
Semantic Attributes
- Short Description: Brief description of the data element
- Field Labels: Text for different output lengths (short, medium, long)
- Search Help: Optional search help for value assistance
- Documentation: Detailed description and usage information
Data Element vs. Domain
Data elements and domains serve different purposes:
Aspect | Data Element | Domain |
---|---|---|
Purpose | Semantic definition | Technical definition |
Defines | Field labels, documentation | Data type, length, value range |
Reuse | Multiple fields with same meaning | Multiple data elements with same technical properties |
Example | Customer Number (semantic) | 10-character alphanumeric (technical) |
Common Data Elements by Module
Financial Accounting (FI)
Data Element | Description | Domain | Used In |
---|---|---|---|
BUKRS | Company Code | BUKRS | BKPF, BSEG, EKKO |
BELNR | Accounting Document Number | BELNR | BKPF, BSEG |
GJAHR | Fiscal Year | GJAHR | BKPF, BSEG |
SAKNR | G/L Account Number | SAKNR | SKA1, BSEG |
Materials Management (MM)
Data Element | Description | Domain | Used In |
---|---|---|---|
MATNR | Material Number | MATNR | MARA, MARC, MARD |
WERKS | Plant | WERKS | MARC, MARD, EKPO |
LGORT | Storage Location | LGORT | MARD, MSEG |
EBELN | Purchase Order Number | EBELN | EKKO, EKPO |
Sales and Distribution (SD)
Data Element | Description | Domain | Used In |
---|---|---|---|
VBELN | Sales Document Number | VBELN | VBAK, VBAP |
KUNNR | Customer Number | KUNNR | KNA1, VBAK |
POSNR | Item Number | POSNR | VBAP, LIPS |
VKORG | Sales Organization | VKORG | VBAK, KNVV |
Human Resources (HR)
Data Element | Description | Domain | Used In |
---|---|---|---|
PERNR | Personnel Number | PERNR | PA0000, PA0001 |
PLANS | Position | PLANS | PA0001, HRP1000 |
ORGEH | Organizational Unit | ORGEH | PA0001, HRP1000 |
PERSG | Employee Group | PERSG | PA0001 |
Creating and Managing Data Elements
Transactions
- SE11: ABAP Dictionary Maintenance
- SE80: Object Navigator (access data elements in the ABAP Repository)
Development Process
- Define the purpose and usage of the data element
- Determine the appropriate domain (or create a new one)
- Create the data element in Transaction SE11
- Define field labels and documentation
- Activate the data element
Best Practices
Naming Conventions
- Use descriptive names that indicate the purpose of the data element
- Follow SAP naming conventions for custom data elements (Z or Y prefix)
- Use consistent naming patterns within your organization
Design Considerations
- Reuse existing data elements when appropriate
- Create new data elements for fields with distinct semantic meanings
- Link data elements to appropriate domains for value validation
- Provide comprehensive field labels and documentation
Documentation
- Document the purpose and usage of the data element
- Describe the business context and meaning
- Include examples of valid values
- Document any dependencies or relationships with other objects
Finding Data Elements
Several methods exist to find data elements:
- Transaction SE11: Search by name or description
- Transaction SE80: Browse the ABAP Repository
- Transaction SE16/SE16N: Query table DD04L (data element directory)
- Field Information: Right-click on a field in SAP GUI and select "Technical Information"
Data Element Usage Examples
Table Definition
TABLES: KNA1. " Customer Master: General Data
DATA: gv_customer TYPE kunnr, " Using data element KUNNR
gv_name TYPE name1, " Using data element NAME1
gv_city TYPE ort01. " Using data element ORT01
Structure Definition
TYPES: BEGIN OF ty_customer,
kunnr TYPE kunnr, " Customer Number
name1 TYPE name1, " Customer Name
ort01 TYPE ort01, " City
land1 TYPE land1, " Country
END OF ty_customer.
DATA: gs_customer TYPE ty_customer,
gt_customers TYPE TABLE OF ty_customer.
Function Module Interface
FUNCTION Z_GET_CUSTOMER_DATA.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" VALUE(IV_CUSTOMER_ID) TYPE KUNNR
*" EXPORTING
*" VALUE(ES_CUSTOMER_DATA) TYPE TY_CUSTOMER
*" EXCEPTIONS
*" CUSTOMER_NOT_FOUND
*"----------------------------------------------------------------------
Custom Data Elements
Organizations often create custom data elements for:
- Business-specific fields not covered by standard SAP
- Extensions to standard functionality
- Custom applications and reports
Custom data elements typically:
- Start with 'Z' or 'Y' (following SAP naming conventions)
- Reference either standard or custom domains
- Include comprehensive documentation for future reference
Data Element Relationships
Data elements are related to other ABAP Dictionary objects:
- Domains: Define technical properties and value ranges
- Tables: Use data elements to define fields
- Structures: Use data elements to define components
- Search Helps: Provide value assistance for fields
- Lock Objects: Use data elements for key fields
Understanding these relationships is crucial for effective data modeling and development.