Skip Headers

Oracle® Application Server Integration Adapter for SAP R/3 User's Guide
10g (9.0.4)

Part Number B10299-01
Go To Documentation Library
Home
Go To Product List
Solution Area
Go To Table Of Contents
Contents
Go To Index
Index

Go to previous page Go to next page

4
Using Oracle Application Server Integration Adapter for SAP R/3 Datatypes

This chapter provides information on the Oracle Application Server Integration Adapter for SAP R/3 datatypes. This chapter discusses the following topics:

Basic Datatypes

Table 4-1 describes the list of basic types in R/3 and how they map to XML schema types in Oracle Application Server ProcessConnect. The xsd prefix stands for the namespace http://www.w3.org/2001/XMLSchema.

Table 4-1   Basic Datatypes
R/3 Oracle Application Server ProcessConnect

Byte LIKE INT1.

xsd:unsignedByte

Char(i) TYPE C.

xsd:string

Date TYPE D.

xsd:date

Float TYPE F.

xsd:double

Integer TYPE I.

xsd:int

NUMC(i) TYPE N. ; i = 1 to 2

xsd:byte

NUMC(i) TYPE N. ; i = 3 to 4

xsd:short

NUMC(i) TYPE N. ; i = 5 to 9

xsd:int

NUMC(i) TYPE N. ; i = 10 to 14

xsd:double

NUMC(i) TYPE N. ; i > 14

xsd:string

Packed(i) TYPE P DECIMALS j ; i = 1; j = 0

xsd:byte

Packed(i) TYPE P DECIMALS j ; i = 2; j = 0

xsd:short

Packed(i) TYPE P DECIMALS j ; i= 3 to 5; j = 0

xsd:int

Packed(i) TYPE P DECIMALS j ; i = 6 to 7; j = 0

xsd:double

Packed(i) TYPE P DECIMALS j ; i <= 7; j > 0

xsd:double

Packed(i) TYPE P DECIMALS j ; i > 7

xsd:string

Raw(1) TYPE X.

xsd:unsignedByte

Raw(i) TYPE X.

xsd:base64Binary

Short LIKE INT2.

xsd:short

Time TYPE T.

xsd:time

Numeric Strings (NUMC Type)

The R/3 numeric string type is expressed as:

Numc(n)

Where

n is a positive integer specifying the number of decimal digits

Depending on n, this type can be translated as:

Take care when using NUMC precision, specifically when these types are for input parameters; otherwise Oracle Application Server ProcessConnect returns a conversion failure at runtime.

For example, suppose you have two function modules with a NUMC parameter only differing in length:

function y_test_numc20.
*"----------------------------------------------------------------------
*" IMPORTING
*" VALUE(ARG_NUMC20) LIKE NUMC(20)
*"----------------------------------------------------------------------
function y_test_numc10.
*"----------------------------------------------------------------------
*" IMPORTING
*" VALUE(ARG_NUMC10) LIKE NUMC(10)
*"----------------------------------------------------------------------

The generated schema translates the NUMC types to 2 different types:

<xsd:element name='arg_numc20' type='xsd:string'/>
<xsd:element name='arg_numc10' type='xsd:double'/>

In this example, even though NUMC(20) is exposed as a string, a value with more than 20 digits causes a conversion failure.

<!-- This fails because it is not a number -->
<arg_numc20>This is not a number</arg_numc20>

<!-- This fails because it has too many digits -->
<arg_numc20>12345678901234567890111</arg_numc20>

<!-- This works -->
<arg_numc20>12345678901234567890</arg_numc20>

In a similar way, even though NUMC(10) is exposed as a double, it should not contain more than 9 digits in the integral part. Any value in the fractional part is rounded upwards and discarded.

<!-- This fails because the precision is too high -->
<arg_numc10>12345678901</arg_numc10>

<!-- This passes in the value 12. -->
<arg_numc10>12.34</arg_numc10>

<!-- This works -->
<arg_numc10>123456789</arg_numc10>

Fixed-Point Numeric Strings (PACKED Type)

The R/3 version of a fixed point numeric string is:

Packed(b, s)

Where

b is the number of bytes occupied by instances of the type, which can range from 1 to 16. In a Packed datatype, two (2) characters are stored in each byte, and the sign is stored in half of a byte. 16 bytes give you 31 positions for numbers, with the precision telling you how many digits are in the fractional part.

s is the number of decimal digits after the decimal point. s is short for scale.

For example, instances of PACKED(7, 4) can range from -999 999 999.9999 to 999 999 999.9999, and the values are exact (as opposed to the IEEE floating point numeric type, where values are stored internally in base 2 and do not all have exact correspondence to decimal values).

Just like NUMC types, depending on b and s, the PACKED type can be translated as:

Take care when using Packed types as input parameters. If input length exceeds the specified Packed length, failures occur at runtime.

For example, the following three function modules show a PACKED parameter only differing in its number of decimals and length:

function y_test_pack_p4_d2
*"----------------------------------------------------------------------
*" IMPORTING
*"   VALUE(ARG_P4_D2) Packed(4) Type P Decimals 2
*"---------------------------------------------------------------------
function y_test_pack_p10_d0
*"----------------------------------------------------------------------
*" IMPORTING
*"   VALUE(ARG_P10_D0) Packed(10) TYPE P DECIMALS
*"----------------------------------------------------------------------
function y_test_pack_p10_d2
*"----------------------------------------------------------------------
*" IMPORTING
*"   VALUE(ARG_P10_D2) Packed(10) TYPE P DECIMALS 2
*"----------------------------------------------------------------------

The generated schema using the above three function modules translates the PACKED types to 3 different types:

<xsd:element name='arg_p4_d2'  type='xsd:double'/>
<xsd:element name='arg_p10_d0' type='xsd:string'/>
<xsd:element name='arg_p10_d2' type='xsd:string'/>

Even though the Packed(4, 2) is translated as a double, the total number of digits is 4*2-1 or 7, and no more than 5 digits in the integral part and the fractional part are rounded upwards to 2 digits.

<!-- This fails because the integral part exceeds 5 digits. -->
<arg_p4_d2>123456.78</arg_p4_d2>

<!-- This passes in the value 1234.57. -->
<arg_p4_d2>1234.567</arg_p4_d2>

<!-- This works -->
<arg_p4_d2>12345.67</arg_p4_d2>

The packed(10,0) is being translated as a string. The integral part must not exceed 19 digits, and the fractional part is rounded up and discarded.

<!-- This passes in the value 1235. -->
<arg_p10_d0>1234.56</arg_p10_d0>
<!-- This fails because there are too many digits (20). -->
<arg_p10_d0>12345678901234567890</arg_p10_d0>
<!-- 19 Digits. This is valid. -->
<arg_p10_d0>-1234567890123456789</arg_p10_d0>

The packed(10,2) is translated as a string. The integral part must not exceed 17 digits and the fractional part is rounded up to 2 digits.

<!-- This passes in the value 1234567890123456.79. -->
<arg_p10_d2>1234567890123456.789</arg_p10_d2>
<!-- 19 digits, 2 after the decimal points. This is valid. -->
<arg_p10_d2>12345678901234567.89</arg_p10_d2>

Date and Time

The R/3 Date type is exposed as xsd:date and the R/3 Time type is exposed as xsd:time.

The concept of null date values is useful when calling R/3. When a null date instance is used when invoking R/3, it translates as 00000000 in R/3. This special data value indicates that it should not be processed. To pass null dates in a call, you need to pass in a null Date instance.

In this example, the xsi prefix stands for the namespace http://www.w3.org/2001/XMLSchema-instance.

<myDate xsi:nil='true'/>

Binary Data

R/3 Raw types, or Raw(n), are types containing raw binary data. Raw(1) is a single byte value exposed as xsd:unsignedByte. Raw(n) for n greater than 1 is translated as xsd:base64Binary.

For example, the following function module has a Raw parameter:

function y_test_raw10.
*"----------------------------------------------------------------------
*" IMPORTING
*" VALUE(ARG_RAW10) Raw(10) TYPE X.
*"----------------------------------------------------------------------

The generated schema translates the RAW(10) type to:

<element name='arg_raw10' type='xsd:base64Binary'/>

This type is rarely used. If it is, special care must be taken if inputting values. The sequence of bytes encoded in base64 must be exactly of length n.

<!-- This works -->
<arg_raw10>ABCDabcd0123xy==</arg_raw10>

Complex Types

An R/3 structure translates to a schema complexType with a sequence of local elements. An R/3 table translates to a schema complexType containing a local element with minOccurs and maxOccurs.

Getlist Function Module

The following provides an example of how an RFC function module, bapi_companycode_getlist, is viewed in a generated XML schema format; one for input and one for output. This standard API function module returns a list of companies in the R/3 system database. The RFC function module can be located in the R/3 System in the area F, in the Function Group Group0002.

Text description of group002.gif follows.

Text description of the illustration group002.gif

*"----------------------------------------------------------------------
FUNCTION BAPI_COMPANYCODE_GETLIST.
*"----------------------------------------------------------------------
*"*"Local interface:
*"       EXPORTING
*"             VALUE(RETURN) LIKE  BAPIRETURN STRUCTURE  BAPIRETURN
*"       TABLES
*"              COMPANYCODE_LIST STRUCTURE  BAPI0002_1
*"----------------------------------------------------------------------

The function module bapi_companycode_getlist has 2 parameters:

The BAPI0002_1 structure is a transfer structure for Object 0002: Company Code Get List. The following is the definition of Structure BAPI0002_1 in R/3.

Component Component Type DTyp Length Dec. Short Text

COMP_CODE

BUKRS

CHAR

4

0

Company Code

COMP_NAME

BUTXT

CHAR

25

0

Name of the company code or company

The BAPIRETURN structure returns the status of the call and associated log messages. The following is the definition of Structure BAPIRETURN in R/3.

Component Component Type DTyp Length Dec. Short Text

TYPE

BAPI_MTYPE

CHAR

1

0

Message type

CODE

BAPI_RCODE

CHAR

5

0

Message Code

MESSAGE

BAPI_MSG

CHAR

220

0

Message text

LOG_NO

BALOGNR

CHAR

20

0

Application log: log number

LOG_MSG_NO

BALMNR

NUMC

6

0

Application log: Internal Message serial number

MESSAGE_V1

SYMSGV

CHAR

50

0

Messages, message variables

MESSAGE_V2

SYMSGV

CHAR

50

0

Messages, message variables

MESSAGE_V3

SYMSGV

CHAR

50

0

Messages, message variables

MESSAGE_V4

SYMSGV

CHAR

50

0

Messages, message variables

The generated schema for the input record looks like this:

<xsd:schema targetNamespace='http://www.oracle.com/appadapters'

elementFormDefault='unqualified'
xmlns:exposed='http://www.oracle.com/appadapters'
xmlns:xsd='http://www.w3.org/2001/XMLSchema'>

<xsd:complexType name='RFC_BAPI0002_1'>
<xsd:sequence>
<xsd:element name='comp_code' nillable='true' type='xsd:string'/>
<xsd:element name='comp_name' nillable='true' type='xsd:string'/>
</xsd:sequence>
</xsd:complexType>

<xsd:complexType name='RFC_BAPI0002_1Seq'>
<xsd:sequence>
<xsd:element name='item' nillable='true' 
type='exposed:RFC_BAPI0002_1' 
minOccurs='0' maxOccurs='unbounded'/>
</xsd:sequence>
</xsd:complexType>

<xsd:element name='RFC_Group0002_bapi_companycode_getlist_Request'
nillable='true'>
<xsd:complexType>
<xsd:sequence>
<xsd:element name='companycode_list' nillable='true'
type='exposed:RFC_BAPI0002_1Seq'/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>

The generated schema for the output record looks like this:

<xsd:schema targetNamespace='http://www.oracle.com/appadapters'

elementFormDefault='unqualified'
xmlns:exposed='http://www.oracle.com/appadapters'
xmlns:xsd='http://www.w3.org/2001/XMLSchema'>

<xsd:complexType name='RFC_BAPIRETURN'>
<xsd:sequence>
<xsd:element name='type' nillable='true' type='xsd:string'/>
<xsd:element name='code' nillable='true' type='xsd:string'/>
<xsd:element name='message' nillable='true' type='xsd:string'/>
<xsd:element name='log_no' nillable='true' type='xsd:string'/>
<xsd:element name='log_msg_no' nillable='true' type='xsd:int'/>
<xsd:element name='message_v1' nillable='true' type='xsd:string'/>
<xsd:element name='message_v2' nillable='true' type='xsd:string'/>
<xsd:element name='message_v3' nillable='true' type='xsd:string'/>
<xsd:element name='message_v4' nillable='true' type='xsd:string'/>
</xsd:sequence>
</xsd:complexType>

<xsd:complexType name='RFC_BAPI0002_1'>
<xsd:sequence>
<xsd:element name='comp_code' nillable='true' type='xsd:string'/>
<xsd:element name='comp_name' nillable='true' type='xsd:string'/>
</xsd:sequence>
</xsd:complexType>

<xsd:complexType name='RFC_BAPI0002_1Seq'>
<xsd:sequence>
<xsd:element name='item' nillable='true'
type='exposed:RFC_BAPI0002_1'
minOccurs='0' maxOccurs='unbounded'/>
</xsd:sequence>
</xsd:complexType>

<xsd:element name='RFC_Group0002_bapi_companycode_getlist_Reply'
nillable='true'>
<xsd:complexType>
<xsd:sequence>
<xsd:element name='return' nillable='true'
type='exposed:RFC_BAPIRETURN'/>
<xsd:element name='companycode_list' nillable='true'
type='exposed:RFC_BAPI0002_1Seq'/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>

Go to previous page Go to next page
Oracle
Copyright © 2003 Oracle Corporation.

All Rights Reserved.
Go To Documentation Library
Home
Go To Product List
Solution Area
Go To Table Of Contents
Contents
Go To Index
Index