I am creating an add on which will open a Crystal Report from BP Master, there will be a button which will open that. But i am not be able to call the default SAP B1 Report viewrr . Can anybody sugest me that ?
Asked
Active
Viewed 1,397 times
1
-
1Have you tried `Application.SBO_Application.ActivateMenuItem("519");` on the button click event? – Vyron Paschalidis Nov 18 '19 at 12:58
-
1Yes, But how can i pass the parameter ? – Nov 18 '19 at 13:29
-
1Try getting the active form `Application.SBO_Application.Forms.ActiveForm` and complete the EditText(s). Their ID will always be the same when the parameter form opens and then `oButton.Click()` (after you assign the `oButton` to the Ok button, whose ID will also never change) to accept the parameters. – Vyron Paschalidis Nov 18 '19 at 14:51
-
1It is not a pretty task but this is the approach I take for some time now. With 9.3 I haven't found something prettier on the UI side. – Vyron Paschalidis Nov 18 '19 at 14:52
1 Answers
2
public static bool Layout_Preview(string ReportName, string First_Parameter)
{
Recordset oRS = (Recordset)SBOC_SAP.G_DI_Company.GetBusinessObject(BoObjectTypes.BoRecordset);
oRS.DoQuery("SELECT MenuUID FROM OCMN WHERE Name = '" + ReportName + "' AND Type = 'C'");
SAPbouiCOM.Form form = null;
if (oRS.RecordCount > 0)
{
string MenuID = oRS.Fields.Item(0).Value.ToString();
SBOC_SAP.G_UI_Application.ActivateMenuItem(MenuID);
form = SBOC_SAP.G_UI_Application.Forms.ActiveForm;
((EditText)form.Items.Item("1000003").Specific).String = First_Parameter;
form.Items.Item("1").Click(BoCellClickType.ct_Regular);
return true;
}
else
{
SBOC_SAP.G_UI_Application.MessageBox("Report layout 'ReportName' not found.", 0, "OK", null, null);
return false;
}
}
-
1Could you mark the sample code as the correct answer (even if its yours, it is the proper way to do it) – Vyron Paschalidis Nov 19 '19 at 09:02
-
1