Thanks for your response. I'm getting a "Object doesn't support property or method 'getParameter'" error. I have modified my code as below:
oButton = new sap.ui.commons.Button();
oButton.setText("Close");
oButton.attachPress(HandleButtonClick({dialog: oDialog}));
oDialog.addButton(oButton);
// Open Dialog
oDialog.open();
function HandleButtonClick(oEvent)
{ var Dialog = oEvent.getParameter("dialog");
Dialog.close();
}
Thanks