Attach a file to purchase requisition

Hi Experts,

We have a requirement of attaching a file of any type(Doc,PDF,TXT,PPT) to the purchase requisition, We are able to attach a document through transaction(ME51n). Can any one please suggest are there any function modules or classes to do the same through coding.

Thanks in advance,