Quantcast
Viewing all articles
Browse latest Browse all 8627

Re: How to Send SMS to mobile through workflow??

You can send SMS through Function Module. Its Simple

 

FM:  SO_NEW_DOCUMENT_SEND_API1

 

**********Code Logic***************************************

 

SELECTSINGLE anred

   FROM pa0002

   INTO l_v_anred

   WHERE pernr = requestor_id

   AND   endda = '99991231'.

 

 

   SELECTSINGLE atext

     FROM t522t

     INTO l_v_title

     WHERE sprsl = 'EN'

     AND   anred = l_v_anred.

 

   SELECTSINGLE usrid

     FROM pa0105

     INTO l_v_mobile

     WHERE pernr = requestor_id

     AND   endda = '99991231'

     AND   usrty = 'CELL'.

 

Fetch the details of the SMS content in table: t_itab.

 

LOOPAT t_itab INTO wa_itab.

     IF sy-tabix = '1'.

       doc_chng-obj_name = 'URGENT'.

       doc_chng-obj_descr = wa_itab-tdline.

       doc_chng-sensitivty = 'P'.

     ELSE.

       objcont = wa_itab-tdline.

       APPEND objcont.

     ENDIF.

   ENDLOOP.

 

DESCRIBETABLE objcont LINES entries.

   READTABLE objcont INDEX entries.

   doc_chng-doc_size = ( entries - 1 ) * 255strlen( objcont ).

 

*Fetch only the last 10 digits

   len = strlen( l_v_mobile ).

   len1 = len - 10.

   l_v_mobile = l_v_mobile+len1(10).

 

***This step is mandatory****

   CONCATENATE'0091' l_v_mobile INTO l_v_cell.

   CONCATENATE'0000''SMS' l_v_cell INTO l_v_receive SEPARATEDBY space.

 

 

   CLEAR reclist.

*Get Receivers for SMS

   reclist-receiver = l_v_receive.

   reclist-rec_type = 'K'.

   reclist-express = 'X'.

   APPEND reclist.

 

 

*  Send the document

   CALLFUNCTION'SO_NEW_DOCUMENT_SEND_API1'

     EXPORTING

       document_type              = 'RAW'

       document_data              = doc_chng

       put_in_outbox              = 'X'

       commit_work                = 'X'

     TABLES

       object_content             = objcont

       receivers                  = reclist

     EXCEPTIONS

       too_many_receivers         = 1

       document_not_sent          = 2

       operation_no_authorization = 4

       OTHERS                     = 99.

 

 

***********************************End of Code*****************************

 

 

SMS will go to the recipients without fail  Image may be NSFW.
Clik here to view.

 

 

 

P.S You have to get the mobile numbers maintained in SU01D


Viewing all articles
Browse latest Browse all 8627

Trending Articles