Hi Indraneel,
a) How to reprocess the failed messages send from legacy system to SAP.
You can process through SAP EM WebUI manually (copy all data from failed messages) which are failed from legacy system. However, it is little extra effort for users or support team to process each and every time.
If Middleware sends then you can reprocess from their system as they have monitoring tool where they can edit and resent to SAP EM/SAP TM system. We were performing same exercise in our previous project where we connected through 3 PL (non SAP TM).
b) Secondly in the middleware platform if we add a status code as error then is there some way where using this error code, there can be some mapping with EVm messages in EM environment so that in SAP SYSTEM, we can understand the failure of messages .
We have SAP EM standard Tcode /n/SAPTRX/ER_MS_LIST, where you can see inbound event message cancel or error or warning etc.
You can map middleware new status code to message class /SAPTRX/MSIO and add the status code to identify the error in system. However, you have to enhance BADI Interface /SAPTRX/IF_EX_BADI_MESSAGE~CHECK_MESSAGE for errors on specific codes. This is a little bit tedious job but it can be achievable.
Regards
GGOPIII