I searched for Enhancements for ME21N to add custom fields . I found lot of examples unfortunately i didn't come across complete Step by Step Process.So i decided to give a elaborate document.
Enhancement used for ME21N , ME22N , ME23N is MM06E005.
1) If we know the Enhancement name we can directly use it or we can search it in SMOD Transaction.
2) T code to implement Enhancement Project is CMOD.
Give Project name and click CREATE push button.
Give short text and select COMPONENTS push button.
In this screen we can find Function Exit, Screen Exit and Include tables.
For HEADER LEVEL - For adding Custom Tabs, Custom fields in Header level .
EXIT_SAPMM06E_006 - Export Data to Customer Sub screen for Purchasing Document Header (PBO)
This Function Exit is PBO (Process before output). We can add custom logic in this Exit.
Process : Double click on EXIT_SAPMM06E_006 Go to SOURCE CODE tab and you will find INCLUDE file . double click the INCLUDE file and add your
custom code.
INCLUDE ZXM06U36 .
EXIT_SAPMM06E_007 - Export Data to Customer Sub screen for Purchasing Document Header (PAI)
This Function Exit is PBO (Process before output). We can add custom logic in this Exit.
Process : Double click on EXIT_SAPMM06E_007 Go to SOURCE CODE tab and you will find INCLUDE file . double click the INCLUDE file and add your
custom code.
INCLUDE ZXM06U38 .
For ITEM LEVEL - For adding Custom Tabs, Custom fields in Item level .
EXIT_SAPMM06E_016 : Export Data to Customer Sub screen for Purchasing Document Item (PBO).
EXIT_SAPMM06E_018 : Import Data from Customer Sub screen for Purchasing Document Item
Before Creating Screen.
Create STRUCTURE with Required Fields in custom includes CI_EKKODB and CI_EKPODB
CI_EKKODB - Header Data.
CI_EKPODB-Item Data.
---> Now in Screen Exit Section.
use SAPMM06E this is Program Name.
Go to SE38-- Create Program by giving name SAPMM06E.
Go to SE51-- Create Sub-Screen with Screen Number 0111 ( Check Sub-Screen Box) .
----Now Adding Required Code----
Function Exit :
EXIT_SAPMM06E_016 - PBO
Include File:
INCLUDE ZXM06U41 .
Function Exit :
EXIT_SAPMM06E_018 - PAI
Include File:
INCLUDE ZXM06U40 .
This code is to Update Data Base Table EKPO.
Now Coding Part is Completed.
Go to ME21N - In ITEM LEVEL You will find CUSTOMER DATA Tab. In that Tab you will find COST CENTER Field.
EKPO TABLE : CHECK THE DATA.
Same Steps you can follow for adding FIELDS in HEADER LEVEL .