Application Development and Automation 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: 
Read only

Send SMS

Former Member
0 Likes
438

Hi Expert.

We have generated below code for Send SMS.  But this is not working please check and suggest what i have missed.

CONCATENATE 'http://smsidea.co.in/sendsms.aspx?&mobile=serviceprovidemobileno&pass= password' '&senderid= sendid' '&to='wa_mobno-mobileno'&msg='text

                       INTO msg_string.

           CALL METHOD cl_http_client=>create_by_url

             EXPORTING

               url                = msg_string

             IMPORTING

               client             = http_client

             EXCEPTIONS

               argument_not_found = 1

               plugin_not_active  = 2

               internal_error     = 3

               OTHERS             = 4.

           IF sy-subrc <> 0.

*            MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

*                       WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

           ENDIF.

           CALL METHOD http_client->send

             EXCEPTIONS

               http_communication_failure = 1

               http_invalid_state         = 2.

           IF sy-subrc <> 0.

*            MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

*                       WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

           ENDIF.

           CALL METHOD http_client->receive

             EXCEPTIONS

               http_communication_failure = 1

               http_invalid_state         = 2

               http_processing_failed     = 3.

           IF sy-subrc <> 0.

*            MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

*                       WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

           ENDIF.

           CLEAR: wa_mobno, msg_string.



Thanks,


Pradip Patel

1 REPLY 1
Read only

paul_bakker2
Active Contributor
0 Likes
392

You need to handle the errors properly, so that you can see what the issue is.

If sy-subrc <> 0, you are ignoring the error message & continuing regardless. That is not a good idea.