SAP Home Learn Build Integrate Model Operate Extend with AI ConnectTutorial navigator Knowledge Graph API Devtoberfest Developer Advocates App Space

Manage my Account SAP Devs YouTube ↗ Learnings ↗ Community ↗ Provide Feedback ↗
Logout
⤢ Open full site

Create an ABAP Database Table and Relevant ABAP Dictionary Objects

Create a database table from scratch using ABAP development tools for Eclipse (ADT); use different Data Dictionary objects to define the fields; then fill the table with test data.

Overview

🎓 beginner 75 min. ABAP DevelopmentBeginnerSAP BTP ABAP EnvironmentSAP Business Technology PlatformSAP Netweaver

You will learn

  • How to create a table in ABAP, representing a table in your database
  • How to create a reusable domain, which provides technical attributes for data elements
  • How to create an elementary data type, or data element
  • How to fill the table with three rows of test data
Unknown U Unknown December 9, 2024
Created by March 9, 2023
Contributors

Prerequisites

Prerequisites

Steps

Intro

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):

  • client (key field)
  • account_number (key field)
  • bank_name (key field)
  • bank_customer_id
  • city
  • balance
  • currency
  • account_category
  • lastchangedat

Throughout this tutorial, replace ### or 000 with your initials or group number.

Step 1 Create table

Create a table in your package:

  1. Select (right-click) the package and choose New > Other ABAP Repository Object from the context menu:

    Image depicting step1-new-repo-object
    Image depicting step1-new-repo-object

  2. Enter the filter text Table > Database table, then choose Next.

  3. Enter a name such as ZACCOUNTS_### - always replacing ### with your initials or group number - and a description, then choose Next.

    step1b-table-name
    step1b-table-name

  4. 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.

Image depicting step1d-table-editor
Image depicting step1d-table-editor

Step 2 Understand table fields
+
Step 3 Add field account number using built-in type
+
Step 4 Add field city using existing data element
+
Step 5 Add field bank using new data element
+
Step 6 Add all other fields
+
Step 7 Fix the error with the field `Balance`
+
Step 8 Change technical settings
+
Step 9 Save and activate table code
+
Step 10 Test yourself
+
Step 11 Fill table: Create class
+
Step 12 Add interface
+
Step 13 Copy code
+
Step 14 Check your table in Data Preview
+
Step 15 More Information
+

Resources

Discussion

Share feedback on this tutorial or join the conversation in SAP Community.

Submit detailed feedback Discuss in Community
Steps
Step 1 of 15
1. Create table 2. Understand table fields 3. Add field account number using built-in type 4. Add field city using existing data element 5. Add field bank using new data element 6. Add all other fields 7. Fix the error with the field `Balance` 8. Change technical settings 9. Save and activate table code 10. Test yourself 11. Fill table: Create class 12. Add interface 13. Copy code 14. Check your table in Data Preview 15. More Information

Learn more →