0

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

Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48
Yannick
  • 663
  • 1
  • 10
  • 33

2 Answers2

1

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.

Trixx
  • 1,796
  • 1
  • 15
  • 18
0

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>
Yannick
  • 663
  • 1
  • 10
  • 33