Show TOC

Push Sample ApplicationLocate this document in the navigation structure


In this section an example end-to-end scenario for testing is described.


You have following tools installed on you PC:

  • A tool to send subscription requests to SAP Gateway

  • A tool to receive notifications sent by SAP Gateway

Step 1: Setting Up Consumer-Specific Configuration on SAP Gateway

Login to your SAP Gateway host and in transaction SM59 create an RFC destination of type G (HTTP Connection to External Server) pointing to your PC.

Step 2: Subscribing for Sample User Collection

Here is an example of a subscription request to get full notifications (including the business object) for all users except the ones with the first name 'Oliver':

Request Header:
Name = X-Requested-With, value = XMLHttpRequest
 <atom:entry xmlns:atom="">
<atom:title>Subscription for sample user</atom:title>
<atom:content type="application/xml">
<m:properties xmlns:m="" xmlns:d="">
<d:deliveryAddress>http://<host>:<port number>/alerts/</d:deliveryAddress>
<d:filter>firstname ne 'Oliver'</d:filter>

The different parts of the source code are explained in the following sections.


The delivery address must have one of the following formats:

  • urn:sap-com:channel:<RFC destination>:<request URI>

  • http(s)://<host>:<port>/...

In both cases an RFC destination of type G (HTTP destination to external server) must exist on SAP Gateway either having a name n both cases an RFC destination of type "G" (HTTP destination to external server) must exist on SAP Gateway either with the name <RFC destination> or targeted to the <host>:<port>.

The comparison is case-insensitive and it is performed for strings (that is, no DNS names resolution, etc.).

For example, if you want to subscribe with delivery address there must be an RFC destination with target host and target port 8000.


The filter attribute must follow the OData $filter notation (see published on non-SAP site) and may combine any fields using the AND operation only. The filter is mapped by SAP Gateway to select-options which must be processed by the application in the backend in order to control notification flow. SAP Gateway does not evaluate any filter criteria except business object ID, for example, <d:filter>value eq 'tester_user' and scheme_id eq 'IWF_SAMPLE_USER_OBJECT' and scheme_agency_id eq 'XYZ_800'</d:filter>


The select attribute must follow the OData $select notation (see published on non-SAP site).

This attribute allows the subscriber to control the notification format by specifying the subset of the business object hierarchy sent along with the notification. Currently only two values are supported:

  • <d:select></d:select> (empty or missing attribute)

    A short (base) notification without a business object is sent to the subscriber.

  • <d:select>*</d:select>

    The complete hierarchy of the business object is sent.

Step 3: Testing End-to-End Flow

In transaction SE38 you can create a report to send the user object notification to all subscribers at once.

Example coding:

REPORT mytest.

    lo_event_manager type ref to /iwbep/cl_event_manager,
    ls_address       type bapiaddr3,
    lt_xnotif_props	 type /iwbep/t_xnotif_props,
    ls_xnotif_prop   type /iwbep/s_xnotif_prop,
    ls_xnotif_object type /iwbep/s_sample_user,
    lv_object_id     type /iwbep/obj_id,
    lt_return        type table of bapiret2,
    ls_return        type bapiret2,
    lt_subs          type /iwbep/t_subscribers,
    ls_email         type /iwbep/s_sample_user_email.

    p_user type syuname default sy-uname.


* get user data
  call function 'BAPI_USER_GET_DETAIL'
      username = p_user
      address  = ls_address
      return   = lt_return.

  read table lt_return into ls_return with key  type = 'E'.
  if sy-subrc = 0.
    message id ls_return-id type ls_return-type number ls_return-number.

*   fill XNotification properties
    ls_xnotif_prop-name = 'FIRSTNAME'.
    ls_xnotif_prop-value = ls_address-firstname.
    append ls_xnotif_prop to lt_xnotif_props.
    ls_xnotif_prop-name = 'LASTNAME'.
    ls_xnotif_prop-value = ls_address-lastname.
    append ls_xnotif_prop to lt_xnotif_props.

*   fill XNotification object
    ls_xnotif_object-name = ls_address-lastname.
    ls_xnotif_object-first_name = ls_address-firstname.
    ls_email-child_index = 1.
    ls_email-email = 'Email1'.
    append ls_email to ls_xnotif_object-emails.
    ls_email-child_index = 2.
    ls_email-email = 'Email2'.
    append ls_email to ls_xnotif_object-emails.

*   send event
      create object lo_event_manager.
      lv_object_id = p_user.
      call method lo_event_manager->publish_event
          iv_event_id       = 'SAMPLE_USER_CHANGED'
          iv_object_id      = lv_object_id
          it_xnotif_props   = lt_xnotif_props
          is_xnotif_object  = ls_xnotif_object
          iv_xnotif_inlines = 'Emails'.

    catch /iwbep/cx_event_publisher.
      message 'Failed to send event' type 'E'.



In case of a problem try to analyze the issue yourself before opening a ticket.

For subscription flow you can do the following:

  • Analyze the error message you get in the response.

  • Check the SAP Gateway runtime log via transaction /IWFND/VIEW_LOG and GSDO type IWF_SUBSCRIPTION.

For notification flow you can do the following:

  • Check the Backend Event Publisher log (in the backend system) via transaction SLG1 and Object /IWBEP/*

  • Check the RFC connection from the backend to the SAP Gateway system and the bgRFC Monitor via transaction SBGRFCMON. Note that notifications are sent in the context of a SAP Gateway service user.