Show TOC

Error Handling in the Data Model GeneratorLocate this document in the navigation structure

The Data Model Generator tool has the capability to perform error handling for the runtime of the SAP Gateway services it creates.

The following describes the error handling capabilities for the different data sources for a service.

BOR and RFC: Error Handling for Runtime of Services

BAPIs supply the RETURN structure that can be mapped, technically, to a Property in the Data Model.

Do not map this structure into the model, as the generator tool automatically handles the return messages and adds them to the application log of the SAP Gateway host.

At runtime, the messages are collected from the RFC parameter, RETURN, and logged into the application log.

Later, the tool's error handling mechanism goes over all returned messages to find the leading message, which is the main message that was returned from the business process.

Obtaining the leading message is based on internal heuristics that attempts to discover the following:

  • If the SAP backend system message log contains any message of type A (abort), or type E (error), then the message is regarded as a leading message. It is retrieved and sent to the client as an HTTP error.

  • In addition, the messages of type S (success), W (warning) or I (information) are not considered as errors, however, they are added to the application log but no message is sent to the client.

To enable out-of-the-box support for error handling, verify the following from the RFC interface:

  • The parameter that returns the business message is called RETURN.

  • The parameter can be a structure of type BAPIRET2 , and a table of type BAPIRET2_T.

Screen Scraping: Error Handling for Runtime of Services

At design-time, you do not see any return parameter during mapping of recorded screens. However, Screen Scraping automatically captures the messages provided by the running transaction during the runtime of a service and forwards them to the client if required. There are three different uses cases defined according to the returned messages.

The following are the use cases:

  • Process Executed Successfully

    No messages of type Error or Abort are captured.

    Other messages of type Warning, Success, or Information are written to the application log of the SAP Gateway host.

  • Administrator Oriented Messages

    Administrator oriented error messages of type Error or Abort as a result of unexpected behavior of the process, or of the script, such as, unexpected behavior of the transaction. will be captured.

    These errors will be added to the application log of the SAP Gateway host, and a standard error message, Processing of request failed. Contact your system administrator will be sent to the client as an HTTP server error.

  • Transaction Oriented Messages.

    Transaction oriented messages relate to the business of the specific transaction. These messages are actually raised by the transaction itself. For example, error about a wrong input data.

    The messages of type Error or Abort will be captured. These messages will be added to the application log of the SAP Gateway host, and the top most message will be sent to the client as an HTTP server error.