cancel
Showing results for 
Search instead for 
Did you mean: 

SAP PO REST ADAPTER DECIMAL

Former Member
0 Kudos

I'm using SAP REST adapter to send a JSON message. I need the output for certain amount field to be 10.00 how can I achieve that?

XML : <AMOUNT>510.00</AMOUNT>

When it gets converted as JSON it becomes

JSON: "AMOUNT": 510

How do I populate it as "AMOUNT": 510.00

In the conversion rule I specified it as Decimal

When I specify as string it comes as

"AMOUNT": "510.00" but I need it without quotes.

Please advise.

Thank you.

Larry

Accepted Solutions (0)

Answers (2)

Answers (2)

saikirankanduri
Explorer
0 Kudos

Hi Smith,

As per your requirement, AMOUNT field should be declared as xsd:decimal in Data Type and in REST adapter, Under Custom XML/JSON conversion rules, use TYPE as "decimal" and specify the DEFAULTVALUE as 0.00

Thanks and Regards

Saikiran Kanduri

TomXing
Contributor
0 Kudos

Hi Larry,

I'm afraid it's not (yet) possible for REST adapter to specify any format.

Instead you can achieve this in Mapping, using "FormatNum" module.

Best regards,
Tom

former_member223432
Participant
0 Kudos

Hi Tom,

I am also having a similar requirement. I also tried using FormatNum. since this is coming after the mapping(at channel level). it is still giving wrong results.

Flow is : SAP(Proxy)<–>SAP PO<–> REST API Service.

One of the XML field is receiving as below

"UnitPrice":"10:00"

expected :"UnitPrice": 10:00(without the quotes). i have used xml/json conversion table as shown below

I also tried with "integer", decimal, it gives the values as 10 instead of 10.00 . with boolean it gives as "10.00".

Can you please suggest how can i get the exact value without the quotes and with decimal values(10.00)

and also, if i have "0.0". it is populating only 0. the expected value is 0.0

can you please advice here.

regards

Smith