Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to send SMS by using ABAP program

Former Member
0 Kudos

HI Gurus,

I need to notify the vendor through sms when his goods are received. His details are stored in vendor master.

My problem is that I am not able to find any function module for the same.

Do any of you know how to send 'sms' to particular mobile number using ABAP.

Are there any basis settings required for the same?

Thanks and Regards,

Saurabh

1 ACCEPTED SOLUTION

former_member200338
Active Contributor
0 Kudos

Hi,

It is possible to send SMS to other system. There are various options to do that.. However u need to have a mobile operator inbetween to do this.

The simplest way would be send the mobile number and messge as E-mail from ABAP program to the operator. The operator inturn will send the SMS.

This method will have acknowledgement of the message sent . Also operator can provide us report for specific date.

Please find the different ways of achieving it.

1. We need to upload the .WSDL file from the SMS provider into the SAP system (WSDL: Web Services Description Language which provides information about how to call a web service). Configure the logical port settings. (Transaction LPCONFIG). Then we can write an ABAP program which will accept the mobile number, message and will send it as SMS.

2. We can configure SMS in the SAP web application server using SMTP by creating a node. (Transaction SCOT). We can send a mail to configured receipt (using FM SO_NEW_DOCUMENT_ATT_SEND_API1) which will in turn send a SMS.

3. Create a RFC enabled Function module which will accept the mobile number, message etc. Import the RFC and WSDL into integration repository (SAP XI). Create message and interface mapping. Create business services and communication channels. When function module is called, a SMS will be sent.

For point 2, refer oss note 455140

For point 1, refer /people/thomas.jung3/blog/2004/11/17/bsp-a-developers-journal-part-xiv--consuming-webservices-with-abap

Check following links for more clarification

/people/abesh.bhattacharjee/blog/2007/03/12/send-sms-to-india-from-xmii-115 = Send SMS to India from xMII 11.5...

Send SMS to India from ABAP /people/durairaj.athavanraja/blog/2005/07/12/send-sms-to-india-from-abap

BSP a Developer's Journal Part XIV - Consuming WebServices with ABAP

/people/thomas.jung3/blog/2004/11/17/bsp-a-developers-journal-part-xiv--consuming-webservices-with-abap

Reward points if useful.

Regards,

Niyaz

4 REPLIES 4

Former Member
0 Kudos

yah we can sens SMS from ABAP u can check this blog for coding:

/people/durairaj.athavanraja/blog/2005/07/12/send-sms-to-india-from-abap

Former Member
0 Kudos

Hi,

Pls check the below links

http://help.sap.com/saphelp_nw04/helpdata/en/58/97c43af280463ee10000000a114084/frameset.htm

/people/ronen.fox/blog/2007/12/06/sending-sms-notification-via-business-workflow

http://www.saptechnical.com/Tutorials/Workflow/Workflow.htm

You can use the FM: 'SO_DOCUMENT_SEND_API1' &

'SO_DOCUMENT_SEND_API1_NEW'.

to send the mail,sms etc.

But you have to make some chamnges in the reciever table, jus go thru FM documnetaion once, you will fine the option for sending SMS thru either of this FM.

Below is a sample code for sending e-mail.

so, u can take help from this.

data declarations 

DATA : v_sender TYPE soextreci1-receiver,
v_doc TYPE sodocchgi1,
it_paklist TYPE STANDARD TABLE OF sopcklsti1 ,
wa_paklist TYPE sopcklsti1 ,
it_obj_head TYPE STANDARD TABLE OF solisti1 ,
it_obj_bin TYPE STANDARD TABLE OF solisti1 ,
it_obj_txt TYPE STANDARD TABLE OF solisti1 ,
it_obj_rcv TYPE STANDARD TABLE OF somlreci1 ,
wa_obj_rcv TYPE somlreci1 ,
v_desc(100).

CONSTANTS: c_start(12) TYPE c VALUE '000000000000001',
c_num(12) TYPE c VALUE '000000000000002',
c_num1(12) TYPE c VALUE '000000000010030',
c_raw(3) TYPE c VALUE 'RAW',
c_test(4) TYPE c VALUE 'TEST',
c_X(1) TYPE c VALUE 'X'.


refresh internal tables 
REFRESH : it_paklist, it_obj_rcv.


clear internal tables 
CLEAR : it_paklist, it_obj_rcv, v_sender.
v_sender = sy-uname.


fill internal table it_paklist 
wa_paklist-head_start = c_start.
wa_paklist-head_num = c_num.
wa_paklist-body_start = c_start.
wa_paklist-body_num = c_num1.
wa_paklist-obj_name = c_test .
wa_paklist-doc_type = c_raw .
wa_paklist-transf_bin = c_X .
APPEND wa_paklist TO it_paklist.
clear: wa_paklist.


Data in the Header/subject Line 

v_desc = text-005 .

v_doc-obj_name = c_objname .
v_doc-obj_descr = v_desc.



Mail text 
APPEND v_desc TO it_obj_txt.


Preparing the receiver list 
wa_obj_rcv-rec_type = 'U'.

wa_obj_rcv-rec_type = 'C'. 


v_dlist = 'SCE_TEST'. 
wa_obj_rcv-receiver = v_dlist. "Distribution list. 
wa_obj_rcv-receiver = Enter the mail id .
APPEND wa_obj_rcv TO it_obj_rcv.


Call the function module to send mail 
IF NOT it_obj_rcv[] IS INITIAL.
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
document_data = v_doc
sender_address = v_sender
sender_address_type = 'B'
put_in_outbox = 'X'
commit_work = 'X'
TABLES
packing_list = it_paklist
object_header = it_obj_head
contents_bin = it_obj_bin
contents_txt = it_obj_txt
receivers = it_obj_rcv
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
OTHERS = 8.

IF sy-subrc NE 0.
MESSAGE text-006 TYPE 'I' .
ENDIF.
ENDIF .

former_member200338
Active Contributor
0 Kudos

Hi,

It is possible to send SMS to other system. There are various options to do that.. However u need to have a mobile operator inbetween to do this.

The simplest way would be send the mobile number and messge as E-mail from ABAP program to the operator. The operator inturn will send the SMS.

This method will have acknowledgement of the message sent . Also operator can provide us report for specific date.

Please find the different ways of achieving it.

1. We need to upload the .WSDL file from the SMS provider into the SAP system (WSDL: Web Services Description Language which provides information about how to call a web service). Configure the logical port settings. (Transaction LPCONFIG). Then we can write an ABAP program which will accept the mobile number, message and will send it as SMS.

2. We can configure SMS in the SAP web application server using SMTP by creating a node. (Transaction SCOT). We can send a mail to configured receipt (using FM SO_NEW_DOCUMENT_ATT_SEND_API1) which will in turn send a SMS.

3. Create a RFC enabled Function module which will accept the mobile number, message etc. Import the RFC and WSDL into integration repository (SAP XI). Create message and interface mapping. Create business services and communication channels. When function module is called, a SMS will be sent.

For point 2, refer oss note 455140

For point 1, refer /people/thomas.jung3/blog/2004/11/17/bsp-a-developers-journal-part-xiv--consuming-webservices-with-abap

Check following links for more clarification

/people/abesh.bhattacharjee/blog/2007/03/12/send-sms-to-india-from-xmii-115 = Send SMS to India from xMII 11.5...

Send SMS to India from ABAP /people/durairaj.athavanraja/blog/2005/07/12/send-sms-to-india-from-abap

BSP a Developer's Journal Part XIV - Consuming WebServices with ABAP

/people/thomas.jung3/blog/2004/11/17/bsp-a-developers-journal-part-xiv--consuming-webservices-with-abap

Reward points if useful.

Regards,

Niyaz

Former Member
0 Kudos

Thanks everybody this will be enough.