首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >ODBC-2028错误SAP B1

ODBC-2028错误SAP B1
EN

Stack Overflow用户
提问于 2018-05-29 13:10:18
回答 1查看 6.1K关注 0票数 0

我正在尝试为SAP添加一个由DI B1提供的采购订单。我的代码正在我的客户端运行,但我尝试将其作为对另一家拥有不同数据的公司的一种补充。并给出了错误:“没有找到匹配的记录(ODBC-2028)”。下面是我代码的一部分:

代码语言:javascript
复制
public void createPOrderFor(int id,
                                string itemCode,
                                string itemName,
                                int qty,
                                int satisSip,
                                string cardCode,
                                string cardName,
                                string releaseDate)
    {
        SAPbobsCOM.Documents BO_item;
        BO_item = (SAPbobsCOM.Documents)getCompany().GetBusinessObject(SAPbobsCOM.BoObjectTypes.oPurchaseOrders);
        base.doConnectionInfo();
        server = base.server;
        database = base.database;
        user = base.user;
        pass = base.pass;

        string year = releaseDate.Substring(0, 4);
        string month = releaseDate.Substring(4, 2);
        string day = releaseDate.Substring(6, 2);
        releaseDate = year + "-" + month + "-" + day;

        BO_item.Lines.ItemCode = itemCode;            
        BO_item.Lines.ItemDescription = itemName;         
        BO_item.Lines.Quantity = qty;          
        BO_item.Lines.ShipDate = DateTime.Parse(releaseDate);           
        BO_item.Lines.UserFields.Fields.Item("U_SatisSip").Value = satisSip;           
        BO_item.Lines.Add();
        BO_item.Comments = satisSip + " numaralı satış siparişine istinaden";
        BO_item.CardCode = cardCode;
        BO_item.CardName = cardName;           
        BO_item.NumAtCard = "";
        BO_item.Series = 13;//birincil
        //BO_item.Segment -- it is read only.
        BO_item.TaxDate = DateTime.Now;
        BO_item.DocDate = DateTime.Now;
        BO_item.DocDueDate = DateTime.Parse(releaseDate);
        BO_item.SalesPersonCode = 4;//default Hakan Yılmaz
        BO_item.DocumentsOwner = 4;
        BO_item.DiscountPercent = 0.0;
        BO_item.Address2 = "TURKEY";
        BO_item.Address = "";
        BO_item.TransportationCode = 1;
        BO_item.AgentCode = null;
        BO_item.JournalMemo = "Satınalma siparişleri - " + cardCode;
        BO_item.GroupNumber = 1;//net30 
        BO_item.PaymentMethod = null;
        BO_item.Project = null;
        BO_item.UserFields.Fields.Item("U_SatSip").Value = satisSip;
        var retVal = BO_item.Add();
        int errorCode = 0;
        string errMsg = "";
        if (retVal != 0)
        {
            getCompany().GetLastError(out errorCode, out errMsg);
            SAPbouiCOM.Framework.Application.SBO_Application.StatusBar.SetText("Error: " + errMsg , SAPbouiCOM.BoMessageTime.bmt_Long, SAPbouiCOM.BoStatusBarMessageType.smt_Error);
        }
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-05-31 12:23:00

首先,删除所有空字段。如果存在无法提供值的DI对象字段,则不应将它们设置为等于null。

代码语言:javascript
复制
    BO_item.AgentCode = null;
    BO_item.PaymentMethod = null;
    BO_item.Project = null;

把它们完全移除。另外,尝试将所有日期字段的日期设置为这种格式:20180531作为测试,而不是20180531

BO_item.DocDate = "20180531"

如果它返回相同的错误,尝试在演示数据库中测试这个错误(可以从SAP partneredge获得)。

此外,确保用户定义的字段,您正试图为新客户的数据库中的存在设置值

让我知道它是如何为你工作的,这样我们才能继续。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/50585279

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档