The push scenario is a generic solution allowing SAP Gateway consumers to subscribe to any business objects in order to be automatically notified about any changes. In addition, push flow offers the following functionality:
Payload push
Business data can be sent along with a notification. See also Enabling the Payload Push Scenario in Your Application.
Extended filter criteria
Business objects fields may be used in filter criteria to define a subset of subscribed entities.
Subscription to follow changes in particular sales order.
Subscription to get workflow items forwarded to the user for approval.
For an example see Sample Application.
Subscription
Subscription is always done to a business object collection using a filter.
For example, a user may subscribe to all customers belonging to California and thus be notified as soon as a new California customer is created in the backend system or if there are any changes in any California customer.
The most important particular cases of the filter are:
Subscription to the whole collection (the filter is empty)
Subscription to a specific business object instance (the filter contains just an ID)
Feed
A feed is simply a collection of notifications for an end-user. It is the result of user’s subscriptions to different collections. The notifications may be pushed automatically to the end-user or pulled.
Example of a feed on a mobile device:
A Travel Request of $1500 from Martin Lacasse was received
Sales Order 123 was updated
The address of Customer 456 has changed
A new track inspection was assigned to your work center
Subscription Process Flow
To subscribe, a consumer sends a subscription request to SAP Gateway specifying a user and subscription content (collection, filter, delivery method etc.).
SAP Gateway has to validate the request and to forward it further to backend.
If the subscription is accepted by the backend then it is saved by SAPÂ Gateway in the subscription persistence layer and an acknowledgement is sent to the consumer.
The process flow to unsubscribe is similar.
Notification Process Flow
The backend tracks the changes in business objects and sends a change notification to SAP Gateway as soon as any change/create/update happens in the business object collection subscribed to.
SAP Gateway receives the notification, and forwards it to a consumer using the appropriate format and delivery method.
If the consumer is a connectivity server it has its own logic to deliver the notification to end-devices.
Subscription Requests
Create Subscription
The delivery address must have one of the following formats:
urn:sap-com:channel:<RFC destination>:<request URI>
http://... or https://...
Example:
POST http://<server name>:<port number>/sap/opu/sdata/iwcnt/SalesOrderLookUp.svc/SubscriptionCollection Request Header: Name = X-Requested-With, value = XMLHttpRequest Request Body: <atom:entry xmlns:atom="http://www.w3.org/2005/Atom"> <atom:id/> <atom:title>Testatom:title>Test> <atom:author/> <atom:updated/> <atom:content type="application/xml"> <m:properties xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"> <d:deliveryAddress>urn:sap-com:channel:rainbow:/user(777)/ERP-SEARCH/notificationsd:deliveryAddress>urn:sap-com:channel:rainbow:/user(777)/ERP-SEARCH/notifications> <d:collection>SalesorderheaderCollectiond:collection>SalesorderheaderCollection> <d:filter>value eq '0000004003' and scheme_id eq 'SALES_ORDER' and scheme_agency_id eq 'Q5K_004'> </m:properties> </atom:content> </atom:entry>
Note that no direct URLs in delivery addresses are supported unless there is an RFC destination of type G (HTTP destination to external server) that contains the host and the post specified in the delivery address. The comparison is case-insensitive and it is performed for strings (that is. no DNS names resolution). For example, if you want to subscribe with delivery address http://endpoint.somewhere.com:8000/application/user-inbox there must be an RFC destination with target host endpoint.somewhere.com and target port 8000. he URN-based delivery addresses are not affected.
Delete Subscription
Note that a subscription ID must exist for your user.
Example:
DELETE: http://<server name>:<port number>/sap/opu/sdata/iwcnt/SalesOrderLookUp.svc/SubscriptionCollection(value='005056B40E791DEFB0AD9237BD0657E1',scheme_id='IWF_SUBSCRIPTION',scheme_agency_id='Q5K_004') Request Header: Name = X-Requested-With, value = XMLHttpRequest
Get List of Subscriptions
Note that the list contains subscriptions for the current user only.
Example:
GET: http://<server name>:<port number>/sap/opu/sdata/iwcnt/SalesOrderLookUp.svc/SubscriptionCollection Request Header: Name = X-Requested-With, value = XMLHttpRequest
Get Subscription Details
Note that a subscription ID must exist for your user.
GET: http://<server name>:<port number>/sap/opu/sdata/iwcnt/SalesOrderLookUp.svc/SubscriptionCollection(value='005056B40E791DEFB0AD9237BD0657E1',scheme_id='IWF_SUBSCRIPTION',scheme_agency_id='Q5K_004') Request Header: Name = X-Requested-With, value = XMLHttpRequest
Make sure that you have done the necessary configuration steps for notifications.
An How-To Guide on How to Enable Business Object Eventing is available in the Technology Innovation knowledge center area in the SAP Community Network (SCN) under http://www.sdn.sap.com/irj/sdn/gateway.