我正在使用SAP Cloud SDK调用OData服务API_SALES_ORDER_SIMULATION_SRV进行销售订单模拟。
我使用的有效负载如下:
{
"SalesOrderType" : "**",
"SalesOrganization" : "**",
"DistributionChannel" : "01",
"OrganizationDivision" : "01",
"SoldToParty" : "1000",
"TransactionCurrency" : "EUR",
"PurchaseOrderByCustomer" : "E2E S4HANA",
"to_Item":[
{ "SalesOrderItem" : "10",
"Material" : "**",
"RequestedQuantity" : "1000",
"to_ScheduleLine" : []
}
]
}
我从S / 4HANA得到的答复。
{
"d": {
"__metadata": {
"id": "http://host:port/sap/opu/odata/sap/API_SALES_ORDER_SIMULATION_SRV/A_SalesOrderSimulation('')",
"uri": "http://host:port/sap/opu/odata/sap/API_SALES_ORDER_SIMULATION_SRV/A_SalesOrderSimulation('')",
"type": "API_SALES_ORDER_SIMULATION_SRV.A_SalesOrderSimulationType"
},
"SalesOrder": "",
"SalesOrderType": "YTA",
"SalesOrganization": "***",
"DistributionChannel": "01",
"OrganizationDivision": "01",
"SalesGroup": "",
"SalesOffice": "",
"SalesDistrict": "000002",
"SoldToParty": "***",
"PurchaseOrderByCustomer": "E2E S4HANA",
"CustomerPurchaseOrderType": "",
"CustomerPurchaseOrderDate": null,
"SalesOrderDate": "/Date(1571875200000)/",
"TransactionCurrency": "EUR",
"SDDocumentReason": "",
"PricingDate": "/Date(1571875200000)/",
"RequestedDeliveryDate": "/Date(1571875200000)/",
"ShippingCondition": "",
"CompleteDeliveryIsDefined": false,
"ShippingType": "",
"IncotermsClassification": "***",
"IncotermsTransferLocation": "***",
"IncotermsLocation1": "***",
"IncotermsLocation2": "",
"IncotermsVersion": "",
"CustomerPaymentTerms": "0001",
"PaymentMethod": "",
"to_Credit": {
"__deferred": {
"uri": "http://host:port/sap/opu/odata/sap/API_SALES_ORDER_SIMULATION_SRV/A_SalesOrderSimulation('')/to_Credit"
}
},
"to_Item": {
"results": [
{
"__metadata": {
"id": "http://host:port/sap/opu/odata/sap/API_SALES_ORDER_SIMULATION_SRV/A_SalesOrderItemSimulation(SalesOrder='',SalesOrderItem='10')",
"uri": "http://host:port/sap/opu/odata/sap/API_SALES_ORDER_SIMULATION_SRV/A_SalesOrderItemSimulation(SalesOrder='',SalesOrderItem='10')",
"type": "API_SALES_ORDER_SIMULATION_SRV.A_SalesOrderItemSimulationType"
},
"SalesOrder": "",
"SalesOrderItem": "10",
"HigherLevelItem": "0",
"SalesOrderItemCategory": "***",
"SalesOrderItemText": "***",
"PurchaseOrderByCustomer": "E2E S4HANA",
"Material": "***",
"MaterialByCustomer": "***",
"PricingDate": "/Date(1571875200000)/",
"RequestedQuantity": "10000000",
"RequestedQuantityUnit": "PC",
"TransactionCurrency": "EUR",
"NetAmount": "0.00",
"TaxAmount": "0.00",
"CostAmount": "0.00",
"Subtotal1Amount": "0.00",
"Subtotal2Amount": "0.00",
"Subtotal3Amount": "0.00",
"Subtotal4Amount": "0.00",
"Subtotal5Amount": "0.00",
"Subtotal6Amount": "0.00",
"MaterialGroup": "01",
"MaterialPricingGroup": "",
"Batch": "",
"Plant": "***",
"StorageLocation": "",
"DeliveryGroup": "0",
"ShippingPoint": "***",
"ShippingType": "",
"DeliveryPriority": "0",
"IncotermsClassification": "***",
"IncotermsTransferLocation": "***",
"IncotermsLocation1": "***",
"IncotermsLocation2": "",
"CustomerPaymentTerms": "0001",
"SalesDocumentRjcnReason": "",
"to_Partner": {
"__deferred": {
"uri": "http://host:port/sap/opu/odata/sap/API_SALES_ORDER_SIMULATION_SRV/A_SalesOrderItemSimulation(SalesOrder='',SalesOrderItem='10')/to_Partner"
}
},
"to_PricingElement": {
"__deferred": {
"uri": "http://host:port/sap/opu/odata/sap/API_SALES_ORDER_SIMULATION_SRV/A_SalesOrderItemSimulation(SalesOrder='',SalesOrderItem='10')/to_PricingElement"
}
},
"to_SalesOrder": {
"__deferred": {
"uri": "http://host:port/sap/opu/odata/sap/API_SALES_ORDER_SIMULATION_SRV/A_SalesOrderItemSimulation(SalesOrder='',SalesOrderItem='10')/to_SalesOrder"
}
},
"to_ScheduleLine": {
"results": [
{
"__metadata": {
"id": "http://host:port/sap/opu/odata/sap/API_SALES_ORDER_SIMULATION_SRV/A_SalesOrderScheduleLineSimln(SalesOrder='',SalesOrderItem='10',ScheduleLine='1')",
"uri": "http://host:port/sap/opu/odata/sap/API_SALES_ORDER_SIMULATION_SRV/A_SalesOrderScheduleLineSimln(SalesOrder='',SalesOrderItem='10',ScheduleLine='1')",
"type": "API_SALES_ORDER_SIMULATION_SRV.A_SalesOrderScheduleLineSimlnType"
},
"SalesOrder": "",
"SalesOrderItem": "10",
"ScheduleLine": "1",
"RequestedDeliveryDate": "/Date(1571875200000)/",
"ConfirmedDeliveryDate": null,
"OrderQuantityUnit": "PC",
"ScheduleLineOrderQuantity": "10000000",
"ConfdOrderQtyByMatlAvailCheck": "0",
"OpenConfdDelivQtyInOrdQtyUnit": "0",
"CorrectedQtyInOrderQtyUnit": "10000000",
"to_SalesOrder": {
"__deferred": {
"uri": "http://host:port/sap/opu/odata/sap/API_SALES_ORDER_SIMULATION_SRV/A_SalesOrderScheduleLineSimln(SalesOrder='',SalesOrderItem='10',ScheduleLine='1')/to_SalesOrder"
}
},
"to_SalesOrderItem": {
"__deferred": {
"uri": "http://host:port/sap/opu/odata/sap/API_SALES_ORDER_SIMULATION_SRV/A_SalesOrderScheduleLineSimln(SalesOrder='',SalesOrderItem='10',ScheduleLine='1')/to_SalesOrderItem"
}
}
},
{
"__metadata": {
"id": "http://host:port/sap/opu/odata/sap/API_SALES_ORDER_SIMULATION_SRV/A_SalesOrderScheduleLineSimln(SalesOrder='',SalesOrderItem='10',ScheduleLine='2')",
"uri": "http://host:port/sap/opu/odata/sap/API_SALES_ORDER_SIMULATION_SRV/A_SalesOrderScheduleLineSimln(SalesOrder='',SalesOrderItem='10',ScheduleLine='2')",
"type": "API_SALES_ORDER_SIMULATION_SRV.A_SalesOrderScheduleLineSimlnType"
},
"SalesOrder": "",
"SalesOrderItem": "10",
"ScheduleLine": "2",
"RequestedDeliveryDate": null,
"ConfirmedDeliveryDate": "/Date(1571961600000)/",
"OrderQuantityUnit": "PC",
"ScheduleLineOrderQuantity": "0",
"ConfdOrderQtyByMatlAvailCheck": "18595.5",
"OpenConfdDelivQtyInOrdQtyUnit": "0",
"CorrectedQtyInOrderQtyUnit": "0",
"to_SalesOrder": {
"__deferred": {
"uri": "http://host:port/sap/opu/odata/sap/API_SALES_ORDER_SIMULATION_SRV/A_SalesOrderScheduleLineSimln(SalesOrder='',SalesOrderItem='10',ScheduleLine='2')/to_SalesOrder"
}
},
"to_SalesOrderItem": {
"__deferred": {
"uri": "http://host:port/sap/opu/odata/sap/API_SALES_ORDER_SIMULATION_SRV/A_SalesOrderScheduleLineSimln(SalesOrder='',SalesOrderItem='10',ScheduleLine='2')/to_SalesOrderItem"
}
}
}
]
}
}
]
},
"to_Partner": {
"__deferred": {
"uri": "http://host:port/sap/opu/odata/sap/API_SALES_ORDER_SIMULATION_SRV/A_SalesOrderSimulation('')/to_Partner"
}
},
"to_Pricing": {
"__deferred": {
"uri": "http://host:port/sap/opu/odata/sap/API_SALES_ORDER_SIMULATION_SRV/A_SalesOrderSimulation('')/to_Pricing"
}
},
"to_PricingElement": {
"__deferred": {
"uri": "http://host:port/sap/opu/odata/sap/API_SALES_ORDER_SIMULATION_SRV/A_SalesOrderSimulation('')/to_PricingElement"
}
}
}
}
它在SAP Gateway Client中运行良好,并且返回了我想要的所有数据,包括项目中的to_ScheduleLine导航数据。
但是当我使用Cloud SDK调用API并设置相同的有效负载时,将返回销售订单模拟数据,而没有to_ScheduleLine导航数据。
我深入研究了SDK的源代码,发现这部分数据包含在响应中。但是,当将odata结果传输到销售订单模拟实体时,数据会丢失。
使用Class FluentHelperCreate.class中的属性构造EntityT时,计划行属性会丢失。
@Override
@Nonnull
public EntityT execute( @Nonnull final HttpDestinationProperties destination )
throws ODataException
{
final HttpClient httpClient = HttpClientAccessor.getHttpClient(destination);
notifyQueryListeners(destination, getEntity());
final ODataCreateResult result = toQuery().execute(httpClient);
final EntityT createdEntity = new VdmEntityUtil<>(getEntityClass()).fromFields(result.asMap());
createdEntity.attachToService(getServicePath(), destination);
return createdEntity;
}
to_ScheduleLine数据对于我们的业务工作流程非常重要。因为当客户进行销售订单模拟并提供项目的RequestedQuantity时,他(她)需要知道存储是否足够。
您能帮忙看看这个问题吗?
SAP Cloud SDK版本:3.3.1 S / 4HANA前提版本:1909
谢谢
杰里
答案 0 :(得分:1)
请更新到 SAP Cloud SDK 的版本3.14.0
。
为重现该问题,我将注释中所述的先前测试结果与Wiremock测试和版本3.13.0
(及更早版本)中的结果进行了比较。事实证明,您描述的问题是在以后的迭代中修复的。它已在3.14.0
中修复。