Search code examples
apache-cameljbossfusesaprfcbcdsapjco3

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)?


Solution

  • 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>