如何使用c#打开SAP Business One报表查看器

时间:2019-11-18 10:07:02

标签: c# crystal-reports sap sapb1

我正在创建一个附加项,它将打开BP Master的Crystal Report,将有一个按钮将其打开。但是我无法调用默认的SAP B1报告viewrr。有人可以向我求婚吗?

1 个答案:

答案 0 :(得分: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;
                    }

                }