DAY-5: Creating Tables, Foreign Keys, Structures & Transporting to QAS in SAP ABAP

On a journey of continuous learning 🚀 I share the concepts I learn daily through blogs. Learn concepts with me — one topic at a time.
#LearningInPublic #ContinuousLearning
Creating a New Table in SAP (Beginner-Friendly Guide)
In SAP, a table is where actual business data is stored—similar to a table in Excel or a table in a database like MySQL.
Examples of data stored in tables include customers, orders, products, and invoices.
This section explains how to create a custom table in SAP, step by step, and why each step is important.
Step 1: Open ABAP Dictionary (SE11)

Enter SE11 in the SAP command field and press Enter
Select Database Table
Enter a custom table name (must start with Z or Y)
Click Create
📌 Important ABAP Rule
ABAP is space sensitive (spaces matter)
ABAP is not case sensitive (
ZTABLEandztableare treated the same)
💡 Think of SE11 as the blueprint room where you design database tables before using them.
Step 2: Enter Table Basic Details

After clicking Create, a new screen appears.
Here you must fill:
Short Description – explains what the table is used for
Delivery Class – controls how data behaves during transports
Data Browser/Table View Maintenance – controls whether data can be viewed or edited

Common Selection (for custom tables)
Delivery Class →
A(Application Table)Data Browser → Display/Maintenance Allowed
📌 This decides whether users can see and maintain data in the table.
Step 3: Mandatory Client Field (MANDT)

The first field in every client-dependent table must be MANDT.
Why is MANDT Required?
SAP supports multiple companies (clients) in the same system
MANDTtells SAP which company the record belongs toWithout it, SAP cannot separate data correctly
📦 Real-World Example
Imagine a shared Excel file used by multiple companies.MANDT is like a hidden column saying:
Company A → Client 100
Company B → Client 200
Step 4: Add Business Fields Using Data Elements

Now you define the actual columns of the table.
Each field should use a Data Element
Data Elements provide:
Business meaning
Labels for screens and reports
Consistency across SAP
📌 Best Practice
❌ Don’t directly use data types
✅ Always use Domain → Data Element → Table
This keeps the system clean and professional.
Step 5: Save, Assign Package & Transport Request

When you save:
SAP asks for a Package
SAP assigns a Transport Request (TR)

Why this matters:
Package = folder for organizing objects
Transport Request = tracks changes to move them to QA/Production
💡 SAP never allows unmanaged changes—everything is tracked.
Step 6: Technical Settings (Data Class, Size, Buffering)
When you click Activate, SAP asks for technical settings.


Data Class
Defines what kind of data the table stores:
APPL0 → Master Data (Customers, Materials)
APPL1 → Transaction Data (Orders, Invoices)
APPL2 → Customizing Data (Settings)

📌 Choose the correct class for performance and organization.
Size Category

Estimates how many records the table will store
Helps SAP optimize database storage
You don’t need to be exact—just reasonable.
Buffering
Controls whether SAP stores table data in memory
Improves performance for frequently used data
📌 Usually decided by system architects.
Step 7: Enhancement Category (Important Activation Step)

After activation:
Go to SE11 → Change Mode
Navigate to Extras → Enhancement Category
Select the enhancement option
Click Copy
Activate again
📌 This allows future enhancements without breaking the table.
Step 8: View Table Data (SE16N)

To view table contents:
Enter SE16N
Enter table name
Click Execute
At this point, the table exists but has no data yet.
Step 9: Insert Data into the Table

To insert records:
Open table in SE11 → Change
Go to Utilities → Table Contents → Create Entries
After saving, SAP confirms:
✅ Database record successfully created
Lock Object Error (What It Means)



If you see a lock object error:
Another user or session is editing the same table
SAP locks the table to prevent data corruption
📌 Solution
Close the other session and retry.
🧠 This is similar to Google Docs allowing only one editor at a time.

Creating Foreign Keys (Table Relationships)
Foreign keys define relationships between tables.

Example: Header & Item Tables
Sales Order Header
Sales Order Items
Steps:
Open Item Table
Select the field
Click Foreign Key icon
Enter Header Table as Check Table
Click Create Proposal
Set Cardinality:
One-to-One
One-to-Many (most common)
Copy and Activate

📌 Important Rule
Both fields must use the same Domain
Preferably the same Data Element
Why Foreign Keys Matter
Ensure data consistency
Prevent orphan records
Enable SAP checks automatically
📦 Real-World Example
An order item must belong to an order header.
Foreign keys enforce this rule technically.
Creating a Structure in SAP (Explained for Everyone)
In SAP, a Structure is a way to group multiple fields together without storing data permanently in the database.
Think of a structure as a temporary container used to:
Hold data during program execution
Pass data between programs
Reuse common fields
Enhance existing tables safely
📌 Important difference
Table → Stores data permanently in database
Structure → Exists only in memory (no data storage)
Why SAP Uses Structures
SAP uses structures to:
Avoid repeating the same fields again and again
Keep programs clean and reusable
Safely enhance tables without touching original design
Support upgrades without breaking existing data
In large enterprise systems, this separation is very important.
Types of Structures in SAP
There are two main types of structures used in real projects:
1️⃣ Include Structure
An Include Structure is a reusable structure that can be inserted into:
Tables
Other structures
It helps avoid duplication of common fields.
2️⃣ Append Structure
An Append Structure is used to add new fields at the bottom of an existing table, especially standard SAP tables.
It is the SAP-recommended way to enhance tables.
Creating a Structure (Step-by-Step)
Step 1: Open ABAP Dictionary (SE11)
Go to SE11
Select Data Type
Enter a custom name (starting with
ZorY)Click Create
Choose Structure
This tells SAP:
“I want to create a grouped set of fields, not a table.”
Step 2: Define Structure Details
A new screen opens where you must:
Enter a Short Description
Add required fields using Data Elements
📌 Just like tables, structures should always use Data Elements, not raw data types.
Step 3: Save and Activate
Click Save
Assign a Package
Accept the Transport Request (TR)
Click Activate
Once activated, the structure becomes globally usable across the system.
Include Structure (Reusable Fields)
What Is an Include Structure?
An Include Structure allows you to insert a predefined set of fields into a table or another structure.
Real-World Analogy
Imagine a form where Address fields appear everywhere:
Customer
Vendor
Employee
Instead of creating address fields again and again, SAP lets you include them once.
How to Include a Structure in a Table
Open the table in SE11 (Change mode)
Select the row where fields should be added
Go to Edit → Include → Insert
Select the created structure
Activate the table
SAP adds a special row called:
.INCLUDE
📌 This means fields are coming from another structure.
Result
Fields appear as part of the table
Data is stored normally
Maintenance is centralized
You can view this in SE16 / SE16N like any other table.
Append Structure (Enhancing Tables Safely)
What Is an Append Structure?
An Append Structure is used to add new fields at the end of an existing table.
This is especially important when:
Enhancing standard SAP tables
Ensuring upgrade safety
Why Append Structures Are Important
SAP does not allow direct changes to standard tables.
Append Structures:
Keep SAP upgrades safe
Prevent conflicts
Are officially supported by SAP
tly paste this into your blog.
Steps to Create an Append Structure in SAP (7 Clear Steps)
Step 1: Open ABAP Dictionary (SE11)

Enter SE11 in the SAP command field and press Enter
This opens the ABAP Dictionary, where tables and structures are defined

Step 2: Open the Table in Change Mode

Select Database Table
Enter the table name you want to enhance
Click Change
📌 The table must be in change mode to add an append structure.
Step 3: Select the Last Empty Row

Scroll to the bottom of the table fields
Click on an empty row at the end
This ensures new fields are added after all existing fields.
Step 4: Choose “Append Structure”

- Click on Append Structure button
(or use menu path: Edit → Append Structure)
SAP will now create a separate structure linked to this table.
Step 5: Enter Append Structure Name

Enter a name for the append structure
(must start with Z or Y for custom development)Click Enter

📌 Naming rule keeps custom changes separate from standard SAP objects.
Step 6: Add New Fields

Enter the required fields in the append structure
Always use Data Elements (not raw data types)
Provide meaningful field names and descriptions
These fields will appear at the bottom of the table.

Step 7: Save, Assign TR, and Activate

Click Save
Select the Package
Accept the Transport Request (TR)
Click Activate
✅ Once activated, the append structure becomes part of the table and is ready for use.
Include vs Append Structure (Easy Comparison)
| Aspect | Include Structure | Append Structure |
| Purpose | Reuse fields | Enhance tables |
| Field Position | Anywhere | Always at bottom |
| Used in | Tables & structures | Tables only |
| Upgrade Safe | Yes | Yes (recommended) |
| Common Use | Common fields | Custom extensions |
Why Structures Matter in Real Projects
Structures help SAP:
Stay modular
Reduce duplication
Support clean architecture
Handle upgrades smoothly
Every professional SAP developer or consultant uses structures daily.
Moving Developments to QAS in SAP (Step-by-Step Guide)
In SAP, changes are never moved manually between systems.
Everything goes through Transport Requests (TRs) to ensure control, safety, and traceability.
Most SAP landscapes follow this flow:
DEV → QAS → PROD
This section explains how to move your development objects from DEV to QAS using TOC (Transfer of Copies).
What Is TOC (Transfer of Copies)?
TOC is a special type of transport used to:
Copy objects from an existing transport request
Move them to another system (QAS)
Without releasing or disturbing the original transport
Simple Analogy
Think of TOC like:
Sending a photocopy of your work for testing, while keeping the original safe.
Step-by-Step: Moving to QAS Using TOC
Step 1: Open Transport Organizer (SE01)

Enter SE01 in the SAP command field
Press Enter
SE01 displays all transport requests available to you.
Step 2: View Transport Request List

SAP shows a screen with folder hierarchies
These folders contain:
Your development requests
Customizing requests
Previous transports
This is where SAP tracks all changes made in the system.
Step 3: Identify the Original Transport Request

Locate the transport request that contains your objects
Select the request
Use Ctrl + Y to highlight the Transport Request ID
Copy it using Ctrl + C
📌 This ID will be used to copy objects into the TOC.
Step 4: Create a New Transport Request

- In SE01, click Create (top right corner)
This tells SAP you want to create a new transport container.
Step 5: Select Transport Type as TOC

When prompted, select TOC (Transfer of Copies)
Click Save
This confirms that:
You are creating a copy
The original transport remains unchanged
Step 6: Enter TOC Description

- Enter a short, meaningful description
(Example: “TOC for QAS testing – custom table and structures”)
SAP automatically generates a new TOC transport number.
Step 7: Include Objects into TOC

Click Include Objects
Paste the copied original transport ID
SAP copies all objects from the original request into the TOC
You will now see all related objects listed under the TOC.
Step 8: Switch to QAS System

Log in to the QAS system
Enter transaction STMS_IMPORT
This is the SAP Transport Management System used to import requests.
Step 9: Filter the Transport Request

Select Request
Click Filter
Paste the TOC transport ID
Click Refresh

SAP now displays only your TOC request.
Step 10: Import the TOC into QAS

Select the transport request


Click Import Requests

Enter the Target System (example:
270)
Review options and confirm

Click Yes

SAP now starts importing the transport.
Step 11: Verify Successful Import
Once completed:
SAP shows a successful import status
Objects are now available in QAS
You can test tables, structures, and programs safely

🎉 Your development has been successfully migrated to QAS
Why This Process Is Important
SAP enforces transport control to ensure:
No accidental changes in production
Full traceability of who changed what
Safe testing before go-live
Using TOC:
Keeps original transport untouched
Allows parallel testing
Is widely used in real projects
Key Takeaways
SE01 → Manage transport requests
TOC → Copy transport without releasing original
STMS_IMPORT → Import into QAS
SAP never allows manual movement of objects
Transport management is core to SAP system safety
One-Line Summary
TOC is the safest way to move development work to QAS for testing without affecting the original transport request.
In conclusion, the process of creating tables, foreign keys, and structures in SAP ABAP, as well as transporting them to the QAS system, is crucial for maintaining data integrity and ensuring smooth system operations. By following the detailed steps outlined, developers can efficiently manage data storage, enhance existing tables, and ensure safe testing environments. The use of Transport Requests and Transfer of Copies (TOC) ensures that changes are controlled, traceable, and do not disrupt the production environment. This structured approach is essential for maintaining the reliability and performance of SAP systems in real-world enterprise scenarios.




