Prerequisites
SAP Enhancement
https://www.dsawithpiyush.com/post/sap-enhancements
Customer Exits
IntroductionSo far in Customer Exits, we have covered
• Function Exits → Validations
https://www.dsawithpiyush.com/post/customer-exits-real-time-requirement-using-function-exit
• Screen Exits → Additional Fields
Now we move to the third and final type
👉1️⃣ Menu Exits
Menu Exits allow you to add custom menu items (buttons or menu entries) to standard SAP transactions - without modifying SAP code.
This blog focuses ONLY on:
• Adding new menu options
• Not validations
• Not screen fields
For example, a transaction may already have menus like Edit, Goto, Extras.
SAP may allow you to plug in your own menu item inside one of these menus — but only at predefined enhancement points.
🚫 You cannot add menu items anywhere you want.
2️⃣ Key Rule (Very Important)
❌ Not every transaction supports menu enhancement
❌ Not every menu allows custom items
✅ Only transactions explicitly designed by SAP allow Menu Exits
So the first job of a consultant is Find whether a menu exit exists or not
If no exit exists → enhancement is NOT possible (without modification).
If no exit exists → enhancement is NOT possible (without modification).3️⃣ How SAP Menu Items Work
Every menu item in SAP is connected to:
Menu Item → Function Code → Program Logic
When you click a menu option:
• A Function Code is triggered
• SAP handles it inside program logic
For customer menu items:
• Function codes usually start with +
o +CUS01
o +CUS02
SAP provides: Placeholder function codes & Hook (customer exit function module)
You provide: Menu text & Logic for function code handling
4️⃣ How SAP Triggers Menu Exits
Here is the runtime flow:
User clicks custom menu item → Function code is set (SY-UCOMM) → SAP calls customer exit function module → Your Z-include logic executes.
So,
👉 Business logic is written inside the function exit
👉 Menu item itself is only an entry point
5️⃣ How to Check if a Transaction Supports Menu Exit
There are two professional methods.
Method 1: Transaction → Program → Package → SMOD
Step-by-step:
1. Run the transaction
2. Go to: System → Status
3. Note the Program name
4. Open program in SE38
5. Check its Package
6. Go to SMOD
7. Display enhancements for that package
8. Look for:
o Menu exits
o Description mentioning
“menu”
“customer functions”
“function codes”
📌 If no menu exits exist → Enhancement NOT possible
Method 2: Search for CALL CUSTOMER-FUNCTION
Steps:
1. Open main program in SE38
2. Search for: CALL CUSTOMER-FUNCTION
3. If found
CALL CUSTOMER-FUNCTION '001'
Then:
• Exit exists
• Enhancement possible
• Number (e.g. '001') identifies the exit
Double-click → leads to function module.
This confirms:
✔ Customer exit exists
✔ Menu enhancement supported
6️⃣ What Exactly is a Menu Exit Technically?
Menu exits are delivered via:
• Customer Exit Enhancements
• Managed through SMOD / CMOD
• Implemented via Function Modules
They follow the same implementation pattern as Function exits & Screen exits. The only difference:
👉 Trigger point = Menu click
👉 Trigger point = Menu click7️⃣ Where Do You Write the Code?
Implementation process is identical to other customer exits
1. Create project in CMOD
2. Assign enhancement
3. Open enhancement components
4. Open function exit
5. SAP provides Z-include
6. Write logic ONLY inside that include
🚨 Important
Writing code in include without CMOD project assignment
→ Exit will NOT execute
CMOD project controls activation.
8️⃣ Classic Mistake – Menu Appears but Does Nothing
This is very common scenario
✔ Menu text assigned
✔ Function code exists
❌ No logic written in function exit
Result
• Menu item visible
• Clicking does nothing
Why?
Because SAP sets function code but no logic handles it.
Correct Logic Example
Inside Z-include:
CASE sy-ucomm.
WHEN '+CUS01'.
PERFORM do_something.
ENDCASE.
CASE sy-ucomm. WHEN '+CUS01'.
PERFORM do_something.ENDCASE.You must explicitly handle:
• Function code
• Associated business logic
Otherwise:
Menu click = No action.
Menu click = No action.🔁 Summary – 10 Revision Points
1. Menu exits allow adding extra menu items
2. You cannot add menus arbitrarily
3. SAP provides predefined enhancement points
4. Menu items are linked to function codes
5. Customer function codes usually start with +
6. Check exits using SMOD or CALL CUSTOMER-FUNCTION
7. Implementation must be done via CMOD
8. Logic is written in Z-include of function exit
9. Customer exits allow only single implementation
10. Prefer BAdIs in modern systems
Final Thought
Menu exits are powerful in legacy systems and support scenarios.
But in modern SAP landscapes — especially S/4HANA — you should always:
1. Search for BAdI first
2. Then enhancement framework
3. Then customer exit
4. Modification as last resort