An SAP endpoint expects to receive a message with a message body containing an SAP request object and will return a message with a message body containing an SAP response object. SAP requests and responses are fixed map data structures containing named fields with each field having a predefined data type.
Note that the named fields in an SAP request and response are specific to an SAP endpoint, with each endpoint defining the parameters in the SAP request and response it will accept. An SAP endpoint provides factory methods to create the request and response objects that are specific to it.
public class SAPEndpoint ... {
...
public Structure getRequest() throws Exception;
public Structure getResponse() throws Exception;
...
}Both SAP request and response objects are represented in Java as a structure
object which supports the
org.fusesource.camel.component.sap.model.rfc.Structure interface.
This interface extends both the java.util.Map and
org.eclipse.emf.ecore.EObject interfaces.
public interface Structure extends org.eclipse.emf.ecore.EObject,
java.util.Map<String, Object> {
<T> T get(Object key, Class<T> type);
} The field values in a structure object are accessed through the field’s getter methods in the map interface. In addition, the structure interface provides a type-restricted method to retrieve field values.
Structure objects are implemented in the component runtime using the Eclipse
Modeling Framework (EMF) and support that framework’s EObject
interface. Instances of a structure object have attached meta-data which define and
restrict the structure and contents of the map of fields it provides. This meta-data
can be accessed and introspected using the standard methods provided by EMF. Please
refer to the EMF documentation for further details.
![]() | Note |
|---|---|
Attempts to get a parameter not defined on a structure object will return null. Attempts to set a parameter not defined on a structure will throw an exception as well as attempts to set the value of a parameter with an incorrect type. |
As discussed in the following sections, structure objects can contain fields that
contain values of the complex field types, STRUCTURE and
TABLE. Note that it is unnecessary to create instances of these
types and add them to the structure. Instances of these field values are created on
demand if necessary when accessed in the enclosing structure.
The fields that reside within the structure object of an SAP request or response may be either elementary or complex. An elementary field contains a single scalar value, whereas a complex field will contain one or more fields of either a elementary or complex type.
An elementary field may be either a character, numeric, hexadecimal or string field type. The following table summarizes the types of elementary fields that may reside in a structure object:
| Field Type | Corresponding Java Type | Byte Length | Unicode Byte Length | Number Decimals Digits | Description |
|---|---|---|---|---|---|
CHAR
|
java.lang.String
|
1 to 65535 | 1 to 65535 | - | ABAP Type ‘C’: Fixed sized character string |
DATE
|
java.util.Date
|
8 | 16 | - | ABAP Type ‘D’: Date (format: YYYYMMDD) |
BCD
|
java.math.BigDecimal
|
1 to 16 | 1 to 16 | 0 to 14 | ABAP Type ‘P’: Packed BCD number. A BCD number contains two digits per byte. |
TIME
|
java.util.Date
|
6 | 12 | - | ABAP Type ‘T’: Time (format: HHMMSS) |
BYTE
|
byte[]
|
1 to 65535 | 1 to 65535 | - | ABAP Type ‘X’:Fixed sized byte array |
NUM
|
java.lang.String
|
1 to 65535 | 1 to 65535 | - | ABAP Type ‘N’: Fixed sized numeric character string |
FLOAT
|
java.lang.Double
|
8 | 8 | 0 to 15 | ABAP Type ‘F’: Floating point number |
INT
|
java.lang.Integer
|
4 | 4 | - | ABAP Type ‘I’: 4-byte Integer |
INT2
|
java.lang.Integer
|
2 | 2 | - | ABAP Type ‘S’: 2-byte Integer |
INT1
|
java.lang.Integer |
1 | 1 | - | ABAP Type ‘B’: 1-byte Integer |
DECF16
|
java.match.BigDecimal
|
8 | 8 | 16 | ABAP Type ‘decfloat16’: 8 -byte Decimal Floating Point Number |
DECF34
|
java.math.BigDecimal
|
16 | 16 | 34 | ABAP Type ‘decfloat34’: 16-byte Decimal Floating Point Number |
STRING
|
java.lang.String
|
8 | 8 | - | ABAP Type ‘G’: Variable length character string |
XSTRING
|
byte[]
|
8 | 8 | - | ABAP Type ‘Y’: Variable length byte array |
A character field contains a fixed sized character string that may use either a
non-Unicode or Unicode character encoding in the underlying JCo and ABAP runtimes.
Non-Unicode character strings encode one character per byte. Unicode characters
strings are encoded in two bytes using UTF-16 encoding. Character field values are
represented in Java as java.lang.String objects and the underlying JCo
runtime is responsible for the conversion to their ABAP representation.
A character field declares its field length in its associated
byteLength and unicodeByteLength properties, which
determine the length of the field’s character string in each encoding system.
CHARA CHAR character field is a text field containing
alphanumeric characters and corresponds to the ABAP type C.
NUMA NUM character field is a numeric text field containing
numeric characters only and corresponds to the ABAP type N.
DATEA DATE character field is an 8 character date field with
the year, month and day formatted as YYYYMMDD and
corresponds to the ABAP type D.
TIMEA TIME character field is a 6 character time field with
the hours, minutes and seconds formatted as HHMMSS and
corresponds to the ABAP type T.
A numeric field contains a number. The following numeric field types are supported:
INTAn INT numeric field is an integer field stored as a
4-byte integer value in the underlying JCo and ABAP runtimes and
corresponds to the ABAP type I. An INT field value is
represented in Java as a java.lang.Integer object.
INT2An INT2 numeric field is an integer field stored as a
2-byte integer value in the underlying JCo and ABAP runtimes and
corresponds to the ABAP type S. An INT2 field value is
represented in Java as a java.lang.Integer object.
INT1An INT1 field is an integer field stored as a 1-byte
integer value in the underlying JCo and ABAP runtimes value and
corresponds to the ABAP type B. An INT1 field value is
represented in Java as a java.lang.Integer object.
FLOATA FLOAT field is a binary floating point number field
stored as an 8-byte double value in the underlying JCo and ABAP runtimes
and corresponds to the ABAP type F. A FLOAT field declares
the number of decimal digits that the field’s value contains in its
associated decimal property. In the case of a FLOAT field,
this decimal property can have a value between 1 and 15 digits. A
FLOAT field value is represented in Java as a
java.lang.Double object.
BCDA BCD field is a binary coded decimal field stored as a 1
to 16 byte packed number in the underlying JCo and ABAP runtimes and
corresponds to the ABAP type P. A packed number stores two decimal
digits per byte. A BCD field declares its field length in
its associated byteLength and
unicodeByteLength properties. In the case of a
BCD field, these properties can have a value between 1
and 16 bytes and both properties will have the same value. A
BCD field declares the number of decimal digits that
the field’s value contains in its associated decimal property. In the
case of a BCD field, this decimal property can have a value
between 1 and 14 digits. A BCD field value is represented
in Java as a java.math.BigDecimal.
DECF16A DECF16 field is a decimal floating point stored as an
8-byte IEEE 754 decimal64 floating point value in the underlying JCo and
ABAP runtimes and corresponds to the ABAP type decfloat16.
The value of a DECF16 field has 16 decimal digits. The
value of a DECF16 field is represented in Java as
java.math.BigDecimal.
DECF34A DECF34 field is a decimal floating point stored as a
16-byte IEEE 754 decimal128 floating point value in the underlying JCo
and ABAP runtimes and corresponds to the ABAP type
decfloat34. The value of a DECF34 field
has 34 decimal digits. The value of a DECF34 field is
represented in Java as java.math.BigDecimal.
A hexadecimal field contains raw binary data. The following hexadecimal field types are supported:
BYTEA BYTE field is a fixed sized byte string stored as a
byte array in the underlying JCo and ABAP runtimes and corresponds to
the ABAP type X. A BYTE field declares its field length in
its associated byteLength and
unicodeByteLength properties. In the case of a
BYTE field, these properties can have a value between 1
and 65535 bytes and both properties will have the same value. The value
of a BYTE field is represented in Java as a
byte[] object.
A string field references a variable length string value. The length of that string value is not fixed until runtime. The storage for the string value is dynamically created in the underlying JCo and ABAP runtimes. The storage for the string field itself is fixed and contains only a string header.
STRINGA STRING field refers to a character string and is stored
in the underlying JCo and ABAP runtimes as an 8-byte value. It
corresponds to the ABAP type G. The value of the STRING
field is represented in Java as a java.lang.String
object.
XSTRINGAn XSTRING field refers to a byte string and is stored in
the underlying JCo and ABAP runtimes as an 8-byte value. It corresponds
to the ABAP type Y. The value of the STRING field is
represented in Java as a byte[] object.
A complex field may be either a structure or table field type. The following table summarizes these complex field types.
| Field Type | Corresponding Java Type | Byte Length | Unicode Byte Length | Number Decimals Digits | Description |
|---|---|---|---|---|---|
STRUCTURE
|
org.fusesource.camel.component.sap.model.rfc.Structure
|
Total of individual field byte lengths | Total of individual field Unicode byte lengths | - | ABAP Type ‘u’ & ‘v’: Heterogeneous Structure |
TABLE
|
org.fusesource.camel.component.sap.model.rfc.Table
|
Byte length of row structure | Unicode byte length of row structure | - | ABAP Type ‘h’: Table |
A STRUCTURE field contains a structure object and is stored in the
underlying JCo and ABAP runtimes as an ABAP structure record. It corresponds to
either an ABAP type u or v. The value of a
STRUCTURE field is represented in Java as a structure object with
the interface
org.fusesource.camel.component.sap.model.rfc.Structure.
A TABLE field contains a table object and is stored in the underlying
JCo and ABAP runtimes as an ABAP internal table. It corresponds to the ABAP type
h. The value of the field is represented in Java by a table object
with the interface
org.fusesource.camel.component.sap.model.rfc.Table.
A table object is a homogeneous list data structure containing rows of structure
objects with the same structure. This interface extends both the
java.util.List and org.eclipse.emf.ecore.EObject
interfaces.
public interface Table<S extends Structure>
extends org.eclipse.emf.ecore.EObject,
java.util.List<S> {
/**
* Creates and adds table row at end of row list
*/
S add();
/**
* Creates and adds table row at index in row list
*/
S add(int index);
} The list of rows in a table object are accessed and managed using the standard methods defined in the list interface. In addition the table interface provides two factory methods for creating and adding structure objects to the row list.
Table objects are implemented in the component runtime using the Eclipse Modeling Framework (EMF) and support that framework’s EObject interface. Instances of a table object have attached meta-data which define and restrict the structure and contents of the rows it provides. This meta-data can be accessed and introspected using the standard methods provided by EMF. Please refer to the EMF documentation for further details.
![]() | Note |
|---|---|
Attempts to add or set a row structure value of the wrong type will throw an exception. |