Yannick
Yannick

Reputation: 683

In what format do I supply a BCD field for camel-sap?

I would like to develop an interface that transfers a data record via camel-sap to an SAP function module. The data table contains a BCD field. What is the representation of the BCD field in camel-sap-format (XML)?

Upvotes: 0

Views: 945

Answers (2)

Yannick
Yannick

Reputation: 683

As @Trixx said, a BCD (Binary Coded Decimal) ABAP data type is mapped to a BigDecimal in Java. This can be found in the SAP documentation. In the default XML-to-Java bindings used by JAXB, BigDecimal is mapped to the XML Schema Type xsd:decimal. This can be Found in the Java Documentation.

So you supply a BCD field as a xsd:decimal for camle-sap-format (xml).


Example:

You have a field called VALUE in your SAP BAPI. The field is of type CURR (BCD) and has the length 17 with 2 decimal places. Then the attribute for this field in camel-sap-format (xml) could be defined as follows:

<xsd:attribute name="VALUE">
    <xsd:simpleType>
        <xsd:restriction base="**xsd:decimal**">
            <totalDigits value="17"/>
            <xsd:fractionDigits value="2"/>
        </xsd:restriction>
    </xsd:simpleType>
</xsd:attribute>

Upvotes: 0

Trixx
Trixx

Reputation: 1885

Not a full answer to your question because I have not used camel-sap yet, but as far as JCo is concerned it will automatically convert any given value to a BCD type if feasible, i.e. from a String, float, double, BigDecimal or whatsoever. The default data type mapping for an ABAP BCD type to a Java type is java.math.BigDecimal.

I hope this helps.

Upvotes: 1

Related Questions