将asp.net或webservice应用程序连接到SAP B1

时间:2017-01-27 05:40:14

标签: asp.net web-services

我们如何将asp.net或webservice应用程序连接到SAP B1?

任何人都可以提供清晰的示例代码和示例来连接SAP B1中可用的任何模块吗?

2 个答案:

答案 0 :(得分:0)

首先,您必须安装DIAPI 请参阅SAPbobsCOM

闷棍连接

        SAPbobsCOM.Company oCompany = new SAPbobsCOM.Company();
        conectado = int.MinValue;
        oCompany.Server = "localhsot";
        oCompany.CompanyDB = "DB";
        oCompany.DbUserName = "SQL_USER";
        oCompany.DbPassword = "PASS_SQL";
        oCompany.UserName = "USER_SAP";
        oCompany.Password = "PASS_SAP";

        //language
        oCompany.DbServerType = BoDataServerTypes.dst_MSSQL2012;
        oCompany.language = BoSuppLangs.ln_Spanish_La;

        conectado = oCompany.Connect();
        if (conectado != 0)
            string error = oCompany.GetLastErrorDescription();

使用此对象,您可以使用DIAPI

打开任何sap模块

示例sap文档

SAPbobsCOM.Documents oDocuments = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oQuotations);

答案 1 :(得分:0)

如果已配置并正在运行SAP B1服务层,那么我建议您在SAPbobosCom上使用它。它具有更好的性能,但请注意,您无法运行SQL查询。服务层是REST api,并使用oData协议。