Hi Chaitanya,
IDOC status 51 refers to error state.
If there is no change that has to be made at IDOC level - you can directly re-process the same IDOC using BD87. This would change the IDOC status to 53, being successful.
Also, if you have to make changes at IDOC level - use transaction we19 to enter and correct the IDOC data. Once the data is corrected you can re-trigger the IDOC. This would create a new IDOC number for reference.
you can even use FM - IDOC_STATUS_WRITE_TO_DATABASE, to change the IDOC status.
Regards,
Kanika