170 likes | 306 Views
This article explores how to implement fixed field values in ABAP tables, akin to enumerations in .NET. It covers the creation of domains and data elements, emphasizing the activation of fixed field domains. The use of foreign keys for entry checks and the concept of append structures to enhance SAP tables are discussed. Readers will learn the importance of naming conventions, enhancement allowances, and the efficient use of include structures for shared data. Lastly, a brief overview of OpenSQL illustrates its functionality between SAP and databases.
E N D
Fixed Domain Fields • We often want a table to have fixed field values • Conceptually similar to an enumeration in .NET • Create a domain as before having a data type • Specify the list of valid values • Make sure to activate the domain • Create and activate the data element
Fixed Field Domains • Enter value list in the domain
Currency Fields • Create the domain and data element using the CURR data type • Create the reference field as follows:
Foreign Keys • In SAP, they are used as lookup fields for entry checks • They provide a way to limit values when there are too many to practically use domain lists
More Detail on Append Structures • We mentioned that append structures are used to enhance SAP and customer tables • Remember that you need an access key to modify SAP tables and the activity is risky!
Append Structures (Implementation) • A table can have many append structures (modifications) • An append structure can only be used by one table though • Use the customer naming convention for append structures (leading Y or Z)
Append Structures (Implementation) • Note that you must allow enhancements on the table
Include Structures • Use to create common data structures shared by multiple tables • Conceptually similar to a C #include • Includes should be places before appends • Be careful with includes having primary keys
OpenSQL • Really a hybrid between SQL and ABAP • They add a layer between SAP and the underlying database • INSERT, UPDATE, DELETE work as expected • The MODIFY statement will UPDATE if a record exists and INSERT if not • Return code is placed in SY-SUBRC