Show TOC Start of Content Area

Procedure documentation Mapping of ABAP and Java Data Types  Locate the document in its SAP Library structure

A data structure is made up of individual fields and each field is assigned to a particular data type. Because ABAP uses different data types to Java, it is necessary to create a link between these data types (mapping). The table displayed below shows the different data types in ABAP and Java and their mapping.

 

      Data Type Mapping

ABAP Type

 

Description

Data Type

Java Type Code

C

 

Character

String

JCoMetadata.TYPE_CHAR

N

 

Numerical Character

String

JCoMetadata.TYPE_NUM

X

 

Binary Data

Byte ()

JCoMetadata.TYPE_BYTE

P

 

Binary Coded Decimal

Big Decimal

JCoMetadata.TYPE_BCD

I

 

4-byte Integer

Int

JCoMetadata.TYPE_INT

B

 

1-byte Integer

Int

JCoMetadata.TYPE_INT1

S

 

2-byte Integer

Int

JCoMetadata.TYPE_INT2

F

 

Float

Double

JCoMetadata.TYPE_FLOAT

D

 

Date

Date

JCoMetadata.TYPE_DATE

T

 

Time

Date

JCoMetadata.TYPE_TIME

decfloat16

 

Decimal floating point 8 bytes (IEEE 754r)

BigDecimal

JCoMetadata.TYPE_DECF16

decfloat34

 

Decimal floating point 16 bytes (IEEE 754r)

BigDecimal

JCoMetadata.TYPE_DECF34

g

 

String (variable length)

String

JCoMetadata.TYPE_STRING

y

Raw String (variable length)

 Byte ()

JCoMetadata.TYPE_XSTRING

 

In most cases, handling of data types does not represent a problem. However, the ABAP data types for date and time have some special features. ABAP has two different data types for processing date and time information:

      ABAP data type T is a 6-byte string with the format HHMMSS.

      ABAP data type D is an 8-byte string with the format YYYYMMDD.

Both data types are used in RFMs (including BAPIs). When a BAPI uses a time stamp two fields are used, one of type D and one of type T.

Java, however, only uses one class (Date) to represent both date and time information. In Java, a time stamp can therefore be displayed in one variable.

SAP JCo automatically performs the conversion between ABAP and Java data types. Fields of the ABAP data types D and T are represented as Java Date objects, whereby the part of the Date object that is not used retains its default value. Java developers need to distinguish between whether a particular field contains an ABAP date value or an ABAP time value.

 

 

 

End of Content Area