通过.net C#调用Post深度插入SAP OData服务

时间:2019-04-22 12:58:47

标签: .net post insert odata

已使用以下sapblog创建了odata服务。 https://blogs.sap.com/2018/03/30/sap-odata-post-multiple-table-input/ 我想在我的.net代码中使用它。如何命名?

新实体类型–使用深层实体方法为SAVE调用创建的CustIndentTripSaveHdr,CustIndentTripSaveItm,CustIndentTripSaveResult。

我叫这个

        CustIndentTripSaveHdr custIndentTripSaveHdr = new CustIndentTripSaveHdr();
        custIndentTripSaveHdr.CustomerCode = CustomerCode;

        CustIndentTripSaveItm custIndentTripSaveItm = new CustIndentTripSaveItm();
        custIndentTripSaveItm.CustomerCode = "12345";
        custIndentTripSaveItm.Diesel = 0;

        custIndentTripSaveHdr.NAV_ITEM.Add(custIndentTripSaveItm);

        CustIndentTripSaveResult custIndentTripSaveResult = new CustIndentTripSaveResult();
        custIndentTripSaveResult.CustomerCode = CustomerCode;
        custIndentTripSaveResult.MessageText = "";
        custIndentTripSaveResult.MessageType = "";

        custIndentTripSaveHdr.NAV_RESULT = custIndentTripSaveResult;

        container.AddToCustIndentTripSaveHdrSet(custIndentTripSaveHdr);

然后

container.SaveChanges();

我在做什么错? xml不会以应有的格式生成。 标头应包含多个项目。 我该如何食用?

0 个答案:

没有答案