FM to SEND an email to SAP USER

Hi Gurus,
Pls let me know the FM if any to send a email to SAP USER (eg. DANYGG) so that it will go to SAP INBOX of the user in T.code So01.
Promise to reward.
Regards
Mac

hi,
check with this code, and reward if u find useful..
Table Declarations
TABLES: SOLI.
Data Declarations
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
PARAMETERS: SAPID RADIOBUTTON GROUP ADDR,
EMAIL_ID RADIOBUTTON GROUP ADDR.
SELECTION-SCREEN END OF BLOCK B1.
SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-002.
SELECT-OPTIONS: ID FOR SOLI-LINE NO INTERVALS.
SELECT-OPTIONS: CC FOR SOLI-LINE NO INTERVALS.
SELECT-OPTIONS: BCC FOR SOLI-LINE NO INTERVALS.
*PARAMETERS: SENDER LIKE SOUD-USRNAM.
SELECTION-SCREEN END OF BLOCK B2.
SELECTION-SCREEN BEGIN OF BLOCK B3 WITH FRAME TITLE TEXT-009.
PARAMETERS: SUB_LINE(60) TYPE C.
SELECTION-SCREEN END OF BLOCK B3.
SELECTION-SCREEN BEGIN OF BLOCK B4 WITH FRAME TITLE TEXT-008.
SELECT-OPTIONS: TEXT1 FOR SOLI-LINE NO INTERVALS.
SELECTION-SCREEN END OF BLOCK B4.
SELECTION-SCREEN BEGIN OF BLOCK B5 WITH FRAME TITLE TEXT-009.
SELECTION-SCREEN BEGIN OF LINE.
parameters: P_ATTACH as checkbox.
selection-screen comment 3(30) text-010.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK B5.
DATA: MAIL_CONTENT LIKE SOLI OCCURS 0 WITH HEADER LINE,
SUBJECT_LINE LIKE SOOD1-OBJDES.
Start of program processing
START-OF-SELECTION.
Get the Body of the Message from the selection screen or from
calling program
LOOP AT TEXT1.
MOVE TEXT1-LOW TO MAIL_CONTENT-LINE.
APPEND MAIL_CONTENT.
ENDLOOP.
Subject of the Message
MOVE SUB_LINE TO SUBJECT_LINE.
call a routine to send the workflow message
PERFORM SEND_EMAIL
TABLES MAIL_CONTENT
USING SUBJECT_LINE.
*& Form SEND_EMAIL
Send Workflow message
FORM SEND_EMAIL TABLES OBJCONT STRUCTURE MAIL_CONTENT
USING TITLE LIKE SOOD-OBJDES.
DATA: RECEIVERS LIKE SOOS1 OCCURS 0 WITH HEADER LINE,
TSOOD1 LIKE SOOD1,
PACKING_LIST LIKE SOXPL OCCURS 0 WITH HEADER LINE,
OBJCONT1 LIKE MAIL_CONTENT OCCURS 0 WITH HEADER LINE.
DATA: BEGIN OF AT_HEADER OCCURS 1.
INCLUDE STRUCTURE SOLI.
DATA: END OF AT_HEADER.
CLEAR: TSOOD1,
RECEIVERS.
REFRESH RECEIVERS.
MOVE: SY-LANGU TO TSOOD1-OBJLA,
'Email Notice' TO TSOOD1-OBJNAM,
'C' TO TSOOD1-OBJSNS,
TITLE TO TSOOD1-OBJDES.
'SCHIAVONIR' TO TSOOD1-OWNNAM.
loop through each ID and move them to recipient table
LOOP AT ID.
TRANSLATE ID-LOW TO UPPER CASE.
IF SAPID = 'X'.
MOVE: SY-DATUM TO RECEIVERS-RCDAT,
SY-UZEIT TO RECEIVERS-RCTIM,
' ' TO RECEIVERS-RECESC,
ID-LOW TO RECEIVERS-RECNAM,
'X' TO RECEIVERS-SNDEX.
ELSE.
MOVE: SY-DATUM TO RECEIVERS-RCDAT,
SY-UZEIT TO RECEIVERS-RCTIM,
'U' TO RECEIVERS-RECESC,
'U-' TO RECEIVERS-RECNAM,
ID-LOW TO RECEIVERS-RECEXTNAM.
ENDIF.
APPEND RECEIVERS.
CLEAR RECEIVERS.
ENDLOOP.
loop through each CC and move them to recipient table
LOOP AT CC.
TRANSLATE CC-LOW TO UPPER CASE.
IF SAPID = 'X'.
MOVE: SY-DATUM TO RECEIVERS-RCDAT,
SY-UZEIT TO RECEIVERS-RCTIM,
' ' TO RECEIVERS-RECESC,
CC-LOW TO RECEIVERS-RECNAM,
'X' TO RECEIVERS-SNDEX,
'X' TO RECEIVERS-SNDCP.
ELSE.
MOVE: SY-DATUM TO RECEIVERS-RCDAT,
SY-UZEIT TO RECEIVERS-RCTIM,
'U' TO RECEIVERS-RECESC,
'U-' TO RECEIVERS-RECNAM,
CC-LOW TO RECEIVERS-RECEXTNAM,
'X' TO RECEIVERS-SNDCP.
ENDIF.
APPEND RECEIVERS.
CLEAR RECEIVERS.
ENDLOOP.
loop through each BCC and move them to recipient table
LOOP AT BCC.
TRANSLATE BCC-LOW TO UPPER CASE.
IF SAPID = 'X'.
MOVE: SY-DATUM TO RECEIVERS-RCDAT,
SY-UZEIT TO RECEIVERS-RCTIM,
' ' TO RECEIVERS-RECESC,
BCC-LOW TO RECEIVERS-RECNAM,
'X' TO RECEIVERS-SNDEX,
'X' TO RECEIVERS-SNDBC.
ELSE.
MOVE: SY-DATUM TO RECEIVERS-RCDAT,
SY-UZEIT TO RECEIVERS-RCTIM,
'U' TO RECEIVERS-RECESC,
'U-' TO RECEIVERS-RECNAM,
BCC-LOW TO RECEIVERS-RECEXTNAM,
'X' TO RECEIVERS-SNDBC.
ENDIF.
APPEND RECEIVERS.
CLEAR RECEIVERS.
ENDLOOP.
AT_HEADER = SY-DATUM.
APPEND AT_HEADER.
AT_HEADER = SY-UZEIT.
APPEND AT_HEADER.
IF SENDER EQ SPACE.
SENDER = SY-UNAME.
ENDIF.
IF P_ATTACH EQ 'X'.
PACKING_LIST-HEAD_START = 1.
PACKING_LIST-HEAD_NUM = 2.
PACKING_LIST-BODY_START = 1.
PACKING_LIST-BODY_NUM = 9999.
PACKING_LIST-FILE_EXT = 'TXT'.
APPEND PACKING_LIST.
CLEAR PACKING_LIST.
APPEND LINES OF OBJCONT TO OBJCONT1.
REFRESH OBJCONT.
ENDIF.
CALL FUNCTION 'SO_OBJECT_SEND'
EXPORTING
OBJECT_HD_CHANGE = TSOOD1
OBJECT_TYPE = 'RAW'
TABLES
OBJCONT = OBJCONT
RECEIVERS = RECEIVERS
ATT_HEAD = AT_HEADER
ATT_CONT = OBJCONT1
PACKING_LIST = PACKING_LIST
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.
ENDFORM. " SEND_EMAIL
regards
dinesh

Similar Messages

  • Hi.....I want to send outbond email from SAP ERP to Gmail useing SBWP Tcode

    I want to send outbond email from  SAP ERP to Gmail  useing SBWP transaction , for that i want standered BADI or BAPI or RFC to send an outbond mail.i want to send a email from sbwp t-code in that t-code we have title text box and body text box and receipent  and receipent type,after entering alll those values i want trigger my badi /bapi/rfc and also that mail goes to receipent Gmail indox and also sap user outbox in sbwp t-code
    Moderator message: Welcome to SCN!
    Moderator message: this is considered "spec dumping", please work yourself first on your requirement.
    [Rules of engagement|http://wiki.sdn.sap.com/wiki/display/HOME/RulesofEngagement]
    [Asking Good Questions in the Forums to get Good Answers|/people/rob.burbank/blog/2010/05/12/asking-good-questions-in-the-forums-to-get-good-answers]
    Edited by: Thomas Zloch on Jul 13, 2011 9:25 AM

    Check note 455140 - Configuration of e-mail, fax, paging or SMS using SMTP
    Markus

  • How to send multipal attachment to SAP User

    Hello Friends,
    Is there any funcation module to send multipal attachment to sap user
    if u hav any idea plz reply me
    thank you in adv.
    regd.
    Kaustubh

    Hello,
    Check this sample.
    report zrich_0003.
    data: itcpo like itcpo,
          tab_lines like sy-tabix.
    Variables for EMAIL functionality
    data: maildata   like sodocchgi1.
    data: mailpack   like sopcklsti1 occurs 2 with header line.
    data: mailhead   like solisti1 occurs 1 with header line.
    data: mailbin    like solisti1 occurs 10 with header line.
    data: mailtxt    like solisti1 occurs 10 with header line.
    data: mailrec    like somlrec90 occurs 0  with header line.
    data: solisti1   like solisti1 occurs 0 with header line.
    perform send_form_via_email.
          FORM  SEND_FORM_VIA_EMAIL                                      *
    form  send_form_via_email.
      clear:    maildata, mailtxt, mailbin, mailpack, mailhead, mailrec.
      refresh:  mailtxt, mailbin, mailpack, mailhead, mailrec.
    Creation of the document to be sent File Name
      maildata-obj_name = 'TEST'.
    Mail Subject
      maildata-obj_descr = 'Subject'.
    Mail Contents
      mailtxt-line = 'Here is your file'.
      append mailtxt.
    Prepare Packing List
      perform prepare_packing_list.
    Set recipient - email address here!!!
      mailrec-receiver = [email protected]'.
      mailrec-rec_type  = 'U'.
      append mailrec.
    Sending the document
      call function 'SO_NEW_DOCUMENT_ATT_SEND_API1'
           exporting
                document_data              = maildata
                put_in_outbox              = ' '
           tables
                packing_list               = mailpack
                object_header              = mailhead
                contents_bin               = mailbin
                contents_txt               = mailtxt
                receivers                  = mailrec
           exceptions
                too_many_receivers         = 1
                document_not_sent          = 2
                operation_no_authorization = 4
                others                     = 99.
    endform.
         Form  PREPARE_PACKING_LIST
    form prepare_packing_list.
      clear:    mailpack, mailbin, mailhead.
      refresh:  mailpack, mailbin, mailhead.
      describe table mailtxt lines tab_lines.
      read table mailtxt index tab_lines.
      maildata-doc_size = ( tab_lines - 1 ) * 255 + strlen( mailtxt ).
    Creation of the entry for the compressed document
      clear mailpack-transf_bin.
      mailpack-head_start = 1.
      mailpack-head_num = 0.
      mailpack-body_start = 1.
      mailpack-body_num = tab_lines.
      mailpack-doc_type = 'RAW'.
      append mailpack.
      mailhead = 'TEST.TXT'.
      append mailhead.
    File 1
      mailbin = 'This is file 1'.
      append mailbin.
      describe table mailbin lines tab_lines.
      mailpack-transf_bin = 'X'.
      mailpack-head_start = 1.
      mailpack-head_num = 1.
      mailpack-body_start = 1.
      mailpack-body_num = tab_lines.
      mailpack-doc_type = 'TXT'.
      mailpack-obj_name = 'TEST1'.
      mailpack-obj_descr = 'Subject'.
      mailpack-doc_size = tab_lines * 255.
      append mailpack.
    *File 2
      mailbin = 'This is file 2'.
      append mailbin.
      data: start type i.
      data: end type i.
      start = tab_lines + 1.
      describe table mailbin lines end.
      mailpack-transf_bin = 'X'.
      mailpack-head_start = 1.
      mailpack-head_num = 1.
      mailpack-body_start = start.
      mailpack-body_num = end.
      mailpack-doc_type = 'TXT'.
      mailpack-obj_name = 'TEST2'.
      mailpack-obj_descr = 'Subject'.
      mailpack-doc_size = tab_lines * 255.
      append mailpack.
    endform.
    Cheers,
    Vasanth

  • Sending an email to the user if the WEBi scheduling failed in CMC

    Hello Everyone,
    Current scenario :
    I am scheduling WEBi report through CMC and the report is going to end user email as an excel attachment.
    Desired Functionality :
    What happens is if the scheduling fails due to some reason. The email does not go to the end user on a particular date and then he complaints.
    What i need here an email sending option that if the WEBi scheduling has been failed in CMC an email should go to the user saying : " The WEBi scheduling has failed. The team is working on it " . (This is just a sample message)
    So the idea is to send an email to the user when the WEBi scheduling fails in the CMC. How to achieve this ?
    Regards,
    Ashutosh Singh

    Hi Ashutosh,
    You can send an alert email to a group when the schedule fails to run by choosing the "A job has failed to run" option under notification.
    You can see this option only if you schedule the report through CMC.
    Regards
    Sunil

  • How to send one email to multi-users using JavaMail ?

    I am using JavaMail API. I am working in "sending emails to users", I had already tested "one email to one user" and got success but when tried to send one email to multi-users then I failed to do that?
    Can anyone help me to do this?
    I have used the below code to send to multi-user:
    Address[] toAddr = {new InternetAddress(_to),new InternetAddress (to2)};
    msg.addRecipients(Message.RecipientType.TO, toAddr);
    But it is static only 2 users. I want to send to multi-users dynamically taking datas from database.
    I have tried by using below code but it doesn't work.....
    InternetAddress[] emails;
    while (resultset.next()) {
    temp = resultset.getString(1);
    emails.setAddress(temp);
    i++;
    Address[] toAddr = emails;
    msg.addRecipients(Message.RecipientType.TO, toAddr);
    Thank you in advance...
    -ritesh

    I think you're confused about some basic Java programming techniques.
    There are two obvious ways to do this.
    1. Call the addRecipient method in a loop.
    2. Collect all the recipients in a List, convert it to an array, and call addRecipients.

  • How to send an  email to external user (offline form) from se38

    Hi all
    how to send an  email to external user (offline form) from se38 and upload the same from recipent.
        we have sent mail using scripts and smartforms but couldnt do here. It will be helpful if you can give us any sample code
    regards
    mohammed

    Hi,
    Have a look at this thread [Re: Sending PDF forms (created using SFP) as Email Attachment]  i explain all the solution with a sample code .
    Hope it's help you
    regards

  • Funcation module to send attachment file to sap user

    hello Friends,
    I want to send an external file to sap user when report is run
    is ther any funcation module to send attachment file to sap user
    plz reply
    thanx in adv.
    Bhaskar

    Check these FMs,
    SO_NEW_DOCUMENT_ATT_SEND_API1
    SO_DOCUMENT_SEND_API1
    SO_WIND_ATTACHMENT_LIST_API1
    Thanks and Regards

  • Sending external email from SAP with following requirements...

    Hi All,
           I need to send external emails from SAP by meeting following requirements.
    1) With subject line more than 100 characters.
    2) No attachments, only body which has specific format (blueprint/layout) and would be amended often, hence code shouldn't be touched during amendments.
    3) Should be able to know the success/failure of mail sending at program level.

    Hi,
    The code below demonstrates how to send an email to an external email address
    *& Report  ZSENDEMAIL                                                  *
    *& Example of sending external email via SAPCONNECT                    *
    REPORT  zsendemail                    .
    PARAMETERS: psubject(40) type c default  'Hello',
                p_email(40)   type c default '[email protected]' .
    data:   it_packing_list like sopcklsti1 occurs 0 with header line,
            it_contents like solisti1 occurs 0 with header line,
            it_receivers like somlreci1 occurs 0 with header line,
            it_attachment like solisti1 occurs 0 with header line,
            gd_cnt type i,
            gd_sent_all(1) type c,
            gd_doc_data like sodocchgi1,
            gd_error type sy-subrc.
    data:   it_message type standard table of SOLISTI1 initial size 0
                    with header line.
    *START-OF-SELECTION.
    START-OF-SELECTION.
    Perform populate_message_table.
    *Send email message, although is not sent from SAP until mail send
    *program has been executed(rsconn01)
    PERFORM send_email_message.
    *Instructs mail send program for SAPCONNECT to send email(rsconn01)
    perform initiate_mail_execute_program.
    *&      Form  POPULATE_MESSAGE_TABLE
          Adds text to email text table
    form populate_message_table.
      Append 'Email line 1' to it_message.
      Append 'Email line 2' to it_message.
      Append 'Email line 3' to it_message.
      Append 'Email line 4' to it_message.
    endform.                    " POPULATE_MESSAGE_TABLE
    *&      Form  SEND_EMAIL_MESSAGE
          Send email message
    form send_email_message.
    Fill the document data.
      gd_doc_data-doc_size = 1.
    Populate the subject/generic message attributes
      gd_doc_data-obj_langu = sy-langu.
      gd_doc_data-obj_name  = 'SAPRPT'.
      gd_doc_data-obj_descr = psubject.
      gd_doc_data-sensitivty = 'F'.
    Describe the body of the message
      clear it_packing_list.
      refresh it_packing_list.
      it_packing_list-transf_bin = space.
      it_packing_list-head_start = 1.
      it_packing_list-head_num = 0.
      it_packing_list-body_start = 1.
      describe table it_message lines it_packing_list-body_num.
      it_packing_list-doc_type = 'RAW'.
      append it_packing_list.
    Add the recipients email address
      clear it_receivers.
      refresh it_receivers.
      it_receivers-receiver = p_email.
      it_receivers-rec_type = 'U'.
      it_receivers-com_type = 'INT'.
      it_receivers-notif_del = 'X'.
      it_receivers-notif_ndel = 'X'.
      append it_receivers.
    Call the FM to post the message to SAPMAIL
      call function 'SO_NEW_DOCUMENT_ATT_SEND_API1'
           exporting
                document_data              = gd_doc_data
                put_in_outbox              = 'X'
           importing
                sent_to_all                = gd_sent_all
           tables
                packing_list               = it_packing_list
                contents_txt               = it_message
                receivers                  = it_receivers
           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.
    Store function module return code
      gd_error = sy-subrc.
    Get it_receivers return code
      loop at it_receivers.
      endloop.
    endform.                    " SEND_EMAIL_MESSAGE
    *&      Form  INITIATE_MAIL_EXECUTE_PROGRAM
          Instructs mail send program for SAPCONNECT to send email.
    form initiate_mail_execute_program.
      wait up to 2 seconds.
      if gd_error eq 0.
          submit rsconn01 with mode = 'INT'
                        with output = 'X'
                        and return.
      endif.
    endform.                    " INITIATE_MAIL_EXECUTE_PROGRAM
    Hope this helps.
    Reward if helpful.
    Regards,
    Sipra

  • User is getting email delivery failure when processing via SAP as it tries to send an email to a user who have left the company

    Hi Experts,
    I need to remove a name on a group list in Outlook as the user is getting email delivery failure when processing via SAP (He sends the invoice for approval and emails get sent to different users for approval.) One of those users has left the company and so the user gets a email delivery failure error.
    How do I remove this user who is no longer with the company?
    The user is saying: When I approve an invoice in SAP it sends an email notification through outlook. One of those users is no longer with the company so it cannot deliver the notification, and in return send a delivery failure (in outlook). I am approving the invoices from my SAP Workplace inbox.
    How do we know what group the email is going to?
    Please let me know if you have seen this issue before. Greatly appreciate your help.
    Thanks,
    Asad

    Hi,
    Please check whether you are using a custom z program for sending emails of approved invoices to users. If yes then either the user email ids are hardcoded in the program else a ztable is maintained for them.

  • Send ALV output to SAP user unbox..

    Hi Friends..
    I want to send the ALV output to the SAP users inbox.
    So plz anyone give the sample code for that..
    With regards
    Gowrishankar

    Hi
    Check this sample report
    *& Report  ZTESTMAIL                                                   *
    REPORT  ZTESTMAIL                               .
    tables: ekko.
    parameters: p_email type somlreci1-receiver default
    '[email protected]'.
    types: begin of t_ekpo,
    ebeln type ekpo-ebeln,
    ebelp type ekpo-ebelp,
    aedat type ekpo-aedat,
    matnr type ekpo-matnr,
    end of t_ekpo.
    data: it_ekpo type standard table of t_ekpo initial size 0,
    wa_ekpo type t_ekpo.
    types: begin of t_charekpo,
    ebeln(10) type c,
    ebelp(5) type c,
    aedat(8) type c,
    matnr(18) type c,
    end of t_charekpo.
    data: wa_charekpo type t_charekpo.
    data: it_message type standard table of solisti1 initial size 0
    with header line.
    data: it_attach type standard table of solisti1 initial size 0
    with header line.
    data: t_packing_list like sopcklsti1 occurs 0 with header line,
    t_contents like solisti1 occurs 0 with header line,
    t_receivers like somlreci1 occurs 0 with header line,
    t_attachment like solisti1 occurs 0 with header line,
    t_object_header like solisti1 occurs 0 with header line,
    w_cnt type i,
    w_sent_all(1) type c,
    w_doc_data like sodocchgi1,
    gd_error type sy-subrc,
    gd_reciever type sy-subrc.
    t_object_header = 'Text.xls'. append t_object_header.
    *START_OF_SELECTION
    start-of-selection.
    * Retrieve sample data from table ekpo
    perform data_retrieval.
    * Populate table with detaisl to be entered into .xls file
    perform build_xls_data_table.
    *END-OF-SELECTION
    end-of-selection.
    * Populate message body text
    perform populate_email_message_body.
    * Send file by email as .xls speadsheet
    perform send_file_as_email_attachment
    tables it_message
    it_attach
    using p_email
    'Example .xls documnet attachment'
    'XLS'
    'filename'
    changing gd_error
    gd_reciever.
    * Instructs mail send program for SAPCONNECT to send email(rsconn01)
    perform initiate_mail_execute_program.
    *& Form DATA_RETRIEVAL
    * Retrieve data form EKPO table and populate itab it_ekko
    form data_retrieval.
    select ebeln ebelp aedat matnr
    up to 10 rows
    from ekpo
    into table it_ekpo.
    endform. " DATA_RETRIEVAL
    *& Form BUILD_XLS_DATA_TABLE
    * Build data table for .xls document
    form build_xls_data_table.
    *CONSTANTS: con_cret TYPE x VALUE '0D', "OK for non Unicode
    *con_tab TYPE x VALUE '09'. "OK for non Unicode
    *If you have Unicode check active in program attributes thnen you will
    *need to declare constants as follows
    *class cl_abap_char_utilities definition load.
    constants:
    con_tab type c value cl_abap_char_utilities=>horizontal_tab,
    con_cret type c value cl_abap_char_utilities=>cr_lf.
    concatenate 'EBELN' 'EBELP' 'AEDAT' 'MATNR'
    into it_attach separated by con_tab.
    concatenate con_cret it_attach into it_attach.
    append it_attach.
    loop at it_ekpo into wa_charekpo.
    concatenate wa_charekpo-ebeln wa_charekpo-ebelp
    wa_charekpo-aedat wa_charekpo-matnr
    into it_attach separated by con_tab.
    concatenate con_cret it_attach into it_attach.
    append it_attach.
    endloop.
    endform. " BUILD_XLS_DATA_TABLE
    *& Form SEND_FILE_AS_EMAIL_ATTACHMENT
    * Send email
    form send_file_as_email_attachment tables pit_message
    pit_attach
    using p_email
    p_mtitle
    p_format
    p_filename
    p_attdescription
    p_sender_address
    p_sender_addres_type
    changing p_error
    p_reciever.
    data: ld_error type sy-subrc,
    ld_reciever type sy-subrc,
    ld_mtitle like sodocchgi1-obj_descr,
    ld_email like somlreci1-receiver,
    ld_format type so_obj_tp ,
    ld_attdescription type so_obj_nam ,
    ld_attfilename type so_obj_des ,
    ld_sender_address like soextreci1-receiver,
    ld_sender_address_type like soextreci1-adr_typ,
    ld_receiver like sy-subrc.
    ld_email = p_email.
    ld_mtitle = p_mtitle.
    ld_format = p_format.
    ld_attdescription = p_attdescription.
    ld_attfilename = p_filename.
    ld_sender_address = p_sender_address.
    ld_sender_address_type = p_sender_addres_type.
    * Fill the document data.
    w_doc_data-doc_size = 1.
    * Populate the subject/generic message attributes
    w_doc_data-obj_langu = sy-langu.
    w_doc_data-obj_name = 'SAPRPT'.
    w_doc_data-obj_descr = ld_mtitle .
    w_doc_data-sensitivty = 'F'.
    * Fill the document data and get size of attachment
    clear w_doc_data.
    read table it_attach index w_cnt.
    w_doc_data-doc_size =
    ( w_cnt - 1 ) * 255 + strlen( it_attach ).
    w_doc_data-obj_langu = sy-langu.
    w_doc_data-obj_name = 'SAPRPT'.
    w_doc_data-obj_descr = ld_mtitle.
    w_doc_data-sensitivty = 'F'.
    clear t_attachment.
    refresh t_attachment.
    t_attachment[] = pit_attach[].
    * Describe the body of the message
    clear t_packing_list.
    refresh t_packing_list.
    t_packing_list-transf_bin = space.
    t_packing_list-head_start = 1.
    t_packing_list-head_num = 0.
    t_packing_list-body_start = 1.
    describe table it_message lines t_packing_list-body_num.
    t_packing_list-doc_type = 'RAW'.
    append t_packing_list.
    * Create attachment notification
    t_packing_list-transf_bin = 'X'.
    t_packing_list-head_start = 1.
    t_packing_list-head_num = 1.
    t_packing_list-body_start = 1.
    describe table t_attachment lines t_packing_list-body_num.
    t_packing_list-doc_type = ld_format.
    t_packing_list-obj_descr = ld_attdescription.
    t_packing_list-obj_name = ld_attfilename.
    t_packing_list-doc_size = t_packing_list-body_num * 255.
    append t_packing_list.
    * Add the recipients email address
    clear t_receivers.
    refresh t_receivers.
    t_receivers-receiver = ld_email.
    t_receivers-rec_type = 'U'.
    t_receivers-com_type = 'INT'.
    t_receivers-notif_del = 'X'.
    t_receivers-notif_ndel = 'X'.
    append t_receivers.
    call function 'SO_DOCUMENT_SEND_API1'
    exporting
    document_data = w_doc_data
    put_in_outbox = 'X'
    sender_address = ld_sender_address
    sender_address_type = ld_sender_address_type
    commit_work = 'X'
    importing
    sent_to_all = w_sent_all
    tables
    object_header = t_object_header
    packing_list = t_packing_list
    contents_bin = t_attachment
    contents_txt = it_message
    receivers = t_receivers
    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.
    * Populate zerror return code
    ld_error = sy-subrc.
    * Populate zreceiver return code
    loop at t_receivers.
    ld_receiver = t_receivers-retrn_code.
    endloop.
    endform.
    *& Form INITIATE_MAIL_EXECUTE_PROGRAM
    * Instructs mail send program for SAPCONNECT to send email.
    form initiate_mail_execute_program.
    wait up to 2 seconds.
    submit rsconn01 with mode = 'INT'
    with output = 'X'
    and return.
    endform. " INITIATE_MAIL_EXECUTE_PROGRAM
    *& Form POPULATE_EMAIL_MESSAGE_BODY
    * Populate message body text
    form populate_email_message_body.
    refresh it_message.
    it_message = 'Please find attached a list test ekpo records'.
    append it_message.
    endform. " POPULATE_EMAIL_MESSAGE_BODY
    *PARAMETERS: psubject(40) type c default 'Testing',
    *p_email(40) type c default '[email protected]'. "use ur email id
    *data: it_packing_list like sopcklsti1 occurs 0 with header line,
    *it_contents like solisti1 occurs 0 with header line,
    *it_receivers like somlreci1 occurs 0 with header line,
    *it_attachment like solisti1 occurs 0 with header line,
    *gd_cnt type i,
    *gd_sent_all(1) type c,
    *gd_doc_data like sodocchgi1,
    *gd_error type sy-subrc.
    *data: it_message type standard table of SOLISTI1 initial size 0
    *with header line.
    **START-OF-SELECTION.
    *START-OF-SELECTION.
    *Perform populate_message_table.
    **Send email message, although is not sent from SAP until mail send
    **program has been executed(rsconn01)
    *PERFORM send_email_message.
    **Instructs mail send program for SAPCONNECT to send email(rsconn01)
    *perform initiate_mail_execute_program.
    **& Form POPULATE_MESSAGE_TABLE
    ** Adds text to email text table
    *form populate_message_table.
    *Append 'Line1' to it_message.
    *Append 'Line2' to it_message.
    *Append 'Line3' to it_message.
    *Append 'Test- 1' to it_message.
    *endform. " POPULATE_MESSAGE_TABLE
    **& Form SEND_EMAIL_MESSAGE
    ** Send email message
    *form send_email_message.
    ** Fill the document data.
    *gd_doc_data-doc_size = 1.
    ** DATA: TAB_LINES LIKE sy-tabix.
    ** DESCRIBE TABLE it_message LINES TAB_LINES.
    ** READ TABLE it_message INDEX TAB_LINES.
    ** gd_doc_data-DOC_SIZE = ( TAB_LINES - 1 ) * 255 + STRLEN( it_message )
    ** Populate the subject/generic message attributes
    *gd_doc_data-obj_langu = sy-langu.
    *gd_doc_data-obj_name = 'SAPRPT'.
    *gd_doc_data-obj_descr = psubject.
    *gd_doc_data-sensitivty = 'F'.
    ** Describe the body of the message
    ** Information about structure of data tables
    *clear it_packing_list.
    *refresh it_packing_list.
    *it_packing_list-transf_bin = space.
    *it_packing_list-head_start = 1.
    *it_packing_list-head_num = 0.
    *it_packing_list-body_start = 1.
    *describe table it_message lines it_packing_list-body_num.
    *it_packing_list-doc_type = 'RAW'.
    *append it_packing_list.
    ** Add the recipients email address
    *clear it_receivers.
    *refresh it_receivers.
    *it_receivers-receiver = p_email.
    *it_receivers-rec_type = 'U'.
    ** it_receivers-com_type = 'INT'.
    ** it_receivers-notif_del = 'X'.
    ** it_receivers-notif_ndel = 'X'.
    *append it_receivers.
    ** Call the FM to post the message to SAPMAIL
    *call function 'SO_NEW_DOCUMENT_ATT_SEND_API1'
    *exporting
    *document_data = gd_doc_data
    *put_in_outbox = 'X'
    *importing
    *sent_to_all = gd_sent_all
    *tables
    *packing_list = it_packing_list
    *contents_txt = it_message
    *receivers = it_receivers
    *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.
    ** Store function module return code
    *gd_error = sy-subrc.
    ** Get it_receivers return code
    *loop at it_receivers.
    *endloop.
    *endform. " SEND_EMAIL_MESSAGE
    **& Form INITIATE_MAIL_EXECUTE_PROGRAM
    ** Instructs mail send program for SAPCONNECT to send email.
    *form initiate_mail_execute_program.
    *wait up to 2 seconds.
    *if gd_error eq 0.
    *submit rsconn01 with mode = 'INT'
    *with output = 'X'
    *and return.
    *endif.
    *endform. " INITIATE_MAIL_EXECUTE_PROGRAM
    Check this link
    ALV Output in PDF format
    Re: Send ALV Grid output as PDF attachment to external mail id?
    Reward all helpfull answers
    Regards
    Pavan
    Message was edited by:
            Pavan praveen

  • Po send via email in sap

    hello
    i am trying to configure the po send sap mail i did the sonfig but it is not working
    i created a new message type and with 5 pl. help me so that i can make it working
    do we need to take help of techical help
    regards

    Hi
    PO can be sent to using Outlook email or the Internal send within SAP.
    Please refer to the below SAP help and you can refer more SAP documentation at help.sap.com
    Message via E-Mail
    Use
    You can send purchasing documents to a vendor by e-mail.
    You can also send memos to an internal user from within the purchasing document, in which case the recipient can directly access the relevant document when processing the e-mail (executable mail).
    Prerequisites
    External Transmission
    Make the necessary Customizing settings
    The SAP system is configured for the transmission of external mails.
    The message determination facility has been set up in Customizing for Purchasing.
    You have defined a communication strategy in Customizing under Messages Output Control ® Message Types ® Define Message Types for : Send with note). Enter the useru2019s first and last names, for example, in the Recipient field.
    Executable mail
    If you wish to insert a transaction (because you want the recipient to view a purchase order, for example), choose Goto ® Execution parameters. Enter the necessary data, such as execution type (T = transaction), execution element (ME22N = Change Purchase Order), execution system, and the SET/GET parameters (BES for purchase order).
    Result
    If you have specified send immediately as the processing time-spot, the user will immediately receive a message or document when the purchase order is saved.
    The user can view the message sent to him or her via Office ® Work center ® Inbox.
    If the document in your inbox is an executable mail, you can click the right-hand mouse button and directly access the relevant purchase order, for example, via the menu thus displayed.

  • How to generate automatically email to SAP user and Non SAP User

    Dear Expert,
    My client want a report on each Monday on  sales/purchase detail of his/her particular  email ID which is automatically generated from SAP DB.
    Some are SAP user that we can do it by alert message but for some who are not SAP user how to send them a email ?
    Can we do in SAP B1 ?
    even i try with Outlook but I am not getting.
    *please give me answer in detail
    Thanks
    Kevin

    any update ?
    I have create a query and a common output is share to all user, is it possible to group the output and share to particular user ?
    Our client req. is particular sales man should get evry monday morning his outstanding amount from client ?
    My query give the entire all sales Outstanding and send to all user all detail....i want to filter A user should only get detail A outstanding ?
    Thanks
    Kevin

  • Send Welcome Email to New User using the Scripting Agent

    Hi
    I require some assistance please.  I have found a number of scripts online to send a Welcome Email to new users whereby they make use of the ScriptingAgent.xml file.
    I like the way the scripts have been configured and have mashed up one or two scripts together for my desired result however when testing in my lab (Exchange 2013) I have found tow problems.
    The problems are:
    1. When creating a new user and mailbox (New-Mailbox) via the ECP the script throws out an error which I will post later in this post. The mailbox is created fine but it does not send out a welcome email.  When a user is created in ADUC and then a mailbox
    is created (Enable-Mailbox) the welcome email is sent out correctly.
    2. In the script i have a section to check for NewUser00 in the HTML file and replace that with the Users Name and Surname, however this does not work correctly, I just come up blank:
    The Script:
    <?xml version="1.0" encoding="utf-8" ?>
    <Configuration version="1.0">
    <Feature Name="WelcomeEmail" Cmdlets="New-Mailbox,Enable-Mailbox">
    <ApiCall Name="OnComplete">
    if($succeeded) {
    # Waiting for synchronization after mailbox has been created.
    Set-ADServerSettings -ViewEntireForest $true
    Start-Sleep -s 10
    # New-Mailbox triggered. Taking SamAccountName parameter.
    if ($provisioningHandler.UserSpecifiedParameters.Contains("SamAccountName") -eq $true) {
    $UsrSamAccountName = $provisioningHandler.UserSpecifiedParameters["SamAccountName"]
    $USRdfirst = $provisioningHandler.UserSpecifiedParameters["FirstName"]
    $USRdlast = $provisioningHandler.UserSpecifiedParameters["LastName"]
    $UsrAlias = (Get-Mailbox -Filter {SamAccountName -eq $UsrSamAccountName}).Alias.ToString()
    $USRdname = $USRdfirst + " " + $USRdlast
    # Enable-Mailbox triggered. Taking Identity parameter, this is the only one avalaible in this case.
    if ($provisioningHandler.UserSpecifiedParameters.Contains("Identity") -eq $true) {
    $UsrIdentity = $provisioningHandler.UserSpecifiedParameters["Identity"].ToString()
    $USRdfirst=$provisioningHandler.UserSpecifiedParameters["FirstName"]
    $USRdlast=$provisioningHandler.UserSpecifiedParameters["LastName"]
    $UsrAlias = (Get-Mailbox -Identity $UsrIdentity).Alias.ToString()
    $USRdname= $USRdfirst + " " + $USRdlast
    # Defining variables.
    $UsrAddr = (Get-Mailbox -Filter {Alias -eq $UsrAlias}).PrimarySmtpAddress.ToString()
    $UsrOU = (Get-Mailbox -Filter {Alias -eq $UsrAlias}).OrganizationalUnit
    # Sending email notification to the user in specific OU.
    if ($UsrOU -match "Contoso.com") {
    # HR #
    $fromHR="[email protected]"
    $SubjectHR="'Welcome to Contoso'"
    $BodyHR = [string] (get-content ("c:\welcome\WelcomeMSG.htm"))
    $BodyHR = $BodyHR -replace "NewUser00",$USRdname
    $fileHR = "c:\welcome\WelcomeMSG.htm"
    $smtp="192.168.x.x"
    Send-MailMessage -From $fromHR -To $UsrAddr -Subject $SubjectHR -Body $BodyHR -BodyAsHtml -Encoding ([System.Text.Encoding]::UTF8) -SmtpServer $Smtp
    # Clearing variables. Each one in its own line in order to prevent error messages from being shown on EMC.
    if ($UsrAlias) { Remove-Variable UsrAlias }
    if ($UsrAddr) { Remove-Variable UsrAddr }
    if ($UsrOU) { Remove-Variable UsrOU }
    if ($UsrMsg) { Remove-Variable UsrMsg }
    if ($UsrIdentity) { Remove-Variable UsrIdentity }
    if ($UsrSamAccountName) { Remove-Variable UsrSamAccountName }
    </ApiCall>
    </Feature>
    </Configuration>
    The Error for issue 1:
    The cmdlet extension agent with the index 5 has thrown an exception in OnComplete().
    The exception is: Microsoft.Exchange.Provisioning.ProvisioningException: ScriptingAgent:
    Exception thrown while invoking scriptlet for OnComplete API: You cannot call a method on a
    null-valued expression.. ---> System.Management.Automation.RuntimeException:
    You cannot call a method on a null-valued expression. at CallSite.Target(Closure , CallSite , Object ) at
    System.Dynamic.UpdateDelegates.UpdateAndExecute1[T0,TRet](CallSite site, T0 arg0) at
    System.Management.Automation.Interpreter.DynamicInstruction`2.Run(InterpretedFrame frame) at
    System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
    --- End of inner exception stack trace --- at Microsoft.Exchange.ProvisioningAgent.ScriptingAgentHandler.OnComplete(Boolean succeeded, Exception e)
    at Microsoft.Exchange.Provisioning.ProvisioningLayer.OnCompleteImpl(Task task, Boolean succeeded, Exception exception)
    Any assistance in resolving these two issues will be really appreciated

    Ok I am gonna to answer my own question.
    I have persevered through the day and have resolved my two issues.  I hope this assist others within the community.
    Script:
    <?xml version="1.0" encoding="utf-8" ?>
    <Configuration version="1.0">
    <Feature Name="WelcomeEmail" Cmdlets="New-Mailbox,Enable-Mailbox">
    <ApiCall Name="OnComplete">
    if($succeeded) {
    # Waiting for synchronization after mailbox has been created.
    Start-Sleep -s 30
    Set-ADServerSettings -ViewEntireForest $true
    # New-Mailbox triggered. Taking SamAccountName parameter.
    if ($provisioningHandler.UserSpecifiedParameters.Contains("Name") -eq $true) {
    $UsrSamAccountName = $provisioningHandler.UserSpecifiedParameters["Name"]
    $Usrname = (Get-Mailbox -identity $UsrSamAccountName | Select Name | foreach { $_.Name})
    $UsrString = $Usrname | Out-String
    $UsrAlias = (Get-Mailbox -Filter {Name -eq $UsrSamAccountName}).Alias.ToString()
    # Enable-Mailbox triggered. Taking Identity parameter, this is the only one avalaible in this case.
    if ($provisioningHandler.UserSpecifiedParameters.Contains("Identity") -eq $true) {
    $UsrIdentity = $provisioningHandler.UserSpecifiedParameters["Identity"].ToString()
    $Usrname = (Get-Mailbox -identity $UsrIdentity | Select Name | foreach { $_.Name})
    $UsrString = $Usrname | Out-String
    $UsrAlias = (Get-Mailbox -Identity $UsrIdentity).Alias.ToString()
    # Defining variables.
    $UsrAddr = (Get-Mailbox -Filter {Alias -eq $UsrAlias}).PrimarySmtpAddress.ToString()
    $UsrOU = (Get-Mailbox -Filter {Alias -eq $UsrAlias}).OrganizationalUnit
    # Sending email notification to the user in specific OU.
    if ($UsrOU -match "contoso.com") {
    # HR #
    $fromHR="[email protected]"
    $SubjectHR="'Welcome to CONTOSO'"
    $BodyHR = [string] (get-content ("c:\welcome\WelcomeMSG.htm"))
    $BodyHR = $BodyHR -replace "NewUser00",$UsrString
    $fileHR = "c:\welcome\WelcomeMSG.htm"
    $smtp="x.x.x.x"
    Send-MailMessage -From $fromHR -To $UsrAddr -Subject $SubjectHR -Body $BodyHR -BodyAsHtml -Encoding ([System.Text.Encoding]::UTF8) -SmtpServer $Smtp
    # Clearing variables. Each one in its own line in order to prevent error messages from being shown on EMC.
    if ($UsrAlias) { Remove-Variable UsrAlias }
    if ($UsrAddr) { Remove-Variable UsrAddr }
    if ($UsrOU) { Remove-Variable UsrOU }
    if ($UsrMsg) { Remove-Variable UsrMsg }
    if ($UsrIdentity) { Remove-Variable UsrIdentity }
    if ($UsrSamAccountName) { Remove-Variable UsrSamAccountName }
    </ApiCall>
    </Feature>
    </Configuration>

  • How to send HTML email to End User using OOTB email processs?

    Hi,
    We are using OOTB Send email process to send email to end user.
    Templates has been created inside /etc/workflow/ProjectName/email folder.
    Its working properly for plain text email.but for html template ,It send the email with html tags.
    Any pointer on how to write html template for OOTB email process and activate email type as html ?
    Thanks
    Deepika

    Thanks Sham..
    I am able to send HTML email following above link.
    The problem i am facing is,When i am deploying the code through crxde.Code is working fine.
    But using maven deploy..Bundle get activated ..But at line:
    messageGateway = this.messageGatewayService.getGateway(HtmlEmail.class);
    ,it gives null Pointer exception.
    Any pointer,why its not working from maven deployment.
    Regards
    Deepika

  • Send an email to all user in Oracle Test Manager for Web Applications

    I have administrator access to Oracle Test Manager for Web Applications. How can I send email to all user in the system (Oracle Test Manager for Web Applications)?
    Thanks
    Katherine
    Edited by: Katherine on 20/12/2010 16:38
    Edited by: Katherine on 20/12/2010 16:39

    Hi ,
    You can create a single dynamic distribution group with the condition to have only the mailboxes in exchange as its members . Then when a person send an email to that  Dynamic distribution group it will get distributed to all the mailboxes
    in exchange.
    Note : Most important feature in the dynamic group is that the membership of that group will be maintained automatically and also along with that we can have group membership by defining the recipient types/OU /rules.
    I agree with ED and also based on my knowledge you cannot achieve your scenario without Distribution groups or dynamic distribution groups.
    Thanks & Regards S.Nithyanandham

Maybe you are looking for

  • Need help opening pdf files

    I have a cd, which I have had for several years, and was able to use until the last year.  Suddenly, Adobe Reader (I have tried several versions, updates, fixes, whatever!) says that each and every pdf file on the disk is damaged. This is a cd that u

  • Enter/Return Key

    Hi all, I have been using macs for years, but this is my first Macbook. I love it so far, but I do have a question about the return/enter key. Mine does not seem to function. I have to use the enter key located by the apple key. Is there some easy fi

  • Plant Driven Procurement scenario in SRM Throgh XI.

    We are doing plant driven procurement scenario in SRM through XI7.0 (ECC 6.0 (MM)- XI7.0 -SRM5.0 SUS) 1.we downloaded XI Content for SRM Server 5.5 SP 12.But we are unable to find out SAP ECC 6.0 Software component Versions or Product version in SAP

  • Difference between sap xi 3.0 and sap pi 7.0

    hi guys, what is the difference  between SAP XI 3.0 and SAP PI 7.0,and R/3 4.7 and ECC 6.0 regards, subba reddy

  • Failed restore...phone not doing anything now

    I attempted to restore my iPhone because it was not working very well.  Part way through the process I got an error message saying that the restore had failed with no explaination.  Now my phone does nothing.  The only thing it shows is the icon on t