Abap code to send sms

Hai Everyone,
         I am developing a small leave application. as of now functionally everything is working perfectly. but as an added feature to this application I wanted to provide an option where employees could apply for leave by sending sms as well as the response from the team lead can be done using sms itself. so, please provide me some ideas on how to implement this.
- Rozario
Edited by: Halley Rozario on May 3, 2011 11:33 AM

Hi,
Sending an SMS from SAP is simple as there are many Vendors(some offer free service with restrictions on no. of chars etc) who expose Web Services which does this, you just need to consume this web service and invoke it within your program. There are many threads/blogs on SDN for this.
However, receiving an SMS is different game altogether, you might need a GSM/3G modem(software) connected to a service provider etc or use a SMS gateway. There are many software which can do this for ex: Diafaan etc.
Regards,
Chen
Edited by: Chen K V on May 3, 2011 3:21 PM

Similar Messages

  • Any sample ABAP code to send Lotus Notes email to a list of people?

    Any sample ABAP code to send Lotus Notes email to a list of people?
    We will give you reward points!

    hi..
      This sample code help you to send mail from SAP .
    REPORT  ZSSO_DOCUMENT_SEND_API1.
    DATA: OBJPACK LIKE SOPCKLSTI1 OCCURS  2 WITH HEADER LINE.
    DATA: OBJHEAD LIKE SOLISTI1   OCCURS  1 WITH HEADER LINE.
    DATA: OBJBIN  LIKE SOLISTI1   OCCURS 10 WITH HEADER LINE.
    DATA: OBJTXT  LIKE SOLISTI1   OCCURS 10 WITH HEADER LINE.
    DATA: RECLIST LIKE SOMLRECI1  OCCURS  5 WITH HEADER LINE.
    DATA: DOC_CHNG LIKE SODOCCHGI1.
    DATA: TAB_LINES LIKE SY-TABIX.
    Creating the document to be sent
    DOC_CHNG-OBJ_NAME = 'OFFER'.
    DOC_CHNG-OBJ_DESCR = 'Auction of a Picasso jr'.
    OBJTXT = 'Reserve price : $250000'.
    APPEND OBJTXT.
    OBJTXT = 'A reproduction of the painting to be auctioned'.
    APPEND OBJTXT.
    OBJTXT = 'is enclosed as an attachment.'.
    APPEND OBJTXT.
    DESCRIBE TABLE OBJTXT LINES TAB_LINES.
    READ TABLE OBJTXT INDEX TAB_LINES.
    DOC_CHNG-DOC_SIZE = ( TAB_LINES - 1 ) * 255 + STRLEN( OBJTXT ).
    Creating the entry for the compressed document
    CLEAR OBJPACK-TRANSF_BIN.
    OBJPACK-HEAD_START = 1.
    OBJPACK-HEAD_NUM   = 0.
    OBJPACK-BODY_START = 1.
    OBJPACK-BODY_NUM   = TAB_LINES.
    OBJPACK-DOC_TYPE   = 'RAW'.
    APPEND OBJPACK.
    Creating the document attachment
    (Assume the data in OBJBIN are given in BMP format)
    OBJBIN = ' \O/ '. APPEND OBJBIN.
    OBJBIN = '  |  '. APPEND OBJBIN.
    OBJBIN = ' / \ '. APPEND OBJBIN.
    DESCRIBE TABLE OBJBIN LINES TAB_LINES.
    OBJHEAD = 'picasso.bmp'. APPEND OBJHEAD.
    Creating the entry for the compressed attachment
    OBJPACK-TRANSF_BIN = 'X'.
    OBJPACK-HEAD_START = 1.
    OBJPACK-HEAD_NUM   = 1.
    OBJPACK-BODY_START = 1.
    OBJPACK-BODY_NUM   = TAB_LINES.
    OBJPACK-DOC_TYPE   = 'BMP'.
    OBJPACK-OBJ_NAME   = 'ATTACHMENT'.
    OBJPACK-OBJ_DESCR = 'Reproduction object 138'.
    OBJPACK-DOC_SIZE   = TAB_LINES * 255.
    APPEND OBJPACK..
    Entering names in the distribution list
    RECLIST-RECEIVER = '[email protected]'.
    RECLIST-REC_TYPE = 'U'.
    APPEND RECLIST.
    RECLIST-RECEIVER = 'DLI-NEUREICH'.
    RECLIST-REC_TYPE = 'P'.
    APPEND RECLIST.
    Sending the document
    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
         EXPORTING
              DOCUMENT_DATA = DOC_CHNG
              PUT_IN_OUTBOX = 'X'
              COMMIT_WORK   = 'X'
         TABLES
              PACKING_LIST  = OBJPACK
              OBJECT_HEADER = OBJHEAD
              CONTENTS_BIN  = OBJBIN
              CONTENTS_TXT  = OBJTXT
              RECEIVERS     = RECLIST
         EXCEPTIONS
              TOO_MANY_RECEIVERS = 1
              DOCUMENT_NOT_SENT  = 2
              OPERATION_NO_AUTHORIZATION = 4
              OTHERS = 99.
    CASE SY-SUBRC.
      WHEN 0.
        WRITE: / 'Result of the send process:'.
        LOOP AT RECLIST.
          WRITE: / RECLIST-RECEIVER(48), ':'.
          IF RECLIST-RETRN_CODE = 0.
            WRITE 'sent successfully'.
          ELSE.
            WRITE 'not sent'.
          ENDIF.
        ENDLOOP.
      WHEN 1.
        WRITE: / 'no authorization to send to the specified number of'              'recipients!'.
      WHEN 2.
        WRITE: / 'document could not be sent to any of the recipients!'.
      WHEN 4.
        WRITE: / 'no authorization to send !'.
      WHEN OTHERS.
        WRITE: / 'error occurred during sending !'.
    ENDCASE.
    Go for SCOT  transaction to send those mails.
    REGARDS,
    VEERESH

  • Code to send sms using j2ee application

    Hi all,
    this is shashi kant,
    plz send me the code to sent a sms using j2ee applications.
    or tell me the api these are used to  develop this kind of application.
    thanks
    my email id is---- [email protected]

    I'm working on a project to send SMS from a MIDlet
    to a servlet and back to the MIDlet through a
    SMSC.can anybody send a sample code for me to get
    help ?you should have a sms server .
    your MIDlet send the parameters to the servlet (mobile phone, message, ..) and, after, the servlet send a request to the sms center and he send to the mobile number the message !
    good luck

  • Code for sending sms

    Hi, i'm a Newbie for J2ME and i'm working on a project which requires to send sms.. Can anyone help me..its urgent....
    Mail to : [email protected]

    Look at the URL below:
    Sending/Receiving SMS on J2ME device
    http://www.java-tips.org/content/view/98/73/

  • Error while writing a code for sending SMS in METHOD http_client_receive

    Hi friends,
                   I have a requirement, where i have to send a SMS from SAP system, i tried follwing codes but in both it is giving me same error. HTTP path mensioned below[ztest_02] is provided by service provider.
    I tried the same url in explorer and i received the SMS properly.
    REPORT ztest_02.
      CONCATENATE
      'http://hapi.smsapi.org/SendSMS.aspx?UserName=xyz&password=586998&MobileNo=919836789543'
      '&SenderID=serdc&CDMAHeader=919833678945&Message=Hirdffan'  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.".......................THIS IS WORKING FINE .. RETURNS SY-SUBRC = 0
      CALL METHOD http_client->send
        EXCEPTIONS
          http_communication_failure = 1
          http_invalid_state         = 2.".......................THIS IS WORKING FINE .. RETURNS SY-SUBRC = 0
      CALL METHOD http_client->receive
        EXCEPTIONS
          http_communication_failure = 1
          http_invalid_state         = 2
          http_processing_failed     = 3.".......................NOT WORKING FINE .. RETURNS SY-SUBRC = 1
    I COPIED ANOTHER CODE FROM NET WHICH IS AS FOLLOWS AS GIVES SAME SY-SUBRC IN SAME METHOD.
    CONCATENATE 'http://www.webservicex.net/globalweather.asmx/GetCitiesByCountry?CountryName='
                p_cnt              INTO http_url .
    CALL METHOD cl_http_client=>create_by_url
       EXPORTING
         url                = http_url
       IMPORTING
         client             = http_client
       EXCEPTIONS
         argument_not_found = 1
         plugin_not_active  = 2
         internal_error     = 3
         OTHERS             = 4. " ...RETURNS SY-SUBRC = 0
    http_client->request->set_header_field( name  = '~request_method'
                                            value = 'GET' ).
    http_client->send( ).
    CALL METHOD http_client->receive
        EXCEPTIONS
          http_communication_failure = 1
          http_invalid_state         = 2
          http_processing_failed     = 3
          OTHERS                     = 4.  '".........THIS RETURNS SY-SUBRC = 0
    My question is why it is failing in same call...
    Is there any authorisation issues?
    Any call is missing in between?
    Is there any network issue?
    pls help........
    Edited by: kiran chorge on Mar 11, 2010 7:42 AM

    Hi Kiran,
    I just resolved this error in my system. If you are running on AIX, then your DNS server will most likely not be configured. To fix this you just have to make the HTTP call without the domain name.
    Just ping the HTTP and find out which IP it is going to, then rewrite your HTTP address as below :
    http://<IP ADDRESS>/SendSMS.aspx?UserName=xyz&password=586998&MobileNo=919836789543'
    '&SenderID=serdc&CDMAHeader=919833678945&Message=Hirdffan
    This should resolve your error. Also the HTTP message you are getting in the given method actually refers to the problem in conversion of a domain name to an IP address as the DNS server is not available. So everything is most likely working fine.
    Thanks & Regards,
    Aditya

  • Trouble with SAPconnect / sending email in ABAP-code

    Hi,
    with the code below I try to send an email from ABAP outside
    to an mail-account in the internet.
    I'll get no error/exceptions but the mail will be not send
    to the internet-mail-account.
    In Transaktion SCOT I checked the SAPconnect-Node "INT"-"SMTP".
    There is a mailserver with the right IP und the right Port. So I don't understand
    what could be the problem!?
    Can anybody help me and say me why the code below doesn't works?
    Best wishes!
    * For API
    data: maildata type sodocchgi1.
    data: mailtxt  type table of solisti1 with header line.
    data: mailrec  type table of somlrec90 with header line.
    start-of-selection.
      clear:    maildata, mailtxt,  mailrec.
      refresh:  mailtxt, mailrec.
      maildata-obj_name = 'TEST'.
      maildata-obj_descr = 'Test'.
      maildata-obj_langu = sy-langu.
      mailtxt-line = 'This is a test'.
      append mailtxt.
      mailrec-receiver = '[email protected]'.
      mailrec-rec_type  = 'U'.
      append mailrec.
        call function 'SO_NEW_DOCUMENT_SEND_API1'
             exporting
                  document_data              = maildata
                  document_type              = 'RAW'
                  put_in_outbox              = 'X'
             tables
                  object_header              = mailtxt
                  object_content             = mailtxt
                  receivers                  = mailrec
             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 <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        endif.
    * Start the send process using the following statement
    submit rsconn01 with mode = 'int' and return.
    Message was edited by:
            sebastian eckes

    SAP is a robust system, which gives many facilities in the form of Function Modules (FMs) for connecting to external systems or for use within the system. With a clever use of these FMs we can achieve a lot of things through ABAP code.
    This article focuses on ways to send E-mails and SAP Mails using ABAP code.
    Firstly SAP Mail
    A SAP mail is a mail internal to the SAP system. It is a very good forum to exchange information with other users. Using a SAP mail in ABAP code facilitates exchange of automatic messages at various stages of the business process. It is easy to use and saves many hassles involved in using workflows for exchanging messages.
    The ABAP code to send a sap mail is built around the FM SO_OBJECT_SEND which has the following pattern.
    call function 'SO_OBJECT_SEND'
    exporting
    EXTERN_ADDRESS = ' '
    FOLDER_ID = ' '
    FORWARDER = ' '
    OBJECT_FL_CHANGE = ' '
    OBJECT_HD_CHANGE = ' '
    OBJECT_ID = ' '
    OBJECT_TYPE = ' '
    OUTBOX_FLAG = ' '
    OWNER = ' '
    STORE_FLAG = ' '
    DELETE_FLAG = ' '
    SENDER = ' '
    CHECK_ALREADY_SENT = ' '
    importing
    object_id_new =
    sent_to_all =
    tables
    OBJCONT =
    OBJHEAD =
    OBJPARA =
    OBJPARB =
    receivers =
    PACKING_LIST =
    ATT_CONT =
    ATT_HEAD =
    NOTE_TEXT =
    exceptions
    active_user_not_exist = 1
    communication_failure = 2
    component_not_available = 3
    folder_not_exist = 4
    folder_no_authorization = 5
    forwarder_not_exist = 6
    note_not_exist = 7
    object_not_exist = 8
    object_not_sent = 9
    object_no_authorization = 10
    object_type_not_exist = 11
    operation_no_authorization = 12
    owner_not_exist = 13
    parameter_error = 14
    substitute_not_active = 15
    substitute_not_defined = 16
    system_failure = 17
    too_much_receivers = 18
    user_not_exist = 19
    x_error = 20
    others = 21.
    In the next article we will understand the main parameters and table interfaces of the FM.
    Import Parameters Name and Description     Field name     Field function
    Object_hd_change (structure) Contains the process to be done when SAP mail is marked for execution.When the Execute Icon in the SAP mail is clicked the corresponding object is executed     vmtyp     ‘D’ for dialog module ‘F’ for function module‘R’ for report‘T’ for transaction‘U’ for transaction with export
         Acnam     Name of the object which is to be executed, like name of transaction/report
         Skips     ‘X’ to execute first screen in background
         Objsns     Indicates sensitivity of the object. ‘P’ for private object‘F’ for functional object‘O’ for confidential object‘C’ for company confidential objectSensitivity level is restricted to ‘O’ for documents in shared folders
         Objla     Language of the document ‘E’ for Englishsy-langu for system language
         Objnam     Name of the document
         Objdes     Short description (Title) of the document
         Objsrt     Name of the sort field. This is used to group documents based on certain criteria
    Object_type Type of document to be sent with mail           ‘RAW’ for raw text (default) ‘DOC’ for word file ‘XLS’ for excel fileAll classes can be used except for folders (‘FOL’) and distribution lists (‘DLI’)
    Outbox_flag           ‘X’ to indicate that mail should also be stored in outbox of the user after sending (default ‘ ‘)
    Owner           Sap login of the user responsible for transmission
    Table Parameters Name and Description     Field Name     Field function
    Objcont Table to hold the body of the mail     Line     Text lines up to 255 characters
    Objhead Table to hold number of lines in the body of the mail, i.e size of the table in lines     Line     Text lines up to 255 characters
    Objpara Table to hold the set/get parameters to be transferred to the processing element     Name     Name of the parameter. Only first three characters are used
         Option     Not used
         Low     Value of the parameter in name
         High     Not used
    Objparb Table to hold information for mails to which a certain processing type is assigned. For a report or transaction with transfer of values to global memory, the table has to contain the parameters with relevant values. The memory id is taken from the first row. For a FM or dialog module, data in table will be transferred as table parameter msgdial     Name     For report or transaction with transfer of values to global memory, the field for first row should hold the name of the memory id used for export and the other rows should hold the parameter names. For FM or dialog module this field should hold the values as per the usage of the module
         Value     For report or transaction with transfer of values to global memory, the field for first row should remain empty and the other rows should hold values of the parameters. For FM or dialog module this field should hold the values as per the usage of the module
    Receivers Table to hold recipient details     Recnam     SAP login of the recipient. Append all the recipients to this table
         Sndcp     X for sending mail as a copy
         Sndex     X for sending as express document. This will prompt a logged on recipient saying that he or she has received an express mail
         Recesc     ‘B’ for SAP user ‘E’ for external email address‘U’ for unix address
    Export Parameters Name and Description     Field name     Field function
    Object_id_new Contains object id of document created during send process            
    Sent_to_all X indicates that document was sent to all recipients. Flag is not activated if sending fails in one or more cases           
    Main Exceptions Name and Description     Description
    Too_much_receivers      Number of recipients is greater than number for which sender is authorised to send
    Object_not_sent     Document was not delivered to any of the recipients
    Object_not_exist     Document class specified does not exist or cannot be sent
    Object_no_authorisation     Document could not be sent as one of the required authorisations does not exist
    Parameter_error     Invalid combination of parameter values transferred to FM
    X_error     Internal error occurred
    Once all the parameters and table interfaces are properly filled, call the function module to send the SAP mail to the recipient inbox.
    Care should be taken to report the status of execution of the function module to the user using one of the exceptions defined (refer function module pattern above)
    Though SAP mail is a very robust method of interacting with users within SAP system, it is always good to receive email in Microsoft inbox. This also works like an additional notification to users in case they do not check SAP mail regularly. The next article covers sending E-mails using ABAP.
    Sending Email to a non-SAP system:
    Though SAP mail is a very robust method of interacting with users within SAP system, it is always good to receive email in Microsoft inbox. This also works like an additional notification to users in case they do not check SAP mail regularly.
    Sending an email to the Microsoft Inbox is a way of interacting with a non SAP system through ABAP code and hence is very interesting. A fair knowledge of UNIX shell scripting is assumed here.
    The ABAP code to send an email to Microsoft inbox revolves around following UNIX script
    Echo "From:" "<"$1">" > <unix file path name>
    Echo "To:" "<"$2">" >> <unix file path name>
    Echo "Subject:" "<"$3">" >> <unix file path name>
    Cat $4 >> <unix file path name>
    Uuencode $5 $6 >> <unix file path name>
    Cat <unix file path name> | /usr/sbin/sendmail –f $fraddr $toaddr
    (Note : the commands in the above script can be case sensitive. Check the actual case on the unix installation in question)
    Let us understand the various parts of the above script.
    $1 = Sender email address
    $2 = Recipient email address
    $3 = Subject of the email
    $4 = Path of unix server file having email body
    Form email body as an internal table in ABAP program, download it to a unix server file
    $5 = Path of unix server file to be sent as email attachment
    $6 = Name to be given to the attachment (like test1.doc, test1.xls). The corresponding Microsoft icon
    will be shown in the email for the type of file attached ( Word document, excel document etc)
    The script builds a temporary file and pipes the file to the sendmail command to achieve the mission.
    This script can be invoked from SAP to send the mail to the intended recipient. Store this small script on the unix server. (Assume script name is sndmail )
    To do this we should define a link in the SAP system between a customized command and this unix script.
    The FM to define a customized command in SAP system has the following pattern.
    call function 'SXPG_CALL_SYSTEM'
    exporting
    commandname =
    PARAMETERS = ' '
    importing
    status =
    tables
    exec_protocol =
    exceptions
    no_permission = 1
    command_not_found = 2
    parameters_too_long = 3
    security_risk = 4
    wrong_check_call_interface = 5
    program_start_error = 6
    program_termination_error = 7
    x_error = 8
    parameter_expected = 9
    too_many_parameters = 10
    illegal_command = 11
    others = 12.
    In the next article we will understand the main parameters and table interfaces of the FM.
    Import Parameters Name and Description     Field name     Field function
    Commandname Name of unix shell script or command to be executed by SAP           Name of unix shell script to be invoked
    Parameters           The parameters to be sent to unix shell script ($1, $2 etc). Send parameters as a concatenated string separated by space and length not exceeding 128 characters For eg in UNIX environment the above shell script would be executed as Sndmail [email protected] [email protected] Trial /home/test.doc testmail.We will be simulating this command using the FM from SAP system
    Table Parameters Name and Description     Field Name     Field function
    Exec_protocol (structure) Table to get messages from unix server after shell script is executed     Length     Length of the message from external program i.e unix
         Message     Log message from external program i.e unix
    Export Parameters Name and Description     Field name     Field function
    Status Contains the status of execution of external program            Scheduling status of external program i.e unix
    Once the above FM is invoked with the necessary parameters the unix program sendmail will send a mail to the inbox of the recipient in Microsoft.
    The restriction on the parameter string length of 128 characters can be removed to make way for very long email addresses and subjects. Build the parameters into an internal table and download it as a file on the unix server. Instead of passing each parameter individually, pass the unix server path of this file as the parameter to the unix shell script (sndmail mentioned above). Modify the shell script to read every line of this parameter file as variables to be used in the shell script.
    In the next article we will see an example of the ABAP code you can use to send SAP Mails.
    REPORT ZTSAPMAIL.
    DATA: X_OBJECT_TYPE LIKE SOOD-OBJTP.
    DATA: BEGIN OF X_OBJECT_HD_CHANGE.
    INCLUDE STRUCTURE SOOD1.
    DATA: END OF X_OBJECT_HD_CHANGE.
    DATA: BEGIN OF X_OBJCONT OCCURS 10.
    INCLUDE STRUCTURE SOLI.
    DATA: END OF X_OBJCONT.
    DATA: BEGIN OF X_OBJHEAD OCCURS 0.
    INCLUDE STRUCTURE SOLI.
    DATA: END OF X_OBJHEAD.
    DATA: BEGIN OF RAW_HEAD.
    INCLUDE STRUCTURE SORH.
    DATA: END OF RAW_HEAD.
    DATA: BEGIN OF X_RECEIVERS OCCURS 0.
    INCLUDE STRUCTURE SOOS1.
    DATA: END OF X_RECEIVERS.
    PARAMETERS: RECEIVER LIKE X_RECEIVERS-RECNAM. " Name
    *BUILD MESSAGE HEADER
    MOVE 'Sort field goes here' TO X_OBJECT_HD_CHANGE-OBJSRT. " Sort field
    MOVE 'Name of the object goes here' TO X_OBJECT_HD_CHANGE-OBJNAM. " Name
    MOVE 'Document title goes here' TO X_OBJECT_HD_CHANGE-OBJDES. " Title
    MOVE 'F' TO X_OBJECT_HD_CHANGE-OBJSNS. " Functional OBJECT
    MOVE 'E' TO X_OBJECT_HD_CHANGE-OBJLA. " Language
    Object type of the new document
    MOVE 'RAW' TO X_OBJECT_TYPE.
    CLEAR X_OBJCONT.
    MOVE 'Contents of mail' TO X_OBJCONT-LINE.
    APPEND X_OBJCONT.
    CLEAR X_OBJCONT-LINE. APPEND X_OBJCONT.
    MOVE 'More contents' TO X_OBJCONT-LINE.
    APPEND X_OBJCONT.
    MOVE 'Still more contents'
    to x_objcont-line.
    APPEND X_OBJCONT.
    MOVE ' ' TO X_OBJCONT-LINE.
    APPEND X_OBJCONT.
    Specific header (Dependent on the object type, here RAW)
    REFRESH X_OBJHEAD.
    DESCRIBE TABLE X_OBJCONT LINES RAW_HEAD-RAWSIZ.
    MOVE RAW_HEAD TO X_OBJHEAD.
    APPEND X_OBJHEAD.
    *RECEIVERS table
    CLEAR X_RECEIVERS.
    REFRESH X_RECEIVERS.
    MOVE RECEIVER TO X_RECEIVERS-RECNAM. " Name
    MOVE 'B' TO X_RECEIVERS-RECESC. " Receiver type
    MOVE 'X' TO X_RECEIVERS-SNDCP. " Send as a copy
    MOVE 'X' TO X_RECEIVERS-SNDEX. " EXPRESS DOCUMENT
    APPEND X_RECEIVERS.
    CALL FUNCTION 'SO_OBJECT_SEND'
    EXPORTING
    folder_id = 'OUTBOX'
    forwarder = x_forwarder
    object_fl_change = x_object_fl_change
    OBJECT_HD_CHANGE = X_OBJECT_HD_CHANGE
    object_id = x_object_id
    OBJECT_TYPE = X_OBJECT_TYPE
    OUTBOX_FLAG = 'X'
    OWNER = SY-UNAME
    store_flag = x_store_flag
    importing
    object_id_new = x_object_id_new
    sent_to_all = x_sent_to_all "May need to use
    TABLES
    OBJCONT = X_OBJCONT
    OBJHEAD = X_OBJHEAD
    objpara = x_objpara
    objparb = x_objparb
    RECEIVERS = X_RECEIVERS.
    REPORT ZTUNIXMAIL.
    DATA : TO_ADDRESS LIKE SY_LISEL,
    FROM_ADDRESS LIKE SY-LISEL,
    SUBJECT LIKE SY-LISEL,
    ATTACHMENT_NAME LIKE SY_LISEL,
    DATA_FILE_PATH LIKE SXPGCOLIST-PARAMETERS,
    BODY_FILE_PATH LIKE SXPGCOLIST-PARAMETERS.
    DATA : BEGIN OF INT_EMAIL_ATTACH OCCURS 0,
    TXTLINE CHAR(255),
    END OF INT_EMAIL_ATTACH.
    DATA : BEGIN OF INT_EMAIL_BODY OCCURS 0,
    TXTLINE CHAR(255),
    END OF INT_EMAIL_BODY.
    CLEAR : INT_EXEC_PROTOCOL,INT_EMAIL_ATTACH,INT_EMAIL_BODY.
    REFRESH : INT_EXEC_PROTOCOL,INT_EMAIL_ATTACH,INT_EMAIL_BODY.
    INT_EMAIL_ATTACH-TXTLINE = 'Put all attachment text in this table'.
    APPEND INT_EMAIL_ATTACH. CLEAR INT_EMAIL_ATTACH.
    INT_EMAIL_BODY-TXTLINE = 'Put all attachment text in this table'.
    APPEND INT_EMAIL_BODY. CLEAR INT_EMAIL_BODY.
    CONCATENATE TO_ADDRESS
    FROM_ADDRESS
    SUBJECT
    BODY_FILE_PATH
    DATA_FILE_PATH
    ATTACHMENT_NAME
    INTO V_PARAMETERS.
    IF NOT INT_EMAIL_ATTACH[] IS INITIAL.
    OPEN DATASET DATA_FILE_PATH FOR OUTPUT IN TEXT MODE.
    LOOP AT INT_EMAIL_ATTACH.
    TRANSFER INT_EMAIL_ATTACH-TXTLINE TO DATA_FILE_PATH.
    ENDLOOP.
    CLOSE DATASET DATA_FILE_PATH.
    ENDIF.
    IF NOT INT_EMAIL_BODY[] IS INITIAL.
    OPEN DATASET BODY_FILE_PATH FOR OUTPUT IN TEXT MODE.
    LOOP AT INT_EMAIL_BODY.
    TRANSFER INT_EMAIL_BODY-TXTLINE TO BODY_FILE_PATH.
    ENDLOOP.
    CLOSE DATASET BODY_FILE_PATH.
    ENDIF.
    CALL FUNCTION 'SXPG_CALL_SYSTEM'
    EXPORTING
    COMMANDNAME = 'Z_EMAIL' - Command calling unix script
    PARAMETERS = V_PARAMETERS
    importing
    status = ''
    TABLES
    EXEC_PROTOCOL = INT_EXEC_PROTOCOL
    EXCEPTIONS
    NO_PERMISSION = 1
    COMMAND_NOT_FOUND = 2
    PARAMETERS_TOO_LONG = 3
    SECURITY_RISK = 4
    WRONG_CHECK_CALL_INTERFACE = 5
    PROGRAM_START_ERROR = 6
    PROGRAM_TERMINATION_ERROR = 7
    X_ERROR = 8
    PARAMETER_EXPECTED = 9
    TOO_MANY_PARAMETERS = 10
    ILLEGAL_COMMAND = 11
    OTHERS = 12.
    regards,
    srinivas
    <b>*Reward points for useful answers*</b>

  • To add a process name in ABAP code

    hi experts,
    I have a requirement where my code is sending only  "unsuccessfull" message on a process failure.
    Now i need to add a name also in the mail. I m using a ABAP code to send the mail.
    Can u suGgest a way to do so?
    thanks.

    Hi,
    You can use the ABAP program an dgive multiple name..see the article.
    http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/4096bf2d-bcea-2b10-4ab4-e0683830d9b2&overridelayout=true
    REPORT  ztest_fm_mail.
    DATA : is_doc_chng        TYPE sodocchgi1,
           it_objtxt          TYPE STANDARD TABLE OF solisti1,
           is_objtxt          TYPE solisti1,
           it_objpack         TYPE STANDARD TABLE OF sopcklsti1,
           is_objpack         TYPE sopcklsti1,
           it_objbin          TYPE STANDARD TABLE OF solisti1,
           is_objbin          TYPE solisti1,
           it_reclist         TYPE STANDARD TABLE OF somlreci1,
           is_reclist         TYPE somlreci1,
           w_lines_tx         TYPE i.
    ** Create Message Body
    **   Title and Description
    *is_doc_chng-obj_name  = 'MAIL'.
    is_doc_chng-obj_descr = 'Auto genareted Mail from BW'.
    ** main text
    is_objtxt-line = 'This is an automatically generated mail. Please do not reply  to it.'(028).
    APPEND is_objtxt TO it_objtxt.
    is_objtxt-line = space.
    APPEND is_objtxt TO it_objtxt.
    *   write packing list (main)
    DESCRIBE TABLE it_objtxt LINES w_lines_tx.
    READ     TABLE it_objtxt INTO is_objtxt INDEX w_lines_tx.
    is_doc_chng-doc_size = ( w_lines_tx - 1 ) * 255 + STRLEN( is_objtxt ).
    CLEAR is_objpack-transf_bin.
    is_objpack-head_start = 1.
    is_objpack-head_num   = 0.
    is_objpack-body_start = 1.
    is_objpack-body_num   = w_lines_tx.
    is_objpack-doc_type   = 'RAW'.
    APPEND is_objpack TO it_objpack.
    is_reclist-receiver = 'SURENDRA.REDDY at ABC.IN'.  " here you need to add mail ids.
    is_reclist-rec_type = 'U'.
    APPEND is_reclist TO it_reclist.
    CLEAR is_reclist.
    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
      EXPORTING
        document_data              = is_doc_chng
        put_in_outbox              = 'X'
        commit_work                = 'X'
      TABLES
        packing_list               = it_objpack
        contents_txt               = it_objtxt
        receivers                  = it_reclist
      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 <> 0.
      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
              WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    Thanks
    Reddy

  • Send SMS via web

    I am trying to make a java code that sends SMS using a website that offers free SMS http://www.starhub.com.sg/starfun/index.asp
    my code is as following:-
    import java.net.*;
    import java.io.*;
    import java.util.*;
    public class printMIMEHeader {
    public static void main(String args[]) {
    URL u;
    URLConnection uc;
    String header;
    try {
    u = new URL("http://www.starhub.com.sg/starfun/index.asp");
    uc = u.openConnection();
    for (int j = 1; ; j++) {
    header = uc.getHeaderField(j);
    if (header == null) {
    break;
    System.out.println(uc.getHeaderFieldKey(j) + " " + header);
    } // end for
    String setCookie = uc.getHeaderField("Set-Cookie");
    System.out.println(" " + setCookie);
    int index = setCookie.indexOf(";");
    if (index >= 0) {
    setCookie = setCookie.substring(0, index);
    System.out.println(" " + setCookie);
    u = new URL("http://www.starhub.com.sg/servlet/SMSServlet");
    uc = u.openConnection();
    uc.setRequestProperty("Cookie", setCookie);
    uc.setRequestProperty("referer","/d3fault.asp");
    uc.setRequestProperty("mobile", "91910069");
    uc.setRequestProperty("msg", "hi");
    uc.setRequestProperty("SendSMS","Send SMS");
    BufferedReader in = new BufferedReader(new InputStreamReader(uc.
    getInputStream()));
    int c;
    while ( (c = in.read()) != -1) {
    System.out.print( (char) c);
    in.close();
    } // end try
    catch (MalformedURLException e) {
    System.err.println("This is not a URL I understand." + e);
    catch (IOException e) {
    System.err.println(e);
    //} // end for
    } // end main
    } // end printMIMEHeader
    I am getting the following exception:-
    This is not a URL I understand.java.net.MalformedURLException: no protocol: nullPlea
    se%20sent%20your%20sms%20thru'%20our%20website.
    well it is quite clear that this website is not allowing to POST request thru java code and forces us to visit their website. I just want to know if there is some work around for this problem.
    ne help is appreciatedm, thanx in advance.
    cheers,
    deb

    Heres what i found from sum previous forums for ur reference
    http://forum.java.sun.com/thread.jsp?forum=29&thread=33055
    For Sending SMS through Java Program, u can refer to an open source website (SMS Gateway) such as:
    http://kannel.org
    Currently there is no service provider which lets u send SMS free of cost. If u r really inclined on sending SMS then u can visit site:
    http://www.simplewire.com
    (But I think they have also made it as paid service atleast for India users)
    You have to first register in this site. After registration it will give you subscriber_id & password. Download the API for sending SMS and put the jar files in classpath.
    I am also attaching a small program which sends SMS for your reference:
    import com.simplewire.sms.*;
    public class send_text
    public static void main(String[] args) throws Exception
    SMS sms = new SMS();
    // Subscriber Settings
    sms.setSubscriberID("225-745-372-63009");//"123-456-789-12345");
    sms.setSubscriberPassword("C96B0472");//"Password Goes Here");
    // Message Settings
    sms.setMsgPin("+915623738280");//"+1 100 510 1234");
    sms.setMsgFrom("Paritosh");
    sms.setMsgCallback("+917623736528");
    sms.setMsgText("Hi ....how r u ?");
    System.out.println("Sending message to Simplewire...");
    // Send Message
    sms.msgSend();
    // Check For Errors
    if(sms.isSuccess()){
    System.out.println("Message was sent!");
    else {
    System.out.println("Message was not sent!");
    System.out.println("Error Code: " + sms.getErrorCode());
    System.out.println("Error Description: " + sms.getErrorDesc());
    System.out.println("Error Resolution: " + sms.getErrorResolution() +
    "\n");
    Hope this helps
    Rohan

  • How will you send sms

    Please send me the code for sending sms to mobile phones

    please search with google or anything else and you will find lots of code...

  • Why "send sms" not work in flash lite3 ???

    hello
    i write this code for send sms in device :
    on(release) {
    if(_capSMS)
    getURL("sms:" add myNumber add "?body=" add myText);
    it work fine in flash lite1.1 & 2.x
    but not work in flash lite 3 !!!!!
    what shall i do ? please help me
    can i make the command geturl to work on flashlite 3?
    or how can i open an url from flash lite 3?
    please help me

    Hi,
    It appears that the problem is with the security sandbox. To
    be able to send an SMS, it looks like you have to publish for Flash
    Lite 3, and in the Publish Settings, set 'Local playback security'
    to 'Access network only'. I used the following code:
    on (release) {
    if (System.capabilities.hasSMS) {
    getURL("sms:" + myNumber + "?body=" + myText);
    And it would only work when the publish settings were set as
    above. This was testing on a Nokia E65 with the developer edition
    of FL3 installed.
    Hope this helps!
    Darren

  • How to send SMS by using ABAP program

    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

    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.****************/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 .

  • SMS from ABAP program to send error message

    Hi,
    I would like to know what are settings to be done in the system to send an SMS from ABAP program using FM 'SO_DOCUMENT_SEND_API1'.I was trying to send SMS using above FM but the error was "Cannot process message, no route from <userid> to <Mobile.no> ".
    Pls let me know the pre requisites to send an SMS using above FM.
    Regards,
    Nivas

    Hi,
    I have gone thru this blog but I want send SMS to US Mobile no.I checked other webservice but it supports only few cellular networks in US.
    any other alternate for this...
    anyway thanks for your reply
    Regards,
    Nivas

  • How can i make sender address as default in ABAP code

    hi gurus,
    am developed a abap program to send emails.
    working fine i want set sendar address as default ,presently am using the following code to set sender address .but below BCMESS userid should in Sap user list then only it should working,my question is i want to set default address irrespestive of sap user,like want to set sender as xyzzzzass
    how is this possible please provide related stuf please.
    data: sender        TYPE REF TO cl_sapuser_bcs,
    sy-uname = 'BCMESS'.
    sender = cl_sapuser_bcs=>create( sy-uname ).
    try.
        CALL METHOD send_request->set_sender
          EXPORTING
            i_sender = sender.
    CATCH CX_ADDRESS_BCS .
    endtry.

    Hi Venkat,
    If your requirement is to send e-mails from some dummy sender, do like below...
    DATA   sender        TYPE REF TO cl_cam_address_bcs.
          sender = cl_cam_address_bcs=>create_internet_address( 'sender-at-defaults.com' ).
          send_request->set_sender( sender ).
    ~Jose.
    Edited by: Jose on Mar 4, 2009 7:46 AM
    Edited by: Jose on Mar 4, 2009 7:47 AM

  • Uncaught Exception occured while sending mail through abap code.

    Hi,
    Uncaught Exception occured while sending mail through abap code.Run time Errors "UNCAUGHT_EXCEPTION" occured after excuting the call method  CALL METHOD SEND_REQUEST->SEND( ).kindly help in resolving the issue.

    HI,
    Runtime Error:  UNCAUGHT_EXCEPTION details.
    Runtime Errors         UNCAUGHT_EXCEPTION
    Exception              CX_ADDRESS_BCS
    Short text
         An exception occurred that was not caught.
    What happened?
         The exception 'CX_ADDRESS_BCS' was raised, but it was not caught anywhere along
         the call hierarchy.
         Since exceptions represent error situations and this error was not
         adequately responded to, the running ABAP program 'SAPLZSEND_MAIL' has to be
         terminated.
    Error analysis
        An exception occurred that is explained in detail below.
        The exception, which is assigned to class 'CX_ADDRESS_BCS', was not caught in
        procedure "SEND_MAIL" "(FORM)", nor was it propagated by a RAISING clause.
        Since the caller of the procedure could not have anticipated that the
        exception would occur, the current program is terminated.
        The reason for the exception is:
        An exception occurred
    How to correct the error
        If the error occures in a non-modified SAP program, you may be able to
        find an interim solution in an SAP Note.
        If you have access to SAP Notes, carry out a search with the following
        keywords:
        "UNCAUGHT_EXCEPTION" "CX_ADDRESS_BCS"
        "SAPLZSEND_MAIL" or "LZSEND_MAILU01"
        "ZSEND_EMAIL"
        If you cannot solve the problem yourself and want to send an error
        notification to SAP, include the following information:
        1. The description of the current problem (short dump)
           To save the description, choose "System->List->Save->Local File
        (Unconverted)".
        2. Corresponding system log
           Display the system log by calling transaction SM21.
           Restrict the time interval to 10 minutes before and five minutes
        after the short dump. Then choose "System->List->Save->Local File
        (Unconverted)".
        3. If the problem occurs in a problem of your own or a modified SAP
        program: The source code of the program
           In the editor, choose "Utilities->More
        Utilities->Upload/Download->Download".
    4. Details about the conditions under which the error occurred or which
    actions and input led to the error.
    The exception must either be prevented, caught within proedure
    "SEND_MAIL" "(FORM)", or its possible occurrence must be declared in the
    RAISING clause of the procedure.
    Please help me to resolve this issue.

  • I am trying to send SMS text via iPad Air and cannot. I have gone into my iPhone and "forward message to iPad". However I am prompted to enter "code shown on iPad"... What code and where do I find that on iPad??

    I am trying to send SMS text via iPad Air and cannot. I have gone into my iPhone and "forward message to iPad". However I am prompted to enter "code shown on iPad"... What code and where do I find that on iPad??

    The home screen is the screen that shows all of your app icons. You can have one home screen or up to 11 home screens depending on how many apps you have. The home screen on an iPad is the equivalent of the desktop screen on a computer. If you are using an app, just tap the home button once to return to a home screen.
    This is is a (my) home screen.
    You you might want to double check the instructions here.
    Connect your iPhone, iPad, iPod touch, and Mac using Continuity - Apple Support
    Make make sure that you are signed into your iCloud account in Settings>iCloud and make sure that you have selected your Apple ID email address as well in Settings>Messages>Send & Receive at>You can be reached by iMessages at.

Maybe you are looking for

  • Apple Mouse Magic with Windows Vista

    Hello! My computer is Windows Vista 32 bits. I have bluetooth mouse "Apple Mouse Magic", I got to work on Windows Vista I installed the drivers, but every time I reboot or re-enter Windows does not recognize me, and I have to link each time the mouse

  • IMac as monitor for MBA

    I have a mid 2012 MBA and and early 2009 iMac. Is it possible to connect the iMac (it does not have Thunderbolt) as a display for the MBA?  I know that I can hook an external VGA monitor to the MBA (am actually using an old 15") but would like to tak

  • My mail will not open on my new MacBook.

    I first had an mail account on my mac G5 for three years, and mail never fails. Now, I have a MacBook also, and I set up the mail to sync between the two computers. It was fine for a few weeks. Now I can't open mail on the MacBook. The Imac is fine -

  • Lumia 822

    i put a sd card from my droid into my lumia the pics and video load but i can not find the files that are on the card. when i plug the phone to a pc everything on the card shows up what am i doing wrong Solved! Go to Solution.

  • How do I get rid of 'add photo' link on published photo album?

    I don't see it on my iWeb file but it shows on my published website on the photo album page: a link that says: + Add photo Any idea on how to remove that? Thanks!!