I would like to share my knowledge on BADI. Recently we done restriction on Po by using BADI. In a custom development there was a requirement to restrict on PO creation to compare with certain parameters.
- document type and Purchasing Org parameters need control on field PR mandatory. Not for only PR mandatory some other requirement like control on qty comparing with document suppose by using ZPPN document type qty should not exceed by 10 on each line item like.
In PO some of restrictions it is possible through configuration but some of the requirements we need to go by custom development
Use of BADI
In standard lot of BADI’s available, these are helpful to achieve the requirements. For example i am using BADI for above requirement ME_PROCESS_PO_CUST.
You can go in se19 enter your BADI details you can check interfaces and classes in BADI. Check in interface tab there are lot of classes helpful to control on part in PO.
See below classes
INITIALIZE Initializations (Invoked Once Only)
OPEN Open a Purchase Order
PROCESS_HEADER Processing of Header Data
PROCESS_ITEM Processing of Item Data
PROCESS_SCHEDULE Processing of Delivery Schedule Line Data
PROCESS_ACCOUNT Processing of Account Assignment Data
CHECK Closing Check
Here we have option, where you want control on PO. If suppose you want control on item level you can with Process_ Item.
If you want control on header level you can use PROCESS_HEADER, at schedule line tab then use PROCESS_SCHEDULE, at Item level the PROCESS_ITEM. IF you want control on check level then use CHECK.
By using this BADI you can control on ME21N and ME22N
Conclusion: This BADI not only for this requirement you can do any new requirement related to Po field control by using different Parameters.
See below examples:
- Suppose client requirement is For document type NB, Purchasing accepted only 1001
- If suppose for document type ZNB, tax code should be VN.
- Validation with PR line item with PO schedule line items
- And also you can users with different parameters. Etc….
Mepoitem for item details updating in me21n
Mepoheader for header details updating in me21n
Meposchedule for schedule delivery details updating me21n
In standard there are lot of BADI’s helpful to achieve the client requirement.For Example:
How to find BADI for transaction code
For example ME21N
Go to Menu bar system —- status — Program,
Double click on; it will go inside the program
Again go to Menu bar GOTO —- attributes — Development class/Package .
Go to SE80 — give your package
It will display available components in it along with enhancement
Check in enhancement , here you can find related BADI’s.