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 Table Type

Create a table type and use it to retrieve data from a database table.

Overview

🎓 beginner 20 min. ABAP DevelopmentBeginnerSAP BTP ABAP EnvironmentSAP Business Technology Platform

You will learn

  • โœ”How to create and edit a table type for an internal table in the new, form-based Table Types editor
  • โœ”How to use this table type to retrieve data from a database table
Julie Plummer J Julie Plummer March 21, 2023
Created by March 21, 2023
Contributors

Prerequisites

Prerequisites

Steps

Intro

Table types can also be defined in, for example, an ABAP program or class. The differences between the two approaches include:

  • Table types in the ABAP Data Dictionary are maintained in a form-based editor, table types in ABAP in a text-based editor
  • Reuse: Table types can only be used by other Dictionary types if they are defined in the Data Dictionary
  • Modularization: Table types in the Dictionary are stand-alone objects, whereas table types in ABAP are always part of another Repository object

Throughout this tutorial, objects have the suffix XXX. Remember to always replace this with your initials or group number.


Step 1 Create a table type
โ€”

  1. Open your ABAP Project or ABAP Cloud Project from the previous tutorial, then open the package in which you created the database table.

  2. Select your package and choose New > Other ABAP Repository Object > Dictionary > Table Type from the context menu.

    Image depicting step1-new-table-type
    Image depicting step1-new-table-type

  3. Enter a name and description and choose Next.

    Image depicting step1b-name
    Image depicting step1b-name

  4. Create or assign a transport request and choose Finish.

The table type appears in a new editor.

Image depicting step1e-table-type-editor
Image depicting step1e-table-type-editor

Step 2 Define a type
+
Step 3 Define a primary key
+
Step 4 Define a secondary key
+
Step 5 Create an ABAP class
+
Step 6 Add an interface
+
Step 7 Implement the method
+
Step 8 Check your code
+
Step 9 Test your class
+
Step 10 Test yourself
+

Resources

Discussion

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

Submit detailed feedback Discuss in Community
Steps
Step 1 of 10
1. Create a table type 2. Define a type 3. Define a primary key 4. Define a secondary key 5. Create an ABAP class 6. Add an interface 7. Implement the method 8. Check your code 9. Test your class 10. Test yourself

Learn more →