MM02 - store standard error in custom table

Hi.

I need to store the error message occurs in Pgm: SAPLMGD01 / incl: LMGD1I1V in a custom table.

I tried BADI material check and exit_saplmgmu-001 but the error occurs before these are triggered.

Can any help with this requirement?