Introduction

In SAP enhancements, adding validations is relatively simple.

But adding custom fields to a standard SAP screen — and making them persist correctly — requires deeper understanding.

Many developers successfully display custom fields using a Screen Exit, but then face the common issue

“The fields are visible… but the data is not saving.”

This blog explains

• Screen Exit architecture

• Table enhancement rules

• Subscreen creation

• PBO/PAI data flow

• CMOD control

• Real limitations of Customer Exits

• Why SAP prefers BAdIs today

Part 1: What is a Screen Exit?

A Screen Exit allows you to

👉 Add additional fields to a standard SAP transaction screen

👉 Without modifying SAP standard screens

It is a structured way to extend UI in classic Dynpro-based SAP transactions.

SAP provides

• A Subscreen Area

• Inside which customers can plug in their own Subscreen

Important Rules About Screen Exits 🚨

These are frequently asked in interviews.

1. Not every SAP transaction is enhanceable

2. You cannot add fields anywhere you want

3. SAP provides a predefined subscreen area

4. You must create a subscreen

5. Subscreen must sit inside SAP’s subscreen area

Screen Exit Architecture

Main SAP Screen (Normal Screen)
 └── Subscreen Area (Provided by SAP)
       └── Subscreen (Created by Customer)
             └── Custom Fields

SAP decides placement — not the developer.

Part 2: Real Scenario – MP01 Transaction

Transaction: MP01 – Maintain Approved Manufacturer Parts List

Goal

Add custom fields on the details screen.

We focus only on enhancement feasibility — not business process.

Step 1: Identify Screens in the Transaction

Navigate through Initial screen, List/ALV screen and Details screen.

Customer wants additional fields in Details screen.

Now we must identify:

👉 Where SAP allows screen enhancement.

Step 2: Identify Screen Exit

Step 2.1 – Find Main Program

• Transaction: SE93

• Enter: MP01

• Find main program

Step 2.2 – Find Package

• Open program → Attributes

• Package: ME

Step 2.3 – Search Customer Exits

• SE84 → Enhancements → Customer Exits

• Enter package: ME

Multiple exits appear.

⚠️ No one tells you which one to use.

You must analyse Description, Components, Documentation and Function module signature

Sometimes, developers implement dummy code and debug to identify correct trigger point.

Step 3: Correct Exit Identified

Exit: AMPL0001

Description: “User Subscreen for additional data on MPL”

Strong hint → Screen Exit.

Step 4: Confirm Screen Exit Support (SMOD)

In SMOD --> Components:

Component Present

Function Exits Yes

Menu Exits No

Screen Exits ✅Yes

Confirmed.

Part 3: The Most Important Rule – Table First, Screen Later

🚨 Screen Exit does NOT store data automatically

Before adding fields on screen, you must:

1. Identify base table

2. Add fields at table level

3. Then display on screen

From documentation:

Define your fields in include CI_AMPL

Base table: AMPL

Customer Include: CI_AMPL

How to Add Fields to Standard Table

Two cases:

Scenario Method

Customer include exists Use CI_TABLENAME(check in the table)

No Include Use Append Structure

In this case:

CI_AMPL exists

Add Fields in SE11

Inside CI_AMPL:

Example fields

• ZZ_CUST_NAME

• ZZ_CUST_ADDR

Best Practices:

• Always use Z/Y namespace

• Create proper Data Elements

• Maintain Domains

• Maintain field labels

Why?

• Labels auto-appear on screen

• Reusable

• Upgrade-safe

• Professional design

After activation, table AMPL now includes custom fields.

✔ Table work completed.

Part 4: Create Subscreen

From SMOD, SAP Provides

Item Value

Main Screen Program SAPLMBAM

Screen Number 0120

Subscreen Area USER0001

Subscreen Program SAPLXAMP

Subscreen Number 1000

Verify Main Screen (SE51)

Program: SAPLMBAM

Screen: 120

Layout shows Subscreen Area USER0001.

This confirms placement location.

Create Subscreen (SE51)

Program: SAPLXAMP

Screen: 1000

⚠️ Screen Type must be: Subscreen

If created as Normal → runtime dump.

Add Fields to Subscreen

In layout:

• Dictionary/Program Fields

• Table: AMPL

• Select:

• ZZ_CUST_NAME

• ZZ_CUST_ADDR

• Activate.

Now fields appear visually in MP01.

But… ❌ Data still not saving.

Part 5: Why Data Is Not Saved?

Because: Screen Exit only shows fields.

SAP does Not automatically move data between

• Program

• Screen

• Database

You must handle data flow manually.

Golden Rule of the Screen Exits

Almost every Screen Exits comes with:

Function Exit Equivalent Event

PBO Exit Process Before Output

PAI Process After Input

Part 6: Understanding Data Flow

PBO (Program → Screen)

Database → Import Parameter → Screen Fields()

PAI (Screen → Program → DB)

Screen fields → Export Parameter → database

Identify PBO & PAI Function Exits

Customer Exit: AMPL0001

Function Exits Available in Components(SMOD)

1. EXIT_SAPLMBAM_001

👉 Transfer item data to subscreen

👉 PBO Function Exit

2. EXIT_SAPLMBAM_002

👉 Adopt item data from user screen

👉 PAI Function Exit

PBO Exit – Display Default Values

PBO Function Module Signature

Import parameter: I_AMPL

Contains:

• Standard fields

• Custom fields (from CI_AMPL)

Where to Write Code?

• Go to CMOD

• Components → double click Function Exit "EXIT_SAPLMBAM_001"

• Double click Z-include

• Write logic inside include

Important learning:

❌ Assigning values to I_AMPL alone is not enough

✅ You must assign values to screen fields too

Screen fields must be declared:

TABLES: ampl.

Example logic:

I_ampl-zz_cust_name = 'RMAX'.
I_ampl-zz_cust_addr = 'Kanpur'.
ampl-zz_cust_name = i_ampl-zz_cust_name.
ampl-zz_cust_addr = i_ampl-zz_cust_addr.

Result:

✔ Default values visible

PAI Exit – Save User Data

Problem still Remaining

• User changes values

• Clicks Back / Save

• Data still not stored

👉 Need PAI Function Exit

PAI Function Module Signature

• Export parameter: E_AMPL

Where to Write Code?

• Go to CMOD

• Components → double click Function Exit EXIT_SAPLMBAM_002

• Double click Z-include

• Write logic inside include

Logic:

TABLES: ampl.

e_ampl-zz_cust_name = ampl-zz_cust_name.
e_ampl-zz_cust_addr = ampl-zz_cust_addr.

Now:

✔ User input saved

✔ Data persisted in AMPL

✔ Verified via SE11

Full Screen Exit Lifecycle

User opens Details → PBO triggered → Data Shown → User Edits → PAI triggered → Data saved

Part 7: CMOD Activation Control

Without CMOD project:

❌ Exit will never execute

Action Effect

Activate project All exits active

Deactivate project All exits inactive

No partial activation.