Show TOC

Server MessagesLocate this document in the navigation structure

Server messages are created by the message parser, then processed by the message processor and then propagated to the message manager. The message target, if set, must correspond to a binding path.

The v2.ODataModel supports automatic parsing of server messages by means of sap.ui.model.odata.ODataMessageParser. These messages are propagated by sap.ui.model.odata.v2.ODataModel. For additional service types, an application can implement its own parser.

Target

The target of a server message can be empty. In this case, the server message has no specific target and is relevant for the whole application. If a target is set, it must correspond to a binding path, which is then used to propagate the message to the corresponding Binding. The Binding notifies each control that binds to that path.

Creating Server Messages for Testing Purposes

To create messages manually that are handled like server messages, use model as message processor as follows:

// oMyModel is defined elsewhere...

var oMessageManager = sap.ui.getCore().getMessageManager();

oMessageManager.registerMessageProcessor(oMessageProcessor);

var oInput = new sap.m.Input({
    id: "myInputId",
    value: { path: "/Products(1)/Price", type: new sap.ui.model.type.Float() }
});

oMessageManager.addMessages(
    new sap.ui.core.message.Message({
        message: "Price must contain only numbers",
        type: sap.ui.core.MessageType.Error,
        target: "/Products(1)/Price",
        processor: oMyModel
    })
);