cancel
Showing results for 
Search instead for 
Did you mean: 

Can we send sms to a phone using ABAP in ECC 6.0?

former_member200388
Active Participant
0 Kudos

I have a requirement that on action of a user a sms should be send to a concerned as configured.

Can it be done using ABAP in ECC 6.0 ? Do we have to depend on any other third party system?

Very Urgent!!!

Regards,

Sounak

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos
former_member200388
Active Participant
0 Kudos

Thanks Van...

The forum link that you have sent me, is it free to join?

If yes, after joining it can i set a test application using Twilio API for free?

Can you please guide step by step on this?

Thanks

Sounak

Former Member
0 Kudos

Hi Sounak,

The first link is a project in SAP Code Exchange, and yes it is free to join, you can read more information in this document http://scn.sap.com/docs/DOC-17011

Sadly, it seems that the project hasnt started yet.

Regards,

former_member200388
Active Participant
0 Kudos

Thanks once again....

But unfortunately I am unable to get any clue on my prob...

If there is something which you can sugesst...

Going thorugh some more blogs I have tried to create a program which claims to send sms thorugh a free sms service provide...

I am pasting the code here...

DATA: http_client TYPE REF TO if_http_client .
DATA: wf_string TYPE string ,
result TYPE string ,
r_str TYPE string .
DATA: result_tab TYPE TABLE OF string.

SELECTION-SCREEN: BEGIN OF BLOCK a WITH FRAME .
PARAMETERS: mail(100) LOWER CASE,
m_no(20) LOWER CASE ,
m_mss(120) LOWER CASE.
SELECTION-SCREEN: END OF BLOCK a .

START-OF-SELECTION .
CLEAR wf_string .
CONCATENATE
'http://173.201.44.188/SendSMS.asmx/SendSMSToIndia?MobileNumber='
m_no
'&FromEmailAddress='
mail
'&Message='
m_mss
INTO
wf_string .

CALL METHOD cl_http_client=>create_by_url
EXPORTING url = wf_string
IMPORTING client = http_client
EXCEPTIONS argument_not_found = 1
plugin_not_active = 2
internal_error = 3
OTHERS = 4.

CALL METHOD http_client->send
EXCEPTIONS
http_communication_failure = 1
http_invalid_state = 2.

CALL METHOD http_client->receive
EXCEPTIONS
http_communication_failure = 1
http_invalid_state = 2
http_processing_failed = 3.
CLEAR result .
result = http_client->response->get_cdata( ).

REFRESH result_tab .
SPLIT result AT cl_abap_char_utilities=>cr_lf INTO TABLE result_tab .
LOOP AT result_tab INTO r_str.
WRITE:/ r_str .
ENDLOOP .

But I am getting an error which tells me it could not connect to the http whereas I believe I have successfully confiugred http client proxy settings...

Error--->

<H2><b>404 Resource not found</b></H2><br>Partner not reached<br><br><hr>

<table border="0">

<tr><td>Error:</td><td>-20</td></tr>

<tr><td>Version:</td><td>7200</td></tr>

<tr><td>Component:</td><td>ICM</td></tr>

<tr><td>Date/Time:</td><td>Mon Dec 31 06:55:43 2012#</td></tr>

<tr><td>Module:</td><td>icxxconn.c</td></tr>

<tr><td>Line:</td><td>2271</td></tr>

<tr><td>Server:</td><td>GOLITAPPD274_XEI_01</td></tr>

<tr><td>Error Tag:</td><td>{000040fb}</td></tr>

<tr><td>Detail:</td><td>Connection request from (33/1933/0) to host: 173.201.44.188, service: 8001 failed (NIECONN_REFUSED)#RM-T33, U1933, 230 SOGHOSH, GOLITTS10, 06:55:41, M0, W14, SE38

</table>

<p></p>

</td></tr></table>

<table><tr><td width=50 nowrap></td>

<td nowrap><FONT SIZE=-1><a href="&copy" _mce_href="http://www.sap.com/">&copy">http://www.sap.com/">&copy; 2001-2009, SAP AG</a></FONT>

</td></tr></table>

</body></html>

Can you please suggest on this...

Regards

Sounak

former_member213957
Participant
0 Kudos

Hi Sounak,

you need follow either one of the option:

1.For sending sms you need to do configuration setting  in the system like SMTP and SCOT then only u can send sms SAP to NON-SAP systems. After that u can follow the same code what i attached below.But per sms cost is more compare to below 2nd option.

2. You need to integrate third party tools in sap. Via. this tools they provide web-services, you need to consume web-services and communicate your sap data. Once purchased the tool they will provide all instructions. Tools are like : sybase 365,twilio,airtel... where sybase 365 is the best tool for giving best support to sap system

advantage for 2 option than 1st option:

1.In 2nd option not only a send sms and also possible reply from the mobile devices.

2.For bulk messages sending  the 2nd option is only the good.

regards,

Kishorekumar

vishal_deshpande
Discoverer
0 Kudos

Hi Kishorekumar,

Thanks for info on Sybase 365

We have a requirement of sending bulk SMS from SAP and receiving the SMS reply

I would like to know more about Sybase365, how is it integrated and how would it be cost effective for bulk SMS

Would appreciate your inputs here

Thanks

Regards

- Vishal

Answers (6)

Answers (6)

Former Member
0 Kudos

Hi,

Check this Program.

SWN_TEST_SEND_SMS1

before that you need to configure SMS setting in SCOT.

Thanks

Ravi Pratap Singh

0 Kudos

Dear Sounak,

We can configure the SMS configuration to ECC system.

From the third party vendor you need the following things:-

1) URL link

2) User ID

3) Password

once you got this, then follow this documentation on this link http://scn.sap.com/docs/DOC-57910

Regards,

Mahip

Former Member
0 Kudos

Hello,

Please follow this link.I is useful.

Search Results sms &amp;laquo; Sap Pandit !!

After setting ( As per above link ), use the following Program

REPORT  zabap_sms.

DATA: http_client TYPE REF TO if_http_client.

DATA: wf_string TYPE string ,

       result TYPE string ,

       r_str TYPE string .

DATA: result_tab TYPE TABLE OF string.

SELECTION-SCREEN: BEGIN OF BLOCK a WITH FRAME TITLE text-001 .

PARAMETERS: m_no(20)   LOWER CASE NO-DISPLAY,

                          m_mss(240) LOWER CASE NO-DISPLAY.

SELECTION-SCREEN: END OF BLOCK a .

*--------------------------------------------------------------------*

*--Start of Selection

*--------------------------------------------------------------------*

START-OF-SELECTION .

*-- Set Paramaeter Id for Call program from anywhere

   GET PARAMETER ID 'MNO' FIELD m_no.

   GET PARAMETER ID 'MSG' FIELD m_mss.

*--------------------------------------------------------------------*

   CLEAR wf_string .

   CONCATENATE

      'http://XXXXXXXXXXXXXXXXXXXX' m_mss INTO  wf_string .

*-- Call Class for Send SMS

   CALL METHOD cl_http_client=>create_by_url

     EXPORTING

       url                = wf_string

     IMPORTING

       client             = http_client

     EXCEPTIONS

       argument_not_found = 1

       plugin_not_active  = 2

       internal_error     = 3

       OTHERS             = 4.

   CALL METHOD http_client->send

     EXCEPTIONS

       http_communication_failure = 1

       http_invalid_state         = 2.

   CALL METHOD http_client->receive

     EXCEPTIONS

       http_communication_failure = 1

       http_invalid_state         = 2

       http_processing_failed     = 3.

   CLEAR result .

   result = http_client->response->get_cdata( ).



Here  XXXXXXXXXXX is given path or api by SMS Vendor.



Ram

0 Kudos

Hello Ram Shankar,

Thanks for code. When I execute the program, the program isn't executing. What can I do for that.

with regards

Aditya

bhuvneshkumar_gupta
Participant
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,

Bhuvnesh

Former Member
0 Kudos

Hi Bhuvnesh,

I am looking for an option to send SMS from SAP ECC System, it is just required to send a random password to the users from SAP and use it for purpose.

Also having looked at your options which are very helpful to start with , the second point you mentioned and the OSS Note says mostly about the SCOT configuration for sending email.

I understand that the SMS also will be sent in a email format to the SMS server (having the domain as the extension mobile-number@airtel.com for example), my doubt here is from that respective SMS server how the SMS will be triggered? Do we have to make a request to the Mobile service provider to push the SMS from SMS server?

Apart from this the overall picture looks very simple with no further set up required? Am I right? Can you please throw some light here so it will be very helpful.

former_member213957
Participant
0 Kudos

hi Sounak,

Follow the below code and using oops only..

DATA:lt_contents  TYPE STANDARD TABLE OF soli,
lv_oid      
TYPE sysuuid_x.

DATA:lr_send_request TYPE REF TO cl_bcs,
lr_document    
TYPE REF TO cl_document_bcs,
lr_recipient   
TYPE REF TO if_recipient_bcs,
lr_cx_document 
TYPE REF TO cx_document_bcs,
lr_cx_address  
TYPE REF TO cx_address_bcs,
lr_cx_send_req 
TYPE REF TO cx_send_req_bcs.


DATA: ls_print_doc_info      LIKE LINE OF  it_print_doc_info,
ls_et_guid            
LIKE LINE OF  et_guid,
lt_independent_numbers
TYPE TABLE OF bapiadtel,
ls_independent_numbers
LIKE LINE OF  lt_independent_numbers,
lt_numbers            
TYPE TABLE OF adr2,
ls_number             
LIKE LINE OF  lt_numbers,
lt_bp_info            
TYPE TABLE OF bus000_td,
ls_bp_info            
LIKE LINE OF  lt_bp_info,
ls_bp_title           
TYPE          tsad3t,
lt_sms_text           
TYPE TABLE OF esms_longtext_in,
ls_sms_text           
LIKE LINE OF  lt_sms_text,
lt_bp_no_mobile       
LIKE STANDARD TABLE OF ls_print_doc_info-partner,
ls_messages           
LIKE LINE OF et_messages.


"""""""""""""""""""""""""""logic for sending the information using class
TRY.
**-- Create persistent send request
lr_send_request
= cl_bcs=>create_persistent( ).
**-- Create Document
TRY .
lr_document
= cl_document_bcs=>create_from_text(
i_text       
= lt_contents     " Content for adding attachments
i_documenttype
= 'RAW'
i_subject     
= lv_sub
i_importance  
= '1'
i_sensitivity 
= 'O' ).
CATCH cx_document_bcs.
CREATE OBJECT lr_cx_document.
ls_messages
-message = lr_cx_document->get_text( ).
CONCATENATE 'For' ls_print_doc_info-opbel ls_messages-message INTO ls_messages-message.
ls_messages
-msgtype = 'E'.
APPEND ls_messages TO et_messages.
ENDTRY.

**-- Add document to send request
CALL METHOD lr_send_request->set_document( lr_document ).
**--add reciever............. and create address
TRY .
CALL METHOD cl_cam_address_bcs=>create_sms_address
EXPORTING
i_number
= ls_number-telnr_long    " Mobile number add here
RECEIVING
result  
= lr_recipient.

CALL METHOD lr_send_request->add_recipient
EXPORTING
i_recipient
= lr_recipient
i_express  
= 'X'.
CATCH cx_address_bcs.
CREATE OBJECT lr_cx_address.
ls_messages
-message = lr_cx_address->get_text( ).
ls_messages
-msgtype = 'E'.
CONCATENATE 'For' ls_print_doc_info-opbel ls_messages-message INTO ls_messages-message.
APPEND ls_messages TO et_messages.
ENDTRY.
**-- set flag for sending immediatly sms
IF iv_immediate = 'X'.
CALL METHOD lr_send_request->set_send_immediately
EXPORTING
i_send_immediately
= 'X'.
ENDIF.
**-- Send sms
CALL METHOD lr_send_request->send(
EXPORTING
i_with_error_screen
= 'X'
RECEIVING
result             
= lv_result ).



former_member200388
Active Participant
0 Kudos

Thanks Kishore...

I am trying yusing your code snippet but getting following syntactical error  'it_print_doc_info' is not a standard structure and same for 'esms_longtext_in'.

Can you please calrify?

Regards

Sounak

former_member213957
Participant
0 Kudos

Hi Sounak,

esms_longtext_in  and it_print_doc_info is not required for you case.I forgot delete those lines,those are structures for my requirement code and purpose of message handling. so , u can remove those lines like lt_sms_text,ls_sms_text , in the declaration and similarly lt/ls_print_doc_info is the structure also. These changes will not effect code.

If my code helps your requirement , please reward the points.

former_member200388
Active Participant
0 Kudos

Thanks...

I will surely reward points....

This time your code snippet compiled and got executed. But sms is not going to the mobile number provided.

I have also checked through SOST and found one document created in OUTBOX and tried forcibly sending the document from there by providing receipent and pager service...

Please suggest such that atleast once I can replicate the sending of sms...

Regards,

Sounak

Former Member
former_member200388
Active Participant
0 Kudos

I believe all of us aware of mobile communication technology...

But the link that you have send I dont think anyhow it solves my problem...

Does it???

Regards

Sounak

former_member213957
Participant
0 Kudos

Hi sounak,

In SOST, u can trigger the sms direclty for this there is button check properly, i forgot exactly the button name in this transaction.

But before you should do SCOT(tcode) configuration for SMTP, otherwise you cant send sms until you done this configuration.

regards,

Kishorekumar

former_member213957
Participant
0 Kudos

Hi sounak,

In SOST, u can trigger the sms direclty for this there is button check properly, i forgot exactly the button name in this transaction.

But before you should do SCOT(tcode) configuration for SMTP, otherwise you cant send sms until you done this configuration.

regards,

Kishorekumar

former_member213957
Participant
0 Kudos

Hi sounak,

In SOST, u can trigger the sms direclty for this there is button check properly, i forgot exactly the button name in this transaction.

But before you should do SCOT(tcode) configuration for SMTP, otherwise you cant send sms until you done this configuration.

regards,

Kishorekumar

0 Kudos

Hello Kishore,

The code which you have sent is good, but when i use the code I am getting the error like  it_print_doc_info is unknown can you please help me out in this.

thanks in advance

with regards

Aditya

former_member200388
Active Participant
0 Kudos

I want to send sms when appraisal document status is changed as email notifications are generally sent...

Please can anybody help me on this...

former_member227150
Active Participant
0 Kudos

Hi Sounak,

To send SMS from ECC SMS configuration needs to be done by Basis guy in consultation with Third party SMS company.

After this only you can trigger SMS from the ABAP program directly.

Regards,

Gaurav

former_member200388
Active Participant
0 Kudos

Thanks for your reply...I have few more querries.

But can you tell me what we for need to consult with Third Party sms company?

And if I want to check my feasibility of this concept is there any free of cost method without entering any business with the Third Party sms company?

One more query, can we do the configuration with mobile phone number individually?

Regards,

Sounak.