Show TOC Start of Content Area

Function documentation Message Type  Locate the document in its SAP Library structure

A message type comprises a data type that describes the structure of a message. For technical reasons, a data type alone is not sufficient to describe the instance of a message: Data types are defined in XML Schema as abstract types that are not yet tied to an element. You can only describe an instance of a message when you have specified a data type as an element type. Therefore, a message type defines the root element of a message.

You can use message types in the following scenarios:

Scenario

Use

Service-Oriented Development

Operations of service interfaces can use the same message type. For example, both an asynchronous operation of an inbound service interface and an asynchronous operation of an outbound service interface can reference the same message type.

Integration Using the Integration Server (A2A, B2B, Web Service)

When you define a message mapping, you can reference message types directly to map messages to each other.

A message type does not define the direction of the message exchange, in other words, whether it is a request or a response. In exceptional cases you can use the same message type for both the request and the response message.

Integration

As an alternative to message types, you can use external definitions or messages from imported RFCs and IDocs (see also: Importing IDocs and RFCs) to describe the structure of messages.

Features

A message type has the following characteristics:

·        It comprises exactly one data type, which determines the content of the message to be transferred.

·        It is identified by a name and an XML namespace. The name (together with the namespace) of a message type is located in the uppermost tag of the exchanged message: This tag is of type Element.

Example

You have defined a message type GreetingRes that references a simple data type of type xsd:string. The XML namespace of the message type is http://sap.com/xi/myExample. The corresponding payload might look as follows:

<?xml version="1.0" encoding="utf-8" ?>

<ns1:GreetingRes xmlns:ns1="http://sap.com/xi/myExample"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   Hello Mrs. Miller
</ns1:GreetingRes>

You can specify how a message type is used in more detail in the description.

Example

In the example below, two operations from different service interfaces each use the same message type for the request message and the response message:

This graphic is explained in the accompanying text

More Information

Creating a Message Type

 

 

 

End of Content Area