Document Handling - How to print the Attached document

Hi All,

I have a requirement like,

I am attaching a document for a particular item in the Item Master, then i open the production order Form, i create a production order for that item.

Now the requirement is i want to have one button in the production order form, by clicking the button it should open the document attached for the respective item in the Item Master form.

I wrote the below code in the button clicked event. but its not opening the document, rather i get a info message " The Function is not possible for this type". Can anyone help me out this?.. Thanks.

InventTable inventTab;

DocuRef docRef;

DocuAction docAction;

MenuFunction menuFunction4;

Args args = new Args();

Args args1 = new Args();

;

super();

args.record(ProdTable);

inventTab = InventTable::find(ProdTable.ItemId);

docRef = DocuRef::find(inventTab.dataAreaId,inventTab.RecId);

args1.record(docRef);

menuFunction4 = new MenuFunction(menuitemactionstr(DocuActionOpen),MenuItemType::Action);

menuFunction4.run(args1);