Skip to Content

Export Crystal Report UI/DI API

Feb 13, 2017 at 10:40 AM


avatar image
Former Member

Hello everybody,

I want to export to an .rpt file a specific sales order taken from DocNum or DocEntry code. Later I want to convert .rpt file to .pdf file and send it via email. I have found many solutions on converting .rpt to .pdf and send .pdf via email but I can not create the .rpt file from my UI/DI API.

I read the solution given in this thread but on second line of code I get an exception

Unable to cast COM object of type 'System.__ComObject' to interface type 'SAPbobsCOM.ReportParams'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{0B4E873F-65FD-4638-9339-84D197CF8109}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).

The problem is even if I did not get above exception I don't see a way in this particular solution a way to create a .rpt file with a specidic Sales Order DocEntry or DocNum.

Any help is much appreciated.


Is there at least a way to Export "Preview" of current Sales Order form? Menu UID of Preview is 519 but choosing it will only open Preview form with out an option to export it to a pdf file

Kind Regards,


10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
avatar image
Former Member Feb 13, 2017 at 04:22 PM

I managed to find some kind of solution using Form Data Event when a new sales order is added successfully and export that sales order to an .xml file using SAPbobsCOM.Documents

string query = "SELECT * FROM ORDR WHERE DocNum = '" + SBO_Application.Forms.ActiveForm.Items.Item("8").Specific.Value + "'";
SAPbobsCOM.Recordset oRs;
oRs = (SAPbobsCOM.Recordset)oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
oDoc = (SAPbobsCOM.Documents)oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oOrders);
oDoc.SaveToFile(System.IO.Directory.GetParent(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)).FullName + @"\test.xml");

The problem now is I can not convert exported xml file to .pdf file.

If any one has a better idea or an xml to pdf conversion method and shares it, it would be much appreciated.

Kind Regards,


10 |10000 characters needed characters left characters exceeded