on 07-26-2010 5:55 PM
Hi all,
I recently had to print information of a UDO which I have on a new form. I searched through the forum and found different solutions, but none that used the new "integrated" crystal reports viewer. So I came up with this workaround, which so far works great. I post it here for anybody else needing this kind of workaround, or in case somebody has a better solution, pick that up.
Here it is:
1) Create your Crystal Report file and import using the Reports and Layouts screen in SAP Business One. Give it a meaningful name and location in the menu. Have at least one parameter to take the DocNum or DocEntry, or whatever your primary key is. (Note: I know the import can be done by SDK, but as far as I can see there's no way to place it in the menu structure just yet.)
2) In your Add-On in the event ID 520 (print), call the following function with the Document Number grabbed from the open form:
public static bool printUDO(string strDocNum)
{
// get menu UID of report
Recordset oRS = (Recordset)B1Connections.diCompany.GetBusinessObject(BoObjectTypes.BoRecordset);
oRS.DoQuery("SELECT MenuUID FROM OCMN WHERE Name = 'ReportName' AND Type = 'C'");
if (oRS.RecordCount == 0)
{
B1Connections.theAppl.MessageBox("Report layout 'ReportName' not found.", 0, "OK", null, null);
return false;
}
// execute menu and enter document number
B1Connections.theAppl.ActivateMenuItem(oRS.Fields.Item(0).Value.ToString());
Form form = B1Connections.theAppl.Forms.ActiveForm;
((EditText)form.Items.Item("1000003").Specific).String = strDocNum;
form.Items.Item("1").Click(BoCellClickType.ct_Regular); // abrir reporte
return true;
}
I know it's kind of a dirty solution, but it works, and if you have any suggestions, I'd be happy to hear them.
Thanks!
Joerg.
Hi Joerg Aldinger ,
thanks good solution dear for udo
Thanks
Rajkumar Gupta
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Joerg,
It's not a dirty solution... I like it and i'm using it
Thanks!
Best regards,
Ana Silva
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sorry, I edited this message by mistake...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
108 | |
12 | |
11 | |
6 | |
5 | |
4 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.