How to send iOS push notification from ABAP to SCP Mobile Services
You wonder how to send push notifications from your SAP Business Suite system directly to your mobile devices.
Development access to a NetWeaver / Business Suites system
ABAP Git installed on your backend system
SAP Cloud Connector configured with principal propagation
An SCP sub-account with mobile services activated (Neo or Cloud Foundry)
A native app configured in mobile services with the push notification feature enabled
The goal is to be able to sent push notifications from your backend in ABAP directly to your mobile devices (iOS, Android).
Step 1 – Create and configure an RFC destination
Step 2 – Import SCP certificate to the SAP System Trust Store
Step 3 – Test your connection
Step 4 – Install abapGit
Step 5 – Import the SCPmsPushNotificationREST_API repo in your system
Step 6 – Configure mobile services
Step 7 – Use the API to send push notifications
Step 8 – Configure your other systems
You can find the detail of all these steps on my GitHub repo that you will need to clone via abapGit
Activate the push notification capability of your iOS application in Xcode. You app should be configured with the SCP iOS SDK.
Launch / onboard your app and verify the device token has been uploaded successfully to CPms under user registration, check for the field APNS device token.
Create an ABAP program with your business logic for dispatching push notification to your devices, here is an example of how to used the API.
DATA(notification) = zcl_scpms_notification=>create_apns_notification( ). notification->set_title( alert_title ). notification->set_body( alert_body ). notification->set_badge( badge_value ). DATA scp_users TYPE zscpms_user_t. TRY. DATA(push) = zcl_scpms_push_notification=>get_instance( ). APPEND INITIAL LINE TO scp_users ASSIGNING FIELD-SYMBOL(<scp_user>). <scp_user>-name = 'myUserID'. DATA(response) = push->push_to_app_users( application_id = application_id users = scp_users notification = notification ). response->get_status( IMPORTING code = DATA(code) reason = DATA(reason) ). IF code BETWEEN 200 AND 299. "Success ELSE. "Handle network error ENDIF. CATCH zcx_scpms_push_notification INTO DATA(ex). "Handle exception error ENDTRY.
for enhancements or bugs, please send me pull requests