Send New Price Lists to SAP C4C
To send new price lists to SAP C4C:
Enable events subsystem and define the name of the routine that processes the pricing approval event in your application.properties file.
integration.events.enabled=true integration.events.scheduler-delay=10000 integration.events.delay=60000 integration.events.event-to-route-mapping.ITEM_APPROVED_PL=direct://handleItemApprovedPlEvent
Â
Add a multilevel mapper to map values received from the approved price list event in combination with the fetch price list method of Pricefx API. Then define the route that receives the approved price list event, fetch price list data and send them to pfx-c4c updatePriceList.
<pfx:multilevelMapper id="sapPriceListMapper"> <pfx:header in="priceListId" out="priceListId"/> <pfx:groovy expression="'MSG_' + System.currentTimeMillis() + '_' + headers.priceListId" out="messageId"/> <pfx:simple expression="headers.receivedEvent[targetDate]" out="startDate"/> <pfx:groovy expression="headers.receivedEvent.expiryDate?headers.receivedEvent.expiryDate:new org.joda.time.LocalDate(headers.receivedEvent.targetDate).plusDays(30)" out="endDate"/> <pfx:simple expression="headers.receivedEvent[label]" out="name"/> <pfx:property in="EUR" out="currencyCode"/> <pfx:body in="data[].resultPrice" out="priceSpecificationList[].amount"/> <pfx:body in="data[].sku" out="priceSpecificationList[].productId"/> <pfx:body in="data[].currency" out="priceSpecificationList[].currency"/> </pfx:multilevelMapper> <route> <from uri="direct:handleItemApprovedPlEvent"/> <log message="Event was received ${body}"/> <setHeader headerName="priceListId"> <simple resultType="java.lang.Long">${body[data][0][id]}</simple> </setHeader> <setHeader headerName="receivedEvent"> <simple>${body[data][0]}</simple> </setHeader> <toD uri="pfx-api?method=fetch&objectType=PLI&priceListId=${headers.priceListId}"/> <log message="${body}"/> <to uri="pfx-c4c?method=updatePriceList&mapper=sapPriceListMapper&username=yourUserName&password=******&url=my326067.crm.ondemand.com/sap/bc/srt/scs/sap/managesalespricelistin2"/> <log message="Response status: ${headers.responseStatus}" /> <log message="Response body: ${body}"/> </route>
IntegrationManager version 5.8.0