You will learn
- How to create a table in ABAP, representing a table in your database
- How to add an input check to a field
Tables are defined independently of the database in the ABAP Dictionary. When you activate the table in the Data Dictionary, the table is created in the underlying database.
The table in this tutorial will store bank account details for customers. The table will have the following columns (or fields):
Company_name
account_number
balance
bank_name
account_category
city
last_entry
For more information on:
-
Database tables and their properties, see the SAP Help Portal: Database Tables
-
Using the ABAP Development Tools (ADT) editor for database tables, see the application help in ADT: click on the editor and choose
F1
Step 1: Create a table
Create a table in your package:
-
Select (right-click) the package and choose New > Other ABAP Repository Object from the context menu:
-
Enter the filter text Table, choose Database table, then choose Next.
-
Enter a name such as
Zxx_ACCOUNT
- always replacingxx
with your initials - and a description, then choose Next: -
Accept the proposed transport request and choose Finish.
The code for the table appears in a new editor. Ignore the annotations at the top for now.
Log on to answer question
Step 2: Understand the table fields concept
In the next step, you will define the table fields. First you need to understand your options:There are 3 ways to create a field for a database table:
-
Built-in type: The quickest: You specify a (pre-defined) primitive type, length, and description, but no more. You cannot then reuse this field. For more information, see ABAP Keyword Documentation: Predefined Dictionary Types.
-
Use an existing data element: The most powerful: A data element describes the semantics of a field, such as a currency, or a customer name. You can defi