如何使用Java Cloud SDK将销售订单发送到S/4 HANA Cloud

2020-09-01 08:58发布

点击此处---> 群内免费提供SAP练习系统(在群公告中)加入QQ群:457200227(SAP S4 HANA技术交流) 群内免费提供SAP练习系统(在群公告中)大家好,我正在尝试进行销售订单模...

         点击此处--->   EasySAP.com群内免费提供SAP练习系统(在群公告中)

加入QQ群:457200227(SAP S4 HANA技术交流) 群内免费提供SAP练习系统(在群公告中)


大家好,我正在尝试进行销售订单模拟,以获取工序的价格。 当我直接使用REST调用(使用Postman)调用S/4系统时,它实际上显示了结果:
 {
 " SalesOrderType":" OR",
 " SalesOrganization":" 2410",
 " DistributionChannel":" 10",
 " OrganizationDivision":" 00",
 " SoldToParty":" 24100003",
 " PurchaseOrderByCustomer":" SalesOrder Simulation",
 " to_Pricing":{},
 " to_PricingElement":[],
 " to_Item":[
 {" SalesOrderItem":" 10",
 " Material":" SOMEMATERIAL",
 " RequestedQuantity":" 1"
 }]
 }
 
但是使用我的代码,实例化那些空的定价元素不会给我提供任何定价信息:
/*新销售订单*/

 SalesOrderSimulation oSimulationInput = new SalesOrderSimulation();
 oSimulationInput.setSalesOrganization(" 2410");
 oSimulationInput.setSalesOrderType(" O");
 oSimulationInput.setDistributionChannel(" 10");
 oSimulationInput.setOrganizationDivision(" 00");
 oSimulationInput.setSoldToParty(" 24100003");
 oSimulationInput.setPurchaseOrderByCustomer(" 2000000");
 oSimulationInput.setPricingElement(new ArrayList ());
 SalesOrderPricingSimulation orderPricing = new SalesOrderPricingSimulation();

 oSimulationInput.setPricing(orderPricing);

/* 新增项目 */
 SalesOrderItemSimulation oItem = new SalesOrderItemSimulation();
 oItem.setSalesOrderItem(" 10");
 oItem.setMaterial(" SOMEMATERIAL");
 BigDecimalRequestedQuantity = new BigDecimal(" 1");
 oItem.setRequestedQuantity(requestedQuantity);

 oSimulationInput.addItem(oItem);

 SalesOrderSimulation oSimulation = oService._mSimulate(oSimulationInput); 
我要监督什么? 是序列化的问题吗? 我正在为项目使用Springboot 1.41。

谢谢您的时间!

2条回答
Violet凡
2020-09-01 09:32

您使用的服务来自哪里? 您希望得到哪个回应? 使用SAP Cloud SDK,通常会使用某种执行方法,该方法实际上会将请求发送出去。

您可以按照以下指南将Apache Http库的日志输出设置为调试: https://hc.apache.org/httpcomponents-client-4.5.x/logging.html 使用此输出,您可以更好地了解SDK实际发送的内容。 请添加您的服务发送的实际请求。

一周热门 更多>