Table Maintenance Generator in SAP ABAP: Step-by-Step Guide
Table of Contents
- • Technical Architecture of a TMG
- • Why Use Table Maintenance Generators?
- • One-Step vs. Two-Step Maintenance Types
- • Prerequisites Before Generating a TMG
- • Step-by-Step Guide: Creating a TMG in SE11
- ↳ Step 1: Open Transaction SE11 & Load Table
- ↳ Step 2: Launch Generator Tool
- ↳ Step 3: Configure TMG Parameters
- ↳ Step 4: Execute Generation
- • Testing TMG in Transaction SM30
- • Advanced TMG Feature: Creating a Custom T-Code via SE93
- ↳ Steps in SE93:
- • Advanced TMG Feature: Injecting Custom Validation via TMG Events
- ↳ Step-by-Step TMG Event Configuration:
- • How to Regenerate TMG After Table Structure Changes
- ↳ Steps to Regenerate:
- • Troubleshooting Common TMG Errors
- ↳ 1. Error: “Screen 0001 does not exist”
- ↳ 2. Error: “Maintenance not allowed for table”
- ↳ 3. Error: “System is client-dependent / Transport prompt appearing”
- • Frequently Asked Questions
- ↳ 1. Can I use a Table Maintenance Generator for standard SAP tables?
- ↳ 2. What is the difference between SE16N and SM30?
- • Standard Summary
![]()
A Table Maintenance Generator (TMG) is a built-in utility within the SAP ABAP Dictionary (SE11) that automatically creates dialog screens and processing logic for custom database tables.
When custom tables are built to store business rules, lookup data, or company configuration mapping, functional consultants and key users need an interface to create, update, and delete database records. Rather than writing custom CRUD (Create, Read, Update, Delete) module pool screens from scratch, developers generate a TMG interface in seconds. The generated interface is then executed through transaction SM30 (Table Maintenance) or custom transaction codes created in SE93.
Technical Architecture of a TMG
When you generate a TMG in transaction SE11, SAP creates a complete dialog environment behind the scenes inside a designated Function Group:
- Function Pool / Main Program: A container program holding global data declarations (
TABLES: ztable), PBO (Process Before Output) modules, and PAI (Process After Input) modules. - Dynpro (Screens):
- Overview Screen (Dynpro 0001): Displays table entries in a multi-row table control or table control grid.
- Single Screen / Detail Screen (Dynpro 0002): Displays a single record in a form-style layout for tables with large numbers of columns.
- Generated Maintenance Modules: Standard SAP routines that execute database locking (
ENQUEUE/DEQUEUE), transport request recording, authorization checks, and database commits (COMMIT WORK).
+-------------------------------------------------------------+
| Transaction SM30 / Custom T-Code |
+------------------------------+------------------------------+
|
v
+-------------------------------------------------------------+
| Function Group (e.g., ZFG_MAINTAIN) |
| |
| +-----------------------------------------------------+ |
| | Overview Screen (Screen 0001) | |
| | - Displays rows in ALV / Table Control | |
| +-----------------------------------------------------+ |
| | Detail Screen (Screen 0002 - Optional) | |
| | - Form view for single record | |
| +-----------------------------------------------------+ |
| | PBO / PAI Validation Modules & Event Hooks | |
+------------------------------+------------------------------+
|
v
+-------------------------------------------------------------+
| Database Table (e.g., ZEMPLOYEE) |
+-------------------------------------------------------------+
Why Use Table Maintenance Generators?
Creating manual ABAP screens for data entry requires handling screen layouts, OK-Code handling, database locks (LOCK_...), transport logs, and input validation routines. TMG handles these requirements automatically:
- Zero Hand-Written Screen Code: Screens, toolbars, menu painter interfaces (
GUI STATUS), and database routines are compiled automatically. - Built-in Security Controls: You can restrict table access by assigning explicit Authorization Groups (
SU21). - Transport System Integration: TMG automatically prompts for transport requests when maintaining client-independent configuration tables.
- Event Hooks: Developers can inject custom validation logic (such as checking mandatory combinations or auto-populating timestamps) using TMG Events.
One-Step vs. Two-Step Maintenance Types
When configuring TMG parameters in SE11, you must select between two screen maintenance architectures:
| Feature / Property | One-Step Maintenance | Two-Step Maintenance |
|---|---|---|
| Screen Architecture | Single Overview Screen (Screen 0001). | Overview Screen (0001) + Detail Screen (0002). |
| User Flow | Records are created, edited, and deleted directly within the multi-row table grid. | Users click “New Entries” or double-click a row to open a separate form view screen. |
| Best Use Case | Small tables with 2 to 8 fields (e.g., simple lookup maps, status codes). | Complex tables with 10+ columns where grid scrolling is cumbersome. |
| Screen Number Assignment | Requires only 1 screen number (Overview Screen). | Requires 2 screen numbers (Overview Screen + Detail Screen). |
Prerequisites Before Generating a TMG
Before running the generator wizard in SE11, verify that your table satisfies these technical requirements:
- Table Activation: The database table (e.g.,
ZEMPLOYEE) must be active inSE11. - Data Browser Maintenance Allowed: On the Delivery and Maintenance tab in SE11, set Data Browser/Table Maint. to Display/Maintenance Allowed.
- Function Group Exists: A custom Function Group (e.g.,
ZFG_EMP_MAINT) must be created inSE80orSE37and activated.
Step-by-Step Guide: Creating a TMG in SE11
Step 1: Open Transaction SE11 & Load Table
Enter SE11 in the SAP command field, select Database Table, type your table name (ZEMPLOYEE), and click Change.
.png)
Step 2: Launch Generator Tool
In the top menu, navigate to: Utilities ➔ Table Maintenance Generator

Step 3: Configure TMG Parameters
Enter the following generation settings:
- Authorization Group: Enter
&NC&(Without Authorization Group) for local test objects, or enter an explicit authorization group (e.g.,ZFIN) to restrict access. - Function Group: Enter your designated custom function group (e.g.,
ZFG_EMP_MAINT). - Maintenance Type: Select One Step (recommended for standard lookup tables).
- Maintenance Screens: Click Find Screen Numbers in the toolbar, select Propose Screen Numbers, and click the checkmark. SAP assigns available screen numbers (e.g.,
0001).

Step 4: Execute Generation
Click the Create button (white paper icon) on the top toolbar or press F6. Assign a Package (ZDEV) and a Transport Request when prompted. SAP compiles the function pool and generates dynpro screens automatically.
Testing TMG in Transaction SM30
- Open transaction SM30 in the command field.
- In the Table/View field, enter
ZEMPLOYEE. - Click Maintain.
- Use New Entries to insert rows, update existing fields, or select rows and click Delete.
- Click Save (
Ctrl + S) to commit changes to the database.
.png)
Advanced TMG Feature: Creating a Custom T-Code via SE93
End users should not be asked to open SM30 and type table names manually. Developers create custom transaction codes (e.g., ZMAINT_EMP) pointing directly to the table maintenance interface.
Steps in SE93:
- Open transaction SE93.
- Enter custom T-Code name
ZMAINT_EMPand click Create. - Enter short text:
Maintain Employee Master Data. - Choose option: Transaction with parameters (Parameter transaction).
- In Default Values:
- Transaction:
SM30 - Check Skip initial screen.
- Transaction:
- Under Default Values Table (Bottom section):
| Name of Screen Field | Value |
|---|---|
VIEWNAME | ZEMPLOYEE |
UPDATE | X |
- Save and test your new T-Code
ZMAINT_EMP. Users runningZMAINT_EMPjump straight into the data entry grid.
Advanced TMG Feature: Injecting Custom Validation via TMG Events
Sometimes you need custom validation rules when users save data in SM30 — for example, automatically converting lowercase entries to uppercase, or auto-populating CREATED_BY and CREATED_ON fields.
TMG provides Events to inject ABAP code into screen lifecycle stages:
Step-by-Step TMG Event Configuration:
- In SE11, open your table -> Utilities -> Table Maintenance Generator.
- From menu bar: Environment ➔ Modifications ➔ Events.
- Click New Entries.
Common Event Types:
- Event
01: Before saving data to database. - Event
05: Creating a new entry. - Event
18: After reading table entries.
- Choose Event
01(Before Save) and enter Editor Subroutine Name (e.g.,VALIDATE_AND_STAMP). - Click the Editor button (pencil icon) to generate the form routine in the function group:
*----------------------------------------------------------------------*
* Form Routine for TMG Event 01 (Before Save Data)
*----------------------------------------------------------------------*
FORM validate_and_stamp.
DATA: ls_employee TYPE zemployee.
" Extract modified rows from internal table TOTAL processed by TMG
LOOP AT total INTO ls_employee.
" Custom Validation Rule: Employee ID must not be blank
IF ls_employee-emp_id IS INITIAL.
MESSAGE 'Employee ID cannot be initial!' TYPE 'E'.
ENDIF.
" Auto-populate audit fields
IF ls_employee-created_by IS INITIAL.
ls_employee-created_by = sy-uname.
ls_employee-created_on = sy-datum.
ENDIF.
" Update modified row back into TMG buffer
MODIFY total FROM ls_employee.
ENDLOOP.
ENDFORM.
How to Regenerate TMG After Table Structure Changes
If you add, rename, or delete columns in your database table in SE11, the existing generated TMG screens do not update automatically. Failing to adjust the TMG causes runtime syntax errors (TABLES_STRUCTURE_REFUSED) in SM30.
Steps to Regenerate:
- Activate your table structure changes in
SE11. - Go to Utilities ➔ Table Maintenance Generator.
- Click the Edit / Change (Pencil) icon on the toolbar.
- Select Adjust Screens and check Overview Screen.
- Confirm screen re-generation. SAP updates the dynpro table control layout to match the revised table fields.
Troubleshooting Common TMG Errors
1. Error: “Screen 0001 does not exist”
This occurs when the maintenance screens were deleted from the Function Group or were not activated properly during generation. To resolve this, open SE11 -> Utilities -> Table Maintenance Generator, click Delete (Trash icon), and then recreate the maintenance dialog from scratch.
2. Error: “Maintenance not allowed for table”
Ensure that on the Delivery and Maintenance tab in SE11, the dropdown setting Data Browser/Table Maint. is explicitly set to Display/Maintenance Allowed. If set to “Display/Maintenance Allowed with Restrictions” or “Not Allowed”, transaction SM30 will block maintenance requests.
3. Error: “System is client-dependent / Transport prompt appearing”
If your table contains client-independent settings, maintaining data in SM30 will prompt for a Workbench Transport Request. For client-specific operational tables where users should edit data directly in Production without transport prompts, ensure the table delivery class is set to A (Application table) and maintenance flag allows direct updates.
Frequently Asked Questions
1. Can I use a Table Maintenance Generator for standard SAP tables?
No, TMG is intended for custom Z or Y database tables and views. Modifying standard SAP tables using TMG can corrupt enterprise system integrity.
2. What is the difference between SE16N and SM30?
Transaction SE16N is an admin table viewer tool for checking database records. Transaction SM30 uses the Table Maintenance Generator framework to validate input, run authorization checks, and safely maintain records.
Standard Summary
The Table Maintenance Generator is an essential productivity tool in SAP ABAP development. Mastering TMG configuration, custom SE93 parameter transaction creation, and TMG event validation allows developers to deliver secure, reliable data maintenance solutions without writing repetitive screen code.
Written by Daksh Dedha
SAP Technical ConsultantDaksh is an SAP Technical Consultant specializing in ABAP programming, SAP S/4HANA migrations, Fiori development, and BTP cloud architecture. He authors free, hands-on tutorials to make enterprise SAP education accessible to all developers.
Test Your Knowledge
Loading question...
Quiz Completed
Related Tutorials
Search Helps in SAP ABAP — Elementary and Collective Search Help (SE11)
Complete guide to Search Helps in SAP ABAP. Learn how to create Elementary and Collective Search Helps in SE11, assign F4 help to input fields, and use search help exits.
Data DictionarySE11 Transaction Code in SAP ABAP: Complete ABAP Dictionary Guide
Master the fundamentals of the SE11 transaction code in SAP ABAP. Learn how to navigate the ABAP Dictionary, create tables, domains, views, search
Data DictionaryHow to Create a Structure in SAP ABAP (SE11) – Step-by-Step Guide
Learn what a structure is in SAP ABAP, how it differs from a database table, and the step-by-step process to create and use structures in ABAP programs.
Found this tutorial useful? Share it with your SAP development team.