使用S / 4HANA SDK消耗SalesOrderItem API

时间:2019-02-12 08:37:09

标签: s4sdk

我正在尝试使用

获取所有SalesOrderItems。

com.sap.cloud.sdk.s4hana.datamodel.odata.services.DefaultSalesOrderService

S / 4HANA SDK提供的

类,但响应始终为空列表,在日志中,我看到此错误:

c.s.c.s.odatav2.connectivity.ODataQuery  : Failed to convert response into ODataFeed: Illegal argument for method call with message 'to_ValueAddedService'.

内容:使用SDK的最新版本-2.9.1-,S / 4HANA系统的版本为1902。

这是一个响应示例:

{
   "d":{
      "results":[
         {
            "__metadata":{
               "id":"/sap/opu/odata/sap/API_SALES_ORDER_SRV/A_SalesOrderItem(SalesOrder='1',SalesOrderItem='10')",
               "uri":"/sap/opu/odata/sap/API_SALES_ORDER_SRV/A_SalesOrderItem(SalesOrder='1',SalesOrderItem='10')",
               "type":"API_SALES_ORDER_SRV.A_SalesOrderItemType"
            },
            "SalesOrder":"1",
            "SalesOrderItem":"10",
            "HigherLevelItem":"0",
            "SalesOrderItemCategory":"",
            "SalesOrderItemText":"Trading Goods Testing",
            "PurchaseOrderByCustomer":"test 1",
            "Material":"HAWA1",
            "MaterialByCustomer":"",
            "PricingDate":"\/Date(1547769600000)\/",
            "RequestedQuantity":"10",
            "RequestedQuantityUnit":"PC",
            "ItemGrossWeight":"1.000",
            "ItemNetWeight":"1.000",
            "ItemWeightUnit":"KG",
            "ItemVolume":"0.000",
            "ItemVolumeUnit":"",
            "TransactionCurrency":"",
            "NetAmount":"1000000",
            "MaterialGroup":"A001",
            "MaterialPricingGroup":"",
            "Batch":"",
            "ProductionPlant":"",
            "StorageLocation":"",
            "DeliveryGroup":"0",
            "ShippingPoint":"",
            "ShippingType":"",
            "DeliveryPriority":"1",
            "IncotermsClassification":"",
            "IncotermsTransferLocation":"",
            "IncotermsLocation1":"",
            "IncotermsLocation2":"",
            "CustomerPaymentTerms":"",
            "SalesDocumentRjcnReason":"",
            "ItemBillingBlockReason":"",
            "WBSElement":"",
            "ProfitCenter":"",
            "ReferenceSDDocument":"",
            "ReferenceSDDocumentItem":"0",
            "SDProcessStatus":"A",
            "DeliveryStatus":"A",
            "OrderRelatedBillingStatus":"",
            "YY1_DownPaymentReferen_SDI":"1400000013",
            "to_Partner":{
               "__deferred":{
                  "uri":"/sap/opu/odata/sap/API_SALES_ORDER_SRV/A_SalesOrderItem(SalesOrder='1',SalesOrderItem='10')/to_Partner"
               }
            },
            "to_PricingElement":{
               "__deferred":{
                  "uri":"/sap/opu/odata/sap/API_SALES_ORDER_SRV/A_SalesOrderItem(SalesOrder='1',SalesOrderItem='10')/to_PricingElement"
               }
            },
            "to_SalesOrder":{
               "__deferred":{
                  "uri":"/sap/opu/odata/sap/API_SALES_ORDER_SRV/A_SalesOrderItem(SalesOrder='1',SalesOrderItem='10')/to_SalesOrder"
               }
            },
            "to_ScheduleLine":{
               "__deferred":{
                  "uri":"/sap/opu/odata/sap/API_SALES_ORDER_SRV/A_SalesOrderItem(SalesOrder='1',SalesOrderItem='10')/to_ScheduleLine"
               }
            },
            "to_Text":{
               "__deferred":{
                  "uri":"/sap/opu/odata/sap/API_SALES_ORDER_SRV/A_SalesOrderItem(SalesOrder='1',SalesOrderItem='10')/to_Text"
               }
            },
            "to_ValueAddedService":{
               "__deferred":{
                  "uri":"/sap/opu/odata/sap/API_SALES_ORDER_SRV/A_SalesOrderItem(SalesOrder='1',SalesOrderItem='10')/to_ValueAddedService"
               }
            }
         }
      ]
   }
}

2 个答案:

答案 0 :(得分:2)

这是SAP S / 4HANA云端的Sales Order API的问题。 to_ValueAddedService导航属性未在$metadata中声明,但是它出现在A_SalesOrderItem OData EDM实体上并且不起作用。 SAP S / 4HANA Cloud同事已经在调查此事件。

答案 1 :(得分:1)

在执行请求之前使用.select()会绕过此问题,但这不是长期解决方案。这需要在SDK内部进行修复。