Skip to Content
Technical Articles

REST Adapter – Limitation and Alternative Solution – Exponential Values.

Recently we came across a scenario while using the sender REST adapter in REST based web service application to SAP using SAP PI/PO. The adapter it is converting one of the values of “pricing field” into “exponential value” during Json to XML conversion at adapter level and before entering into the mapping step. It is happening only for the cases where the value contains this combination “0.000” i.e. if the value contains 3 or more “0” s after decimal.

For ex – Value in Json message – ”PO_PRICE”:0.000239 is converted as <PO_PRICE>4.99E-4</PO_PRICE> in XML after Json to XML conversion.

 

Below is the screen print that shows the conversion after XML message from Json message –

Resulting this, the message is getting failed in SAP with the below error. The proxy communication method is used in receiving end. Using fractional and decimal in datatype definition dint help us to resolve this issue since this is happening before reaching the mapping. Below is the error throwing in SAP.

This workaround for this issue is to use the “FormatNumber” function with value” #.#########”in mapping and this will help to convert the exponential value back to original value.

Below is the screen print that shows the value after the mapping execution with this solution.

I hope this alternative solution / workaround using format number will be useful if there are any similar situations  occurs in your projects. Thank you.

Be the first to leave a comment
You must be Logged on to comment or reply to a post.