Skip to Content
Technical Articles
Author's profile photo Ayman Elgendi

Send SMS from SAP system with XML or JSON payload

Introduction

In some cases we need to send sms message to our employees or customers, SAP provide a way to send sms through third parties but with a limit that sms text should be provided in an url. for example the service provider should deliver a url like this:

http://mysmsprovider.com/sendmsg.asp?recipient_addr=<reci_addr>&account=123456&password=<password>&sender_addr=<orig_addr>&sender_name=<orig_name>&message=<message>

In some cases the service provider don’t provide this url, however he provide a url with post method and user name, password, sms numbers and message text are sent as xml or json payload.

In this blog we will highlight the steps to send a text sms with a url and a xml or json payload. we well wrap service provided url with our url and make our SAP sittings to our new url. Then we will make a function module to handle the requests from our wrapped url.

we will include steps for
1- create function module to send sms
2- create a service to call our function module
3- make sms settings to connect with our new url ( not in our scope )

1- Create a function module to send sms

Create a function module to send sms called z_sms to take two parameters
1- recipient number p_phone
2- text message p_sms


In this function module we will make an http call to our service provider url
and pass a payload like this.

 

2- create a service to call our function module

Open tcode: sicf and create a service called zsms, provide your username, password and put a class to handle requests come on it.

This class must implement interface: IF_HTTP_EXTENSION

 

Test your new service and add your desired parameters as

https://<sap_url>:<sap-port>/zsms?sap-client=130&p_phone=0123456789&p_sms=test

and open a debugger to notice http parameters.

Now, Call your function module and support http parameters to it

3- make sms settings to connect with our new url

Now we have an url that comply with SAP settings to make sms. A good practise is to put this url in a node in SM59 and use it in next settings.

Open tcode SCOT and make sms settings that i’ll not cover here in this blog, but you can reference to this blog post

https://blogs.sap.com/2014/09/12/sap-sms-configuration/

and also SAP note no: 455140

I put the new url in node call SMS in sm59 and this is final picture

Conclusion

Now you can integrate your sms in SAP system despite it needs a xml or json payload.


Do you have a better solution for this ? if yes please put it in comments.

Thanks

Assigned tags

      Be the first to leave a comment
      You must be Logged on to comment or reply to a post.