cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

How to make z fields mandatory in ME21N(header level) at PO level?

MukhammadAziz
Newcomer
0 Kudos
136

Hello everyone!
We have created two fields in header level in transaction ME21N(contract number and its date)
Abaper made these field required but the PO can still be saved without filling the z fields.
These fields should be mandatory at PO level, whithout filling these fields, system shouldn't allow the PO to be saved. 
Can you please advise how to do this?

Accepted Solutions (0)

Answers (1)

Answers (1)

MOHAMMED_BASER
Active Participant
0 Kudos

Dear @MukhammadAziz 

The Z‑fields at the header level of ME21N (Purchase Order creation), but even though the ABAPer marked them as “required,” the PO can still be saved without values. That’s a common issue because simply setting the screen field as required in the screen painter or PBO logic doesn’t enforce the check at save/commit level.

Use BAdI ME_PROCESS_PO_CUST (Recommended)
This BAdI is specifically designed for custom validations in PO processing. Implement method PROCESS_HEADER or CHECK Read your Z‑fields from the header. If they are initial (empty), raise an error message (MESSAGE e...) so the PO cannot be saved. This ensures the system blocks SAVE until the fields are filled.

You can work with User Exit EXIT_SAPMM06E_012 (Include ZXM06U43)
This exit is triggered during PO checks. You can add similar validation logic here. Works, but less flexible and not as clean as the BAdI.

Hope above solutions will help you