Sending Email thorugh SAPSCRIPT

Hi,
    we are able to send an email using a sapscript, inthe function OPEN_FORM we are passing the fields ITPCO, MAIL SENDER and MAIL RECIPENT. But now we want one line in the body also. Cann any tell us the fields we should pass for this data????

Hi,
  Check the code it may help u.
REPORT Z_SCRIPT .
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.
Creation of the document attachment
This form gets the OTF code from the SAPscript form.
If you already have your OTF code, I believe that you may
be able to skip this form. just do the following code, looping thru
your SOLISTI1 and updating MAILBIN.
PERFORM get_otf_code.
LOOP AT solisti1.
MOVE-CORRESPONDING solisti1 TO mailbin.
APPEND mailbin.
ENDLOOP.
DESCRIBE TABLE mailbin LINES tab_lines.
mailhead = 'TEST.OTF'.
APPEND mailhead.
Creation of the entry for the compressed attachment
mailpack-transf_bin = 'X'.
mailpack-head_start = 1.
mailpack-head_num = 1.
mailpack-body_start = 1.
mailpack-body_num = tab_lines.
mailpack-doc_type = 'OTF'.
mailpack-obj_name = 'TEST'.
mailpack-obj_descr = 'Subject'.
mailpack-doc_size = tab_lines * 255.
APPEND mailpack.
ENDFORM.
Form GET_OTF_CODE
FORM get_otf_code.
DATA: BEGIN OF otf OCCURS 0.
INCLUDE STRUCTURE itcoo .
DATA: END OF otf.
DATA: itcpo LIKE itcpo.
DATA: itcpp LIKE itcpp.
CLEAR itcpo.
itcpo-tdgetotf = 'X'.
Start writing OTF code
CALL FUNCTION 'OPEN_FORM'
EXPORTING
form = 'Z08V3_COLLI'
language = sy-langu
options = itcpo
dialog = ' '
EXCEPTIONS
OTHERS = 1.
CALL FUNCTION 'START_FORM'
EXCEPTIONS
error_message = 01
OTHERS = 02.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
window = 'MAIN'
EXCEPTIONS
error_message = 01
OTHERS = 02.
Close up Form and get OTF code
CALL FUNCTION 'END_FORM'
EXCEPTIONS
error_message = 01
OTHERS = 02.
MOVE-CORRESPONDING itcpo TO itcpp.
CALL FUNCTION 'CLOSE_FORM'
IMPORTING
result = itcpp
TABLES
otfdata = otf
EXCEPTIONS
OTHERS = 1.
Move OTF code to structure SOLI form email
CLEAR solisti1. REFRESH solisti1.
LOOP AT otf.
solisti1-line = otf.
APPEND solisti1.
ENDLOOP.
ENDFORM.
Check out these threads ..
Re: send sap script via email or printer.
Email SapScript : Question on READ_OTF_FROM_MEMORY
Regards,

Similar Messages

  • Sending Email From F.18 to vendor email

    Hi friends,
               kindly guide me how to send email to vendor email id from F.18, Is there any thing which i have to do in NACE and configure output types. kindly guide me. im using program SAPF130K  and sapscript ZF130_CONFIRM_01.
    Thanks,
    nagaraj

    Yes is possible,
    Go to your carrier web page, log in on your account,  go to setup blackberry email, and edit the account, now you have the option to do it.
    If I help you with any inquire, thank you for click kudos in my post.
    If your issue has been solved, please mark the post was solved.

  • Send email with spool in excel attachment

    Hi,
    I have this function:
    CALL FUNCTION 'Z_SEND_EMAIL_SPOOL_PDF'
           EXPORTING
                application = 'EMAIL'
                emailtitle  = texttitle
                recextnam   = email
                src_spoolid = tsp01-rqident
           TABLES
                texttab     = body.
    And code:
    FUNCTION z_send_email_spool_pdf .
    *"*"Interfase local
    *"  IMPORTING
    *"     REFERENCE(APPLICATION) LIKE  SOOD1-OBJNAM DEFAULT 'EMAIL'
    *"     REFERENCE(EMAILTITLE) LIKE  SOOD1-OBJDES
    *"     VALUE(RECEXTNAM) LIKE  SOOS1-RECEXTNAM
    *"     REFERENCE(SRC_SPOOLID) LIKE  TSP01-RQIDENT
    *"  TABLES
    *"      TEXTTAB STRUCTURE  SOLI
    *- local data declaration
      DATA: ohd    LIKE sood1,
            oid    LIKE soodk,
            to_all LIKE sonv-flag,
            okey   LIKE swotobjid-objkey.
      DATA: g_document     LIKE sood4,
            g_header_data  LIKE sood2,
            g_authority LIKE sofa-usracc,
            lt_attachments LIKE STANDARD TABLE OF sood5 WITH HEADER LINE,
            l_folder_id    LIKE sofdk,
            l_objcont     LIKE soli OCCURS 0 WITH HEADER LINE,
            i_bin LIKE solisti1 OCCURS 0 WITH HEADER LINE,
            l_objhead     LIKE soli OCCURS 0 WITH HEADER LINE,
            folder_id      LIKE soodk,
            object_id      LIKE soodk,
            link_folder_id LIKE soodk,
            hd_dat  LIKE sood1.
      DATA: desired_type  LIKE sood-objtp,
            real_type LIKE sood-objtp,
            attach_type LIKE sood-objtp,
            otf LIKE sood-objtp VALUE 'OTF', " SAPscript Ausgabeformat
            ali LIKE sood-objtp VALUE 'ALI', " ABAP lists
            pdf LIKE sood-objtp VALUE 'PDF', "PDF format
            pbyte TYPE i,
            t_pdf LIKE tline OCCURS 0 WITH HEADER LINE,
            objtype LIKE rststype-type,
            type    LIKE rststype-type.
      CONSTANTS: ou_fol LIKE sofh-folrg              VALUE 'O',
                 c_objtp    LIKE g_document-objtp    VALUE 'RAW',
                 c_file_ext LIKE g_document-file_ext VALUE 'PDF'.
      DATA: BEGIN OF receivers OCCURS 0.
              INCLUDE STRUCTURE soos1.
      DATA: END OF receivers.
    * Fist part: Verify if the spool really exists
      SELECT SINGLE * FROM tsp01 WHERE rqident = src_spoolid.
      CHECK sy-subrc = 0.
    *- fill odh
      CLEAR ohd.
      ohd-objla    = sy-langu.
      ohd-objnam   = application.
      ohd-objdes   = emailtitle.
      ohd-objpri   = 3.
      ohd-objsns   = 'F'.
      ohd-ownnam   = sy-uname.
    *- send Email
      CONDENSE recextnam NO-GAPS.
      CHECK recextnam <> space AND recextnam CS '@'.
      CALL FUNCTION 'RSTS_GET_ATTRIBUTES'
           EXPORTING
                authority     = 'SP01'
                client        = tsp01-rqclient
                name          = tsp01-rqo1name
                part          = 1
           IMPORTING
                type          = type
                objtype       = objtype
           EXCEPTIONS
                fb_error      = 1
                fb_rsts_other = 2
                no_object     = 3
                no_permission = 4
                OTHERS        = 5.
      attach_type = c_objtp.
      desired_type = pdf.
      IF objtype(3) = 'OTF'.
        CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
             EXPORTING
                  src_spoolid   = src_spoolid
             IMPORTING
                  pdf_bytecount = pbyte
             TABLES
                  pdf           = t_pdf.
      ELSE.
        CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
             EXPORTING
                  src_spoolid   = src_spoolid
             IMPORTING
                  pdf_bytecount = pbyte
             TABLES
                  pdf           = t_pdf.
      ENDIF.
      PERFORM convertir_tabla_pdf_2 TABLES t_pdf l_objcont.
      CALL FUNCTION 'SO_FOLDER_ROOT_ID_GET'
           EXPORTING
                owner     = sy-uname
                region    = ou_fol
           IMPORTING
                folder_id = l_folder_id
           EXCEPTIONS
                OTHERS    = 5.
    * fill out informations about the header of the email
      CLEAR: g_document.
      g_document-foltp     = l_folder_id-foltp.
      g_document-folyr     = l_folder_id-folyr.
      g_document-folno     = l_folder_id-folno.
      g_document-objtp     = c_objtp.
      g_document-objdes    = emailtitle.
      g_document-file_ext  = c_file_ext.
      g_header_data-objdes    = emailtitle.
      CALL FUNCTION 'SO_DOCUMENT_REPOSITORY_MANAGER'
           EXPORTING
                method      = 'SAVE'
                office_user = sy-uname
           IMPORTING
                authority   = g_authority
           TABLES
                objcont     = texttab
                attachments = lt_attachments
           CHANGING
                document    = g_document
                header_data = g_header_data
           EXCEPTIONS
                OTHERS      = 1.
      object_id-objtp = c_objtp.
      object_id-objyr = g_document-objyr.
      object_id-objno = g_document-objno.
      folder_id-objtp = l_folder_id-foltp.
      folder_id-objyr = l_folder_id-folyr.
      folder_id-objno = l_folder_id-folno.
      link_folder_id-objtp = l_folder_id-foltp.
      link_folder_id-objyr = l_folder_id-folyr.
      link_folder_id-objno = l_folder_id-folno.
      hd_dat-file_ext = pdf.
      hd_dat-objdes = emailtitle.
      CALL FUNCTION 'SO_ATTACHMENT_INSERT'
           EXPORTING
                object_id                  = object_id
                attach_type                = attach_type
                object_hd_change           = hd_dat
                owner                      = sy-uname
           TABLES
                objcont                    = l_objcont
                objhead                    = l_objhead
           EXCEPTIONS
                active_user_not_exist      = 35
                communication_failure      = 71
                object_type_not_exist      = 17
                operation_no_authorization = 21
                owner_not_exist            = 22
                parameter_error            = 23
                substitute_not_active      = 31
                substitute_not_defined     = 32
                system_failure             = 72
                x_error                    = 1000.
    *       FORM SO_OBJECT_SEND_REC                                       *
    FORM  so_object_send_rec
          TABLES  objcont      STRUCTURE soli
                  receivers    STRUCTURE soos1
          USING   object_hd    STRUCTURE sood1
                  folder_id
                  object_id
                  link_folder_id.
      DATA:   oid     LIKE soodk,
              to_all  LIKE sonv-flag,
              okey    LIKE swotobjid-objkey.
      CALL FUNCTION 'SO_OBJECT_SEND'
           EXPORTING
                extern_address             = 'X'
    *            object_hd_change           = object_hd
    *            object_type                = 'RAW'
                outbox_flag                = 'X'
                sender                     = sy-uname
                owner                      = sy-uname
                folder_id                  = folder_id
                object_id                  = object_id
                store_flag                 = 'X'
                link_folder_id             = link_folder_id
           IMPORTING
                object_id_new              = oid
                sent_to_all                = to_all
                office_object_key          = okey
           TABLES
                objcont                    = objcont
                receivers                  = receivers
           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.
      IF sy-subrc <> 0.
        RAISE others.
      ENDIF.
    ENDFORM.
    *       FORM INIT_REC                                                 *
    FORM init_rec TABLES receivers STRUCTURE soos1.
      CLEAR receivers.
      REFRESH receivers.
      MOVE sy-datum  TO receivers-rcdat .
      MOVE sy-uzeit  TO receivers-rctim.
      MOVE '1'       TO receivers-sndpri.
      MOVE 'X'       TO receivers-sndex.
      MOVE 'U-'      TO receivers-recnam.
      MOVE 'U'       TO receivers-recesc.
      MOVE 'INT'     TO receivers-sndart.
      MOVE '5'       TO receivers-sortclass.
      APPEND receivers.
    ENDFORM.
    With this function I can send a spool in pdf format by email. But, now I need send a spool in Excel (xls) format by email. I try to disconnect 'CONVERT_OTFSPOOLJOB_2_PDF' and 'CONVERT_ABAPSPOOLJOB_2_PDF' but doesnt work.
    Can you help me?
    A lot of thanks in advance.
    Best regards.

    Hi.
    I do not think it is feasible to create a worthwhile Excel file from a SAP spool file.
    I have reports that send output as Excel attachments to email, but the code (including function modules etc) is too much to post here.
    You can use OLE to create an Excel file, but this will not generally work when the report is run in the background.
    So my approach is to make the report write an Excel XML file (that's just text after all), and send that as an XLS email attachment.  When the email receiver double-clicks on the attachment, it fires up Excel and brings in the data.  Most users would not realise that it's not a native Excel file.
    One nice touch is to have two sheets in the Excel file, one with the main report and the other with the selection criteria.
    Of course there is a lot of work getting started with this.
    John

  • Email PO Sapscript

    Hi experts,
    I need to send the PO sapscript through email to a group of people.
    I found FM SO_NEW_DOCUMENT_ATT_SEND_API1  but I do not know how to populate it to indicate the specific PO number to send.
    All help is appreciated.
    Monica.

    Hi,
    Check the following to get clear idea abt functions,
    OPEN_FORM
    The function module OPEN_FORM opens form printing. You must call this function module before you can use any other form function (WRITE_FORM, START_FORM, CONTROL_FORM...).
    You need not specify a form name. If you omit the name, you must use the function module START_FORM to open a form before starting the output.
    You must end form printing by using the function module CLOSE_FORM. Otherwise, the system does not print or display anything.
    Within a program, you can use several OPEN_FORM.. CLOSE_FORM pairs. This allows you to write output to several different spool requests from within one program.
    CLOSE_FORM
    The function module closes the form opened using OPEN_FORM. The system executes any terminating processing steps for the last opened form.
    You must use this function module to close form printing. Otherwise, no output appears on printer or screen.
    START_FORM
    In-between the function modules OPEN_FORM and CLOSE_FORM, you can use different forms. This allows you to combine several different forms into one print output. However, you can combine only those forms that have the same page format.
    To switch forms, use the function module START_FORM. If another form is still open, you must close it first using END_FORM.
    If you specify no form name when calling START_FORM, the system restarts the last open form. If after OPEN_FORM no form was activated yet, the system leaves the function module with the exception UNUSED.
    WRITE_FORM
    The system outputs the form element specified in parameter ELEMENT into the currently opened form.
    In the parameter WINDOW you can specify the name of a window for the output. Remember that the form element must be defined in this window. The parameter FUNCTION specifies how to merge the text lines to be output with any existing contents in the window. In this case, there are differences between the different window types or areas.
    WRITE_FORM_LINES
    The function module outputs the text lines in table LINES into the specified form window. The text lines must have the SAPscript ITF format. From the data in the text header, the system uses only the field TDSTYLE to apply the formatting attributes defined in the specified style for this text. If the field is empty, the system uses the identically named formatting attributes (character and paragraph formats) of the form.
    Use parameter WINDOW to specify into which of the windows defined in the form you want to output the text. You can specify any window used in the form. The parameter FUNCTION determines how to merge the text lines to be output with any existing contents in the window. There are differences between the different window types or areas.
    END_FORM
    END_FORM ends the currently open form and executes the required termination processing. After calling this function module, no more form is active. For further output, you must start a new form using START_FORM.
    CONTROL_FORM
    Use CONTROL_FORM to pass SAPscript control statements to the form.
    READ_FORM_ELEMENTS
    The function module fills a table with all text elements that appear in one form.
    If you specify no form name, the system includes all elements of the currently open form. If you specify a form, the system uses the information about the active version of the form, retrieved from the database.
    READ_FORM_LINES
    Use this function module to transfer the lines of a form element into an internal table.
    If you specify no form name, the system transfers the text lines of the currently open form. If you specify a form, the system uses the text lines of the active version of the form from the database.
    http://help.sap.com/saphelp_40b/helpdata/en/d6/0dc169494511d182b70000e829fbfe/frameset.htm
    <b>Reward if helpful.</b>

  • Email of SAPSCRIPT Print Output

    Hi,
    Can anyone please tell me steps to send an External Email from SAPSCRIPT.
    let me elaborate more on this.I have a "Z" print program for printing RFQ's.Now we need to send this output thru Email as well to vendors.
    Thanks in advance,

    Hi,
    You do not need to bother with the OTF stuff - you can ditch it.
    Use the code below to achieve the e-mailing :
    *--- Set the recipient e-mail address
    LW_COMM_VALUES-ADSMTP-SMTP_ADDR = [email protected]
    *--- Set title
    LW_SNAST-TDCOVTITLE = SY-TITLE
    *--- Set sender and recipient details
    CALL FUNCTION 'CONVERT_COMM_TYPE_DATA'
    EXPORTING
    PI_COMM_TYPE = 'INT'
    PI_COMM_VALUES = LW_COMM_VALUES
    PI_REPID = SY-REPID
    PI_SNAST = LW_SNAST
    PI_MAIL_SENDER = SY-UNAME
    IMPORTING
    PE_ITCPO = GW_ITCPO
    PE_MAIL_RECIPIENT = LW_RECIPIENT
    PE_MAIL_SENDER = LW_SENDER
    EXCEPTIONS
    COMM_TYPE_NOT_SUPPORTED = 1
    RECIPIENT_CREATION_FAILED = 2
    SENDER_CREATION_FAILED = 3
    OTHERS = 4.
    The objects used here are defined as follows :
    LW_COMM_VALUES TYPE SZADR_COMM_VALUES
    LW_SENDER TYPE SWOTOBJID
    LW_RECIPIENT TYPE SWOTOBJID
    LW_SNAST TYPE SNAST
    This will give you the recipient and sender details. Now all you need to do is call the function OPEN_FORM as follows:
    CALL FUNCTION 'OPEN_FORM'
    EXPORTING
    DEVICE = 'MAIL' <--- Note: Device is PRINTER for printing
    DIALOG = SPACE
    FORM = SAPscript form name
    LANGUAGE = SY-LANGU
    OPTIONS = GW_ITCPO
    MAIL_SENDER = LW_SENDER
    MAIL_RECIPIENT = LW_RECIPIENT
    EXCEPTIONS
    CANCELED = 1
    DEVICE = 2
    FORM = 3
    OPTIONS = 4
    UNCLOSED = 5
    MAIL_OPTIONS = 6
    ARCHIVE_ERROR = 7
    INVALID_FAX_NUMBER = 8
    MORE_PARAMS_NEEDED_IN_BATCH = 9
    SPOOL_ERROR = 10
    CODEPAGE = 11
    OTHERS = 12.
    This is far easier to use this method.
    Any questions, please let me know.
    Kind regards
    Colin

  • Send Emails to Multiple Users ?

    Hi,
    I am working on the requirement where I need to create workflow in which I am sending email to multiple users. I have receiver list in a 'Z' Table. So I have to fetch those users from the 'Z' table on some conditions and send emails to them. I am send email to single user mentioned statically in Receipent box but I need to find the receivers dynamically and not able to send email to multiple users.
    Please help me in this.
    Thanks,
    Ketan

    Hi Ketan,
    First af all create one MULTILINE container in your workflow say LT_EMAIL. its type should be SOXNA-FULLNAME.
    Then thorugh some activity step, fill all the recepient's email addresses in workflow container LT_EMAIL. Then create one activity step type to send an email using SENDRASKDESCRIPTION method of business object SELFITEM. in the ADDRESSSTRING pass the multiple container LT_EMAIL and in TYPEID pass 'U'.
    refere below link for BO programming in sap workflow Useful SAP Business Object Type programming macros.
    Regards,
    Ibrahim

  • Is there a Function module to send email ?

    Hi all,
    is there a FM that can be used to send E mails?
    i found so_document_send_api on the SDN, but it doesnt exist.
    any pointers?
    Thanks,
    Sonal

    Hi Sonal,
    http://www.sap-img.com/fu016.htm
    SO_DOCUMENT_SEND_API1 
    SO_NEW_DOCUMENT_ATT_SEND_API1
    How to send a report to an external mail-id?
    REPORT ZREPORT_TO_EMAIL NO STANDARD PAGE HEADING LINE-SIZE 200.
    DATA : BEGIN OF ITAB OCCURS 0,
    PERNR LIKE PA0001-PERNR,
    ENAME LIKE PA0001-ENAME,
    END OF ITAB.
    DATA: message_content LIKE soli OCCURS 10 WITH HEADER LINE,
    receiver_list LIKE soos1 OCCURS 5 WITH HEADER LINE,
    packing_list LIKE soxpl OCCURS 2 WITH HEADER LINE,
    listobject LIKE abaplist OCCURS 10,
    compressed_attachment LIKE soli OCCURS 100 WITH HEADER LINE,
    w_object_hd_change LIKE sood1,
    compressed_size LIKE sy-index.
    START-OF-SELECTION.
    SELECT PERNR ENAME
    INTO CORRESPONDING FIELDS OF TABLE ITAB
    FROM PA0001
    WHERE PERNR < 50.
    LOOP AT ITAB.
    WRITE :/02 SY-VLINE , ITAB-PERNR, 15 SY-VLINE , ITAB-ENAME, 50
    SY-VLINE.
    ENDLOOP.
    Receivers
    receiver_list-recextnam = '[email protected]'. "-->
    EMAIL ADDRESS
    RECEIVER_list-RECESC = 'E'. "<-
    RECEIVER_list-SNDART = 'INT'."<-
    RECEIVER_list-SNDPRI = '1'."<-
    APPEND receiver_list.
    General data
    w_object_hd_change-objla = sy-langu.
    w_object_hd_change-objnam = 'Object name'.
    w_object_hd_change-objsns = 'P'.
    Mail subject
    w_object_hd_change-objdes = 'Message subject'.
    Mail body
    APPEND 'Message content' TO message_content.
    Attachment
    CALL FUNCTION 'SAVE_LIST'
    EXPORTING
    list_index = '0'
    TABLES
    listobject = listobject.
    CALL FUNCTION 'TABLE_COMPRESS'
    IMPORTING
    compressed_size = compressed_size
    TABLES
    in = listobject
    out = compressed_attachment.
    DESCRIBE TABLE compressed_attachment.
    CLEAR packing_list.
    packing_list-transf_bin = 'X'.
    packing_list-head_start = 0.
    packing_list-head_num = 0.
    packing_list-body_start = 1.
    packing_list-body_num = sy-tfill.
    packing_list-objtp = 'ALI'.
    packing_list-objnam = 'Object name'.
    packing_list-objdes = 'Attachment description'.
    packing_list-objlen = compressed_size.
    APPEND packing_list.
    CALL FUNCTION 'SO_OBJECT_SEND'
    EXPORTING
    object_hd_change = w_object_hd_change
    object_type = 'RAW'
    owner = sy-uname
    TABLES
    objcont = message_content
    receivers = receiver_list
    packing_list = packing_list
    att_cont = compressed_attachment.
    http://www.sap-img.com/abap/sending-mail-with-attachment-report-in-background.htm
    Here is the sample code:
    z_send_email_fax_global
    FUNCTION-POOL z_gfaian_mail_fax.            "MESSAGE-ID ..
    WORK TABLE AREAS
    TABLES: tsp01.
    INTERNAL TABLES
    DATA: lt_rec_tab LIKE STANDARD TABLE OF soos1 WITH HEADER LINE,
          lt_note_text   LIKE STANDARD TABLE OF soli  WITH HEADER LINE,
          lt_attachments LIKE STANDARD TABLE OF sood5 WITH HEADER LINE.
    DATA: lt_objcont LIKE STANDARD TABLE OF soli WITH HEADER LINE,
          lt_objhead LIKE STANDARD TABLE OF soli WITH HEADER LINE.
    DATA: pdf_format LIKE STANDARD TABLE OF tline WITH HEADER LINE.
    TYPES: BEGIN OF y_files,
           file(60) TYPE c,
           END OF y_files.
    DATA: lt_files TYPE STANDARD TABLE OF y_files WITH HEADER LINE.
    DATA: l_objcont     LIKE soli OCCURS 0 WITH HEADER LINE.
    DATA: l_objhead     LIKE soli OCCURS 0 WITH HEADER LINE.
    STRUCTURES
    DATA: folder_id      LIKE soodk,
          object_id      LIKE soodk,
          link_folder_id LIKE soodk,
          g_document     LIKE sood4,
         g_header_data  LIKE sood2,
          g_folmem_data  LIKE sofm2,
          g_header_data  LIKE sood2,
          g_receive_data LIKE soos6,
          g_ref_document LIKE sood4,
          g_new_parent   LIKE soodk,
          l_folder_id    LIKE sofdk,
          v_email(50).
    DATA: hd_dat  like sood1.
    VARIABLES
    DATA: client  LIKE tst01-dclient,
          name    LIKE tst01-dname,
          objtype LIKE rststype-type,
          type    LIKE rststype-type.
    DATA: numbytes TYPE i,
          arc_idx LIKE toa_dara,
          pdfspoolid LIKE tsp01-rqident,
          jobname LIKE tbtcjob-jobname,
          jobcount LIKE tbtcjob-jobcount,
          is_otf.
    DATA: outbox_flag LIKE sonv-flag VALUE 'X',
          store_flag  LIKE sonv-flag,
          delete_flag LIKE sonv-flag,
          owner       LIKE soud-usrnam,
          on          LIKE sonv-flag VALUE 'X',
          sent_to_all LIKE sonv-flag,
          g_authority LIKE sofa-usracc,
          w_objdes    LIKE sood4-objdes.
    DATA: c_file LIKE rlgrap-filename,
          n_spool(6) TYPE n.
    DATA: cancel.
    DATA: desired_type  LIKE sood-objtp,
          real_type LIKE sood-objtp,
          attach_type LIKE sood-objtp,
          otf LIKE sood-objtp VALUE 'OTF', " SAPscript Ausgabeformat
          ali LIKE sood-objtp VALUE 'ALI'. " ABAP lists
    CONSTANTS
    CONSTANTS: ou_fol LIKE sofh-folrg              VALUE 'O',
               c_objtp    LIKE g_document-objtp    VALUE 'RAW',
               c_file_ext LIKE g_document-file_ext VALUE 'TXT'.
    =================================================================================
    z_send_email_fax2
    FUNCTION z_faian_mail_fax2.
    ""Interface local:
    *"  IMPORTING
    *"     REFERENCE(SRC_SPOOLID) LIKE  TSP01-RQIDENT
    *"     REFERENCE(FAX_MAIL_NUMBER) TYPE  SO_NAME
    *"     REFERENCE(HEADER_MAIL) TYPE  SO_OBJ_DES
    *"     REFERENCE(OBJECT_TYPE) TYPE  SO_ESCAPE
    *"  TABLES
    *"      LT_BODY_EMAIL STRUCTURE  SOLI
    *"  EXCEPTIONS
    *"      ERR_NO_ABAP_SPOOLJOB
    Fist part: Verify if the spool really exists
      SELECT SINGLE * FROM tsp01 WHERE rqident = src_spoolid.
      IF sy-subrc NE 0.
        RAISE err_no_abap_spooljob. "doesn't exist
      ELSE.
        client = tsp01-rqclient.
        name   = tsp01-rqo1name.
        CALL FUNCTION 'RSTS_GET_ATTRIBUTES'
             EXPORTING
                  authority     = 'SP01'
                  client        = client
                  name          = name
                  part          = 1
             IMPORTING
                  type          = type
                  objtype       = objtype
             EXCEPTIONS
                  fb_error      = 1
                  fb_rsts_other = 2
                  no_object     = 3
                  no_permission = 4
                  OTHERS        = 5.
        IF objtype(3) = 'OTF'.
          desired_type = otf.
        ELSE.
          desired_type = ali.
        ENDIF.
        CALL FUNCTION 'RSPO_RETURN_SPOOLJOB'
             EXPORTING
                  rqident              = src_spoolid
                  desired_type         = desired_type
             IMPORTING
                  real_type            = real_type
             TABLES
                  buffer               = l_objcont
             EXCEPTIONS
                  no_such_job          = 14
                  type_no_match        = 94
                  job_contains_no_data = 54
                  no_permission        = 21
                  can_not_access       = 21
                  read_error           = 54.
        IF sy-subrc EQ 0.
          attach_type = real_type.
        ENDIF.
        CALL FUNCTION 'SO_FOLDER_ROOT_ID_GET'
             EXPORTING
                  owner     = sy-uname
                  region    = ou_fol
             IMPORTING
                  folder_id = l_folder_id
             EXCEPTIONS
                  OTHERS    = 5.
    fill out informations about the header of the email
        CLEAR: g_document.
        g_document-foltp     = l_folder_id-foltp.
        g_document-folyr     = l_folder_id-folyr.
        g_document-folno     = l_folder_id-folno.
        g_document-objtp     = c_objtp.
        g_document-objdes    = header_mail.
        g_document-file_ext  = c_file_ext.
        g_header_data-objdes    = header_mail.
        CALL FUNCTION 'SO_DOCUMENT_REPOSITORY_MANAGER'
             EXPORTING
                  method      = 'SAVE'
                  office_user = sy-uname
             IMPORTING
                  authority   = g_authority
             TABLES
                  objcont     = lt_body_email
                  attachments = lt_attachments
             CHANGING
                  document    = g_document
                  header_data = g_header_data
             EXCEPTIONS
                  OTHERS      = 1.
        folder_id-objtp = l_folder_id-foltp.
        folder_id-objyr = l_folder_id-folyr.
        folder_id-objno = l_folder_id-folno.
        object_id-objtp = c_objtp.
        object_id-objyr = g_document-objyr.
        object_id-objno = g_document-objno.
        link_folder_id-objtp = l_folder_id-foltp.
        link_folder_id-objyr = l_folder_id-folyr.
        link_folder_id-objno = l_folder_id-folno.
        REFRESH lt_rec_tab.
       CLEAR lt_rec_tab.
       lt_rec_tab-sel        = 'X'.
       lt_rec_tab-recesc     = object_type.   "This field for FAX/MAIL
       lt_rec_tab-recnam     = 'U-'.
       lt_rec_tab-deliver    = 'X'.
       lt_rec_tab-not_deli   = 'X'.
       lt_rec_tab-read       = 'X'.
       lt_rec_tab-mailstatus = 'E'.
       lt_rec_tab-adr_name   = fax_mail_number.
       lt_rec_tab-sortfield  = fax_mail_number.
       lt_rec_tab-recextnam  = fax_mail_number.
       lt_rec_tab-sortclass  = '5'.
       APPEND lt_rec_tab.
          lt_rec_tab-recextnam = fax_mail_number.
          lt_rec_tab-recesc = object_type.
          lt_rec_tab-sndart = 'INT'.
          lt_rec_tab-sndpri = 1.
          APPEND lt_rec_tab.
        lt_files-file = c_file.
        APPEND lt_files.
    begin of insertion by faianf01
        hd_dat-objdes = header_mail.
        CALL FUNCTION 'SO_ATTACHMENT_INSERT'
             EXPORTING
                  object_id                  = object_id
                  attach_type                = attach_type
                  object_hd_change           = hd_dat
                  owner                      = sy-uname
             TABLES
                  objcont                    = l_objcont
                  objhead                    = l_objhead
             EXCEPTIONS
                  active_user_not_exist      = 35
                  communication_failure      = 71
                  object_type_not_exist      = 17
                  operation_no_authorization = 21
                  owner_not_exist            = 22
                  parameter_error            = 23
                  substitute_not_active      = 31
                  substitute_not_defined     = 32
                  system_failure             = 72
                  x_error                    = 1000.
        IF sy-subrc > 0.
        ENDIF.
    end of insertion by faianf01
    send email from SAPOFFICE
        CALL FUNCTION 'SO_OBJECT_SEND'
             EXPORTING
                  folder_id                  = folder_id
                  object_id                  = object_id
                  outbox_flag                = outbox_flag
                  link_folder_id             = link_folder_id
                  owner                      = sy-uname
                 check_send_authority       = 'X'
             TABLES
                  receivers                  = lt_rec_tab
                 note_text                  = lt_note_text
             EXCEPTIONS
                  active_user_not_exist      = 35
                  communication_failure      = 71
                  component_not_available    = 1
                  folder_no_authorization    = 5
                  folder_not_exist           = 6
                  forwarder_not_exist        = 8
                  object_no_authorization    = 13
                  object_not_exist           = 14
                  object_not_sent            = 15
                  operation_no_authorization = 21
                  owner_not_exist            = 22
                  parameter_error            = 23
                  substitute_not_active      = 31
                  substitute_not_defined     = 32
                  system_failure             = 72
                  too_much_receivers         = 73
                  user_not_exist             = 35.
      ENDIF.
    ENDFUNCTION.
    =================================================================================
    z_send_email_fax
    FUNCTION ZCBFS_SEND_MAIL.
    ""Interface local:
    *"  IMPORTING
    *"     REFERENCE(SRC_SPOOLID) LIKE  TSP01-RQIDENT
    *"     REFERENCE(HEADER_MAIL) TYPE  SO_OBJ_DES
    *"  TABLES
    *"      LIST_FAX_MAIL_NUMBER STRUCTURE  SOLI
    *"  EXCEPTIONS
    *"      ERR_NO_ABAP_SPOOLJOB
      DATA: vg_achou(1) TYPE n.
    Fist part: Verify if the spool really exists
      vg_achou = 1.
      DO 60 TIMES.
        SELECT SINGLE * FROM tsp01 WHERE rqident = src_spoolid.
        IF sy-subrc IS INITIAL.
          CLEAR vg_achou.
          EXIT.
        ELSE.
          WAIT UP TO 1 SECONDS.
        ENDIF.
      ENDDO.
      IF vg_achou = 1.
        RAISE err_no_abap_spooljob. "doesn't exist
      ENDIF.
      client = tsp01-rqclient.
      name   = tsp01-rqo1name.
      CALL FUNCTION 'RSTS_GET_ATTRIBUTES'
           EXPORTING
                authority     = 'SP01'
                client        = client
                name          = name
                part          = 1
           IMPORTING
                type          = type
                objtype       = objtype
           EXCEPTIONS
                fb_error      = 1
                fb_rsts_other = 2
                no_object     = 3
                no_permission = 4
                OTHERS        = 5.
      IF objtype(3) = 'OTF'.
        desired_type = otf.
      ELSE.
        desired_type = ali.
      ENDIF.
      CALL FUNCTION 'RSPO_RETURN_SPOOLJOB'
           EXPORTING
                rqident              = src_spoolid
                desired_type         = desired_type
           IMPORTING
                real_type            = real_type
           TABLES
                buffer               = l_objcont
           EXCEPTIONS
                no_such_job          = 14
                type_no_match        = 94
                job_contains_no_data = 54
                no_permission        = 21
                can_not_access       = 21
                read_error           = 54.
      IF sy-subrc EQ 0.
        attach_type = real_type.
      ENDIF.
      CALL FUNCTION 'SO_FOLDER_ROOT_ID_GET'
           EXPORTING
                owner     = sy-uname
                region    = ou_fol
           IMPORTING
                folder_id = l_folder_id
           EXCEPTIONS
                OTHERS    = 5.
    fill out informations about the header of the email
      CLEAR: g_document.
      g_document-foltp     = l_folder_id-foltp.
      g_document-folyr     = l_folder_id-folyr.
      g_document-folno     = l_folder_id-folno.
      g_document-objtp     = c_objtp.
      g_document-objdes    = header_mail.
      g_document-file_ext  = c_file_ext.
      g_header_data-objdes    = header_mail.
      CALL FUNCTION 'SO_DOCUMENT_REPOSITORY_MANAGER'
           EXPORTING
                method      = 'SAVE'
                office_user = sy-uname
           IMPORTING
                authority   = g_authority
           TABLES
                attachments = lt_attachments
           CHANGING
                document    = g_document
                header_data = g_header_data
           EXCEPTIONS
                OTHERS      = 1.
      folder_id-objtp = l_folder_id-foltp.
      folder_id-objyr = l_folder_id-folyr.
      folder_id-objno = l_folder_id-folno.
      object_id-objtp = c_objtp.
      object_id-objyr = g_document-objyr.
      object_id-objno = g_document-objno.
      link_folder_id-objtp = l_folder_id-foltp.
      link_folder_id-objyr = l_folder_id-folyr.
      link_folder_id-objno = l_folder_id-folno.
      REFRESH lt_rec_tab.
      LOOP AT LIST_FAX_MAIL_NUMBER.
        lt_rec_tab-recextnam = LIST_FAX_MAIL_NUMBER-LINE.
        lt_rec_tab-recesc = 'U'.
        lt_rec_tab-sndart = 'INT'.
        lt_rec_tab-sndpri = 1.
        APPEND lt_rec_tab.
      ENDLOOP.
      lt_files-file = c_file.
      APPEND lt_files.
      hd_dat-objdes = header_mail.
      CALL FUNCTION 'SO_ATTACHMENT_INSERT'
           EXPORTING
                object_id                  = object_id
                attach_type                = attach_type
                object_hd_change           = hd_dat
                owner                      = sy-uname
           TABLES
                objcont                    = l_objcont
                objhead                    = l_objhead
           EXCEPTIONS
                active_user_not_exist      = 35
                communication_failure      = 71
                object_type_not_exist      = 17
                operation_no_authorization = 21
                owner_not_exist            = 22
                parameter_error            = 23
                substitute_not_active      = 31
                substitute_not_defined     = 32
                system_failure             = 72
                x_error                    = 1000.
      IF sy-subrc > 0.
      ENDIF.
    send email from SAPOFFICE
      CALL FUNCTION 'SO_OBJECT_SEND'
           EXPORTING
                folder_id                  = folder_id
                object_id                  = object_id
                outbox_flag                = outbox_flag
                link_folder_id             = link_folder_id
                owner                      = sy-uname
           TABLES
                receivers                  = lt_rec_tab
                note_text                  = lt_note_text
           EXCEPTIONS
                active_user_not_exist      = 35
                communication_failure      = 71
                component_not_available    = 1
                folder_no_authorization    = 5
                folder_not_exist           = 6
                forwarder_not_exist        = 8
                object_no_authorization    = 13
                object_not_exist           = 14
                object_not_sent            = 15
                operation_no_authorization = 21
                owner_not_exist            = 22
                parameter_error            = 23
                substitute_not_active      = 31
                substitute_not_defined     = 32
                system_failure             = 72
                too_much_receivers         = 73
                user_not_exist             = 35.
    ENDFUNCTION.
    Regards,
    Srilatha.

  • Sending emails in PDF & TXT format generated by SAP script/Smart forms

    Hi
    We have a requirement to configure SMTP node to send emails in PDF & TXT format. Currently, Output format for SAP Documents generated by SAP Script/Smart Forms configured in PDF. (Tx - SCOT - SMTP Node - Intetnet - Output Forms for SAP Documents). But, We also like to send emails in TXT format for other application in the same system. I see that you can send emails generated by SAP Script/Smart Forms either in PDF or TXT format not both.
    Is it possible to send the emails in both the formats by configuring in Tx SCOT?
    Your inputs will be appreciated.
    Regards
    Chandu

    Hi chandu,
    1.  emails in both the formats by configuring in Tx SCOT ?
      Scot will allow only ONE AT A TIME.
    2. The other workaround is,
      that using some FM
      convert the OTF (sapscript/smartform)
      data to TEXT,
      and send it as RAW
    3. Configure RAW =  TEXT in scot.
    regards,
    amit m.

  • Cannot send email from yahoo account on iPhone 5

    I just got an iPhone5 and I couldn't set up my Yahoo email as "yahoo"--it would not allow me to complete the process despot multiple attempts. I had to set it up as an "other" account. I can receive and read emails on my phone, but when I reply those messages will not send. They go to the outbox and an error message pops up that says" the email account has been rejected by the server" Does anyone have advice on either issue: setting up yahoo properly and/or sending email from phone?

    outgoing mail server
    SMTP - Yahoo! SMTP Server
    primary server
    Yahoo! SMTP server - ON
    server port 465
    That's what I have for my yahoo account.

  • Cannot send email from non .mac server

    I am only able to send/reply emails using my .mac address. My 2 other server addresses keep giving me the following message.
    "Cannot send mail. One of the recipient addresses was invalid".
    How can I fix this?

    You should be able to send email from Safari, however I do wonder why you wish to do this and whether there is something inherently wrong with using your mail app and your iCloud address.

  • Cannot send email from MobileMe account

    Apple recently pushed out an update to the MobileMe calendar. Since upgrading my account, I am unable to send emails from Firefox4 (current version) in Windows. The page sits indefinitely at a loading screen. Apple Support won't help because it isn't an issue with Safari. Anyone else have this issue?

    When using the MobileMe account preset to create the account, the SMTP server is created with 587 as the SMTP server port, which can't be changed when using the MM account preset to create the account.

  • Cannot send email from Verizon to a specific domain using the web UI

    I'm trying to send an email to a specific address on a domain I own from a Verizon account using the web UI. Whenever I click send, a popup appears saying "Your e-mail contains the following invalid e-mail addresses:" followed by the email address. I can send email to this address from a GMail account as well as my work email.
    In Chrome, I can see that a "code":1002 error is being produced.
    Does anyone know why this would happen? Does Verizon check destination domains for reputation? Is there any way to debug this further?

    rhodeislandred wrote:
    I'm trying to send an email to a specific address on a domain I own from a Verizon account using the web UI. Whenever I click send, a popup appears saying "Your e-mail contains the following invalid e-mail addresses:" followed by the email address. I can send email to this address from a GMail account as well as my work email.
    In Chrome, I can see that a "code":1002 error is being produced.
    Does anyone know why this would happen? Does Verizon check destination domains for reputation? Is there any way to debug this further?
    What is the domain that is giving you the error?

  • Cannot send email from Powershell on Mailbox Role

    Hi,
    I am trying to send an email from Powershell on Mailbox role of Exchange server. I have installed Symantec Mail Security on Mailbox Role.
    When I try to send email using Powershell, I got the following error.
    PS C:\a> Send-MailMessage -to [email protected] -Subject "Alert Closed.. Service is restarted on Computer" -from
    [email protected] -Body "The service was found stopped on Computer it was started automatically and it is now running normally." -bodyasHTML -priority High -SmtpServer smtp.domain.com
    Send-MailMessage : Service not available, closing transmission channel. The server response was: 4.3.2 Service not active
    At line:1 char:1
    + Send-MailMessage -to [email protected] -Subject "Alert Closed.. Service is ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : InvalidOperation: (System.Net.Mail.SmtpClient:SmtpClient) [Send-MailMessage], SmtpException
        + FullyQualifiedErrorId : SmtpException,Microsoft.PowerShell.Commands.SendMailMessage
    This command is working fine on every server except exchange server (CAS, Mailbox). Firewall is off on the servers.
    Any help will be highly appreciated.
    Regards,
    Anees

    Hi,
    Please check the similar thread .
    http://social.technet.microsoft.com/Forums/exchange/en-US/ef699832-8da9-4709-9a50-c6223b13bd95/sendmailmessage-returns-the-server-response-was-432-service-not-available?forum=exchangesvrsecuremessaginglegacy
    smtp server (smtp.domain.com) is rejecting the connection from the
     Mailbox role of Exchange server.
    So please allow the mailbox server ip address on the smtp server's (i.e. smtp.domain.com)
    receive connector to get it done 
    Regards
    S.Nithyanandham
    Thanks S.Nithyanandham

  • Cannot send email from an iPhone to a Outlook group.

    Hi,
    My question is simple and I'd like an exactly same answer : Can iPhone users send emails from their iPhone's to one or more groups created in Outlook?
    This is my situation: our organization is using iPhone to provide email, calendar, contact, task etc. to some of their employees. We are using Airwatch MDM Agent on user's iPhone because we have an Airwatch server in place. I have an user and she has an iPhone 5 and she has created some groups in Outlook but these groups are not reflected in her Contacts in the iPhone. I have update her phone with the latest update, although I was almost sure that this was not the issue, then I've found some interesting posts on internet saying that this was a known problem for the users with the previous iOS but I thought this might has been corrected with the iOS, apparently not.
    Also I've tried ''the trick'' that is posted on several forums with the iCloud but neither so it's working. I am looking for a straight answer, if this works or not on iPhone's?
    Thanks,
    Sebastian.

    There indeed ARE apps in the app store that will do what you want.  Just search and find the one that best fits your needs.

  • Cannot send email from the Mail App?

    I've had an izymail subscription for 1 year and just renewed it last week. I could never send an email from my Mail App without a window popping up stating "izymail cannot connect to the server" and the sending bar (along the bottom of the screen) just freezes and will not send.
    I've a Hotmail account linked up to izymail. Anyone know how to fix this problem?

    I fixed my problem - I deleted my email account on my iPhone, then tried to setup a new account. I had a few problems setting it up. It wouldn't recognize the incoming or outgoing servers and I lost my email altogether for a few hours. Then I changed every setting possible and finally figured out that I had 2-3 "Other SMTP Servers" as well as my "Primary Server". Once I deleted the Other SMTP Servers, my email worked and i'm able to send emails now!
    I also think changing the "Server Port" number helped solve my problem also, and making sure "Use SSL" was turned off.

Maybe you are looking for

  • How can I include multiple hyperlinks in an ical entry?

    When I create an event in ical, I can add one hyperlink. I'd like to add more than one. I have searched for info on this, but the best I've found is here. Using Option-Return to go to a new line doesn't work.  I can put multiple urls in that way, but

  • KO8G - Internal Order will not settle

    While trying to settle out internal orders in KO8G for closing, this Error appeared: NA FF716 Error in assigning the tax group I searched that error message and found: "The symptom occurs if in the Customizing for Tax Jurisdiction, the country is not

  • Problem of Product Tree in Production Order

    Dear Experts, My query is related to product tree when i am trying to add production order then it will give me error that " Item already defined at a higher level in the Product Tree [ Production Order -Rows- Item No] [line : 1], ' Row no. 1]', [Mes

  • IPhone now listing numbers instead of names

    iPhone is now listing contact numbers instead of the names. Just started after new update installed? Ideas on changing back to names?

  • Final Cut X update: Sound effects disappeared after

    I just did the update to 10.1 and my iLife and Final Cut X sound effects dissapared from the program. I found them in my Finder but they dont' show in the browser in FInal Cut X. Help! Thank you