使用 S/4HANA SDK 使用 SalesOrderItem API

Consuming SalesOrderItem API using S/4HANA SDK

我正在尝试使用

获取所有 SalesOrderItems

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

class 由 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"
               }
            }
         }
      ]
   }
}

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

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