Skip to Content
0
Aug 20, 2019 at 11:11 AM

How to send to S/4 HANA Cloud a sales order simulate with the Java Cloud SDK

14167 Views

Hi guys, I'm trying to make a sales order simulation to get the pricing of the operation. When I call the S/4 system directly with the REST call (with Postman) it actually show results:

{
"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"
}]
}
But with my code, instantiating those empty pricing elements gives me no pricing information:
/* New Sales Orders */

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<SalesOrderPrcgElmntSimln>());
SalesOrderPricingSimulation orderPricing = new SalesOrderPricingSimulation();

oSimulationInput.setPricing(orderPricing);

/* Add Item */
SalesOrderItemSimulation oItem = new SalesOrderItemSimulation();
oItem.setSalesOrderItem("10");
oItem.setMaterial("SOMEMATERIAL");
BigDecimal requestedQuantity = new BigDecimal("1");
oItem.setRequestedQuantity(requestedQuantity);

oSimulationInput.addItem(oItem);

SalesOrderSimulation oSimulation = oService._mSimulate(oSimulationInput);
Is there something I am overseeing? Is the serialization the problem? I'm using Springboot 1.41 for the project.

Thank you for your time!