MailRecent

I recently upgraded my imac to OSX10.8.4 and the upgrade went smooth except for a few issues. We had problems with iphoto and the autocomplete address list on new mail.  I was able to resolve the iphoto issues by removing all the preferences but I have not been able to resolve the issue with auto-completing addresses in a new mail message.  Under Previous Recipients is blank, it does not add new recipients.
Here is what I've tried:
Delete the MailRecents-v4.abcdmr from ~/Library/Application Support/AddressBook
When I reopen mail and send a new message it does NOT recreate that file.
Delete the whole AddressBook directory and the com.apple.AddressBook.plist & com.apple.AddressBook.abd.plist files for address book out of preferences
When Address book restarts it recreats all the AddressBook directory and plist files fine. But when I go into Mail MailRecent is not recreated.
Restore MailRecent-v4.abcdmr from time machine but Previous Recipients is still blank
Ran Fix permissions from Disk Utility
I still can't get mail to use or recreate the MailRecent file, any suggestions?
I was able to get it working once by deleting all the AddressBook files and restoring from iTunes, but when we restarted the computer it was back to a blank Previous Recipients file.

Please follow these directions to delete the Mail "sandbox" folder.
Back up all data.
Triple-click the line below to select it:
~/Library/Containers/com.apple.mail
Right-click or control-click the highlighted line and select
Services ▹ Reveal
from the contextual menu.* A Finder window should open with a folder named "com.apple.mail" selected. If it does, move the selected folder — not just its contents — to the Desktop. Leave the Finder window open for now.
Quit and relaunch Mail, and test. If the problem is resolved, you may have to recreate some of your Mail settings. You can then delete the folder you moved and close the Finder window. If you still have the problem, quit Mail again and put the folder back where it was, overwriting the one that may have been created in its place. Post your results.
Caution: If you change any of the contents of the sandbox, but leave the folder itself in place, Mail may crash or not launch at all. Deleting the whole sandbox will cause it to be rebuilt automatically.
*If you don't see the contextual menu item, copy the selected text to the Clipboard (command-C). In the Finder, select
Go ▹ Go to Folder...
from the menu bar, paste into the box that opens (command-V). You won't see what you pasted because a line break is included. Press return.

Similar Messages

  • Finding mailrecent-v4.abcdmr in 10.8

    Hi there,
    I am hoping someone can help me,
    I am trying to export a large amount of recent email addresses from the autocomplete function in Mail 6.5 on osX 10.8.4. I understand that you could find a file named mailrecent-v4.abcdmr within /library/application support/addressbook/ directory, however I can't seem to find this directory.
    Is it something I am doing wrong or is it within a different location in 10.8?
    Any help would be great,
    Thanks a lot,

    The file is in the user account Library folder, not the /Library/ one. The path is
    ~/Library/Application Support/AddressBook/MailRecents-v4.abcdmr
    ~/Library is normally hidden. One way to get there is to hold down the option key when opening Finder's "Go" menu, or you can type command+shift+g while a Finder window is active & enter the path to the folder in the sheet that drops down.
    Message was edited by: R C-R

  • When sending email PO in a PDF attachment, the attachment can not be openen

    Hi all,
    We are trying to send an email with the PO in PDF format.  We got the email but the attachment can not be opened. 
    Error reads: Adobe could not open test.pdf because  it is either  not a supported file type  or because  the file has been damaged (for example , it was send as a email attachemnet and was not  correctly decoded).
    Could any body bring some light?   We know that everything in SCOT is fine because we can email the PO through configuration to the vendor without problem. It is just these extra copies that do not work.
    a) We are modifying our custom Print program to add the code below after closing the form.
    in few words:
    a) We are getting the OTF from closing the form.
    b) Converting the OTF to PDF
    c) Sending the PDF as attachment.
    data: lt_docs      TYPE TABLE OF docs.
    data: pdf_bytecount TYPE i.
    data: begin of pdfout occurs 0,
       tline type tline,
    end of pdfout.
    Ende Formulardruck --------------------------------------------------*
      CALL FUNCTION 'CLOSE_FORM'
           IMPORTING
                result = result
           tables
                otfdata = otf.
      IF RESULT-TDSPOOLID NE SPACE.
        SPOOLID = RESULT-TDSPOOLID.
        PERFORM PROTOCOL_UPDATE USING '320' SPOOLID SPACE SPACE SPACE.
      ENDIF.
      if result-userexit eq 'C' or
          result-userexit eq 'E'.
        retco = '9'.
      endif.
      CALL FUNCTION 'CONVERT_OTF_2_PDF'
        IMPORTING
          bin_filesize           = pdf_bytecount
        TABLES
          otf                    = otf
          doctab_archive         = lt_docs
          lines                  = pdfout
        EXCEPTIONS
          err_conv_not_possible  = 1
          err_otf_mc_noendmarker = 2
          OTHERS                 = 3.
    Creation of the document to be sent File Name
       maildata-obj_name = 'TEST'.
    Mail Subject
       maildata-obj_descr = 'Subject'.
    Mail Contents
       append mailtxt.
      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.
    Move OTF code to structure SOLI form email
    CLEAR solisti1. REFRESH solisti1.
    LOOP AT otf.
      solisti1-line = otf.
      APPEND solisti1.
    ENDLOOP.
    Move pdf code to structure soli form email
      clear solisti1. refresh solisti1.
      loop at pdfout.
        solisti1-line = pdfout.
        append solisti1.
      endloop.
      loop at solisti1.
         move-corresponding solisti1 to mailbin.
         append mailbin.
      endloop.
      describe table mailbin lines tab_lines.
    mailhead = 'TEST.OTF'.
      mailhead = 'TEST.PDF'.
      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-doc_type = 'PDF'.
      mailpack-obj_name = 'TEST'.
      mailpack-obj_descr = 'Subject'.
      mailpack-doc_size = tab_lines * 255.
      append mailpack.
      mailrec-receiver = '[email protected]'.
      mailrec-rec_type = 'U'.
      append mailrec.
      mailrec-receiver = '[email protected]'.
      mailrec-rec_type = 'U'.
      append mailrec.
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
              EXPORTING
                   DOCUMENT_DATA              = maildata
              TABLES
                   PACKING_LIST               = mailpack
                   OBJECT_HEADER              = mailhead
                   CONTENTS_TXT               = mailtxt
                   RECEIVERS                  = mailrec
              EXCEPTIONS
                   TOO_MANY_RECEIVERS         = 1
                   DOCUMENT_NOT_SENT          = 2
                   DOCUMENT_TYPE_NOT_EXIST    = 3
                   OPERATION_NO_AUTHORIZATION = 4
                   PARAMETER_ERROR            = 5
                   X_ERROR                    = 6
                   ENQUEUE_ERROR              = 7
                   OTHERS                     = 8.
    ENDFORM.

    Dear Monica,
      You need to configure the system with respect to functional point of view and need to write the following code in print program. i have done this and solution is as follows.
    <b>  Reward me for this solution.</b>
    Process 11 (MM)     Sending RFQs and POs to vendors directly from the system instead of sending thru Courier or Fax     
    Existing Process (AS-IS)     Presently system is not supporting this requirement
    Business Requirements     RFQ’s to be linked with vendor master with e-mail to send enquiries directly through system instead of courier/fax. Vice versa P.O’s.  Specifications, drawings should also go to vendor along with mail.
    To-Be     
    Configuration Settings:                  
    1) Spro – Materials management – Purchasing – Messages – Output control – Message types – Define message types for RFQ/ PO
    •     Created ZEK1,ZMI and ZEK2 for RFQs
    •     Created ZIK,ZOC,ZOK,ZOM,ZSI, ZSK2 and ZSM for Pos
    •     The above New output types Included with existing Print Forms and Programs but modified with External send(5) medium, and added company’s letter head thru ABAP developments (details provided below)
    •     The above new output types also maintained for Fine- tuned control (thru same navigation) for New(1) and Change(2) operations
          2) Spro – Materials management – Purchasing – Messages – Output control – Message   determination schemas – Define message schema for RFQ/ PO
    •     Maintained the new output types in the control data
    3)     Maintain Condition records for the New out put types (copied same document types from the existing old output types)
    Easy access – Logistics – Materials management – Purchasing – Master data – Messages – MN01 (for RFQs)/ MN04 (for Pos)
    4)     Maintain Email id of Vendor in Vendor master.
    Developments (ABAP):
    1)  Copied the existing print programs and forms of the corresponding out types.
    2) Addition of header window in each corresponding form (HEADER window). Uploaded the HEADER3 graphics in the header window.
    INCLUDE HEADER3 OBJECT GRAPHICS ID BCOL LANGUAGE EN
    3) Added the the following code in TOP includes
                       TYPE-POOLs szadr.
               INCLUDE:  LMEDRUCKF09.
    data: intnast         LIKE snast,
          lvs_recipient   LIKE swotobjid,       "Internet
          lvs_sender      LIKE swotobjid,       "Internet
          lvs_comm_type   TYPE ad_comm,
          lvs_comm_values TYPE szadr_comm_values,
          p_retco         TYPE i.
    5)     Addition of the perform to SOS include for header window display
           PERFORM WRITE_FORM_HEADER.
    *&      Form  WRITE_FORM_HEADER
          text
    -->  p1        text
    <--  p2        text
    FORM WRITE_FORM_HEADER.
    CALL FUNCTION 'WRITE_FORM'
    EXPORTING
       ELEMENT                        = 'HE1'
       FUNCTION                       = 'SET'
       TYPE                           = 'BODY'
       WINDOW                         = 'HEADER'
    IMPORTING
       PENDING_LINES                  =
    EXCEPTIONS
       ELEMENT                        = 1
       FUNCTION                       = 2
       TYPE                           = 3
       UNOPENED                       = 4
       UNSTARTED                      = 5
       WINDOW                         = 6
       BAD_PAGEFORMAT_FOR_PRINT       = 7
       SPOOL_ERROR                    = 8
       CODEPAGE                       = 9
       OTHERS                         = 10
    ENDFORM.
    6)     In the corresponding FORM include the following code has been added.
    DATA:  lvs_comm_type     TYPE   ad_comm,
            lvs_comm_values   TYPE   szadr_comm_values,
            xprogramm         type   sy-repid.
      ... use stratagy to get communication type
          CALL FUNCTION 'ADDR_GET_NEXT_COMM_TYPE'
               EXPORTING
                    strategy           = nast-tcode
                    address_number     = lfa1-adrnr
               IMPORTING
                    comm_type          = lvs_comm_type
                    comm_values        = lvs_comm_values
               EXCEPTIONS
                    address_not_exist  = 1
                    person_not_exist   = 2
                    no_comm_type_found = 3
                    internal_error     = 4
                    parameter_error    = 5
                    OTHERS             = 6.
          IF sy-subrc <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
               WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
          ENDIF.
    convert communication data
          MOVE-CORRESPONDING nast TO intnast.
          MOVE sy-repid           TO xprogramm.
    7) By using the function module we can get sender and reciepient mail ids to variables lvs_recipient    lvs_sender
          CALL FUNCTION 'CONVERT_COMM_TYPE_DATA'
               EXPORTING
                    pi_comm_type              = lvs_comm_type
                    pi_comm_values            = lvs_comm_values
                    pi_country                = lfa1-land1
                    pi_repid                  = xprogramm
                    pi_snast                  = intnast
               IMPORTING
                    pe_itcpo                  = itcpo
                    pe_device                 = xdevice
                    pe_mail_recipient         = lvs_recipient
                    pe_mail_sender            = lvs_sender
               EXCEPTIONS
                    comm_type_not_supported   = 1
                    recipient_creation_failed = 2
                    sender_creation_failed    = 3
                    OTHERS                    = 4.
          IF sy-subrc <> 0.
          Avoids cancellation with message TD421
            p_retco = '1'.                                           "831984
            PERFORM protocol_update USING '740' space space space space.
          dummy message to make the message appear in the where-used list
            IF 1 = 2.
              MESSAGE S740(me).
            ENDIF.
            EXIT.
          ENDIF.
          IF xdevice = 'MAIL'.                                       "885787
        Check validity of email address to avoid cancellation with TD463
            CALL FUNCTION 'SX_ADDRESS_TO_DEVTYPE'                    "831984
              EXPORTING
                recipient_id            = lvs_recipient
                sender_id               = lvs_sender
              EXCEPTIONS
                err_invalid_route       = 1
                err_system              = 2
                OTHERS                  = 3.
            IF SY-SUBRC <> 0.
              p_retco = '1'.
              PERFORM protocol_update USING '740' space space space space.
           dummy message to make the message appear in the where-used list
              IF 1 = 2.
                MESSAGE S740(me).
              ENDIF.
              EXIT.
            ENDIF.
          ENDIF.
    8)     Attaching the new print program and form in NACE transaction.
    Steps for End user:
    1)     Creating the Purchase Order or RFQ with suitable document type through ME21N or ME41 .
    2)     Executing the transaction ME9F and in selecting the suitable output type.
    3)     Executing the transaction ZSEND_PDOC using INT as input.
    4) With above steps we can able to send purchase order or RFQ to vendor as an attachment through e-mail in PDF format.
    Regards
    Badari

  • Convert an already created pdf to otf

    i made an report that takes some pdf from sapscript and takes the otf's and send them as email attachement.
    Now i want to incude one more pdf to the same email that is already created and i store it to my fileserver . How can i do this ?
    REPORT  YDP_SEND_ALL_DOCS_EMAIL.
    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.
    TABLES: LIPS,
            LIKP,
            LFA1,
            KNA1,
            ADR6,
            VBKD,
            VBPA,
            VBAK,
            VBRK,
            VBRP,
            MARA,
            T005T,
            VBFA.
    DATA : BEGIN OF ITAB OCCURS 0,
            VBELN       LIKE VBRK-VBELN,  "billing doc
            NAME1       LIKE KNA1-NAME1,  "Customer name
            SMTP_ADDR      LIKE ADR6-SMTP_ADDR,
            END OF ITAB.
    DATA: MY_OPTIONS TYPE ITCPO.
    SELECTION-SCREEN BEGIN OF BLOCK B0 WITH FRAME TITLE TEXT-001.
    PARAMETERS: SVBELN TYPE VBRK-VBELN.
    PARAMETERS: SNAME TYPE KNA1-NAME1.
    PARAMETERS: S_EMAIL TYPE ADR6-SMTP_ADDR.
    SELECTION-SCREEN SKIP 2.
    PARAMETERS: SUBJ(30) TYPE C.
    SELECTION-SCREEN SKIP 2.
    PARAMETERS: LINE1 LIKE MAILTXT-LINE.
    PARAMETERS: LINE2 LIKE MAILTXT-LINE.
    PARAMETERS: LINE3 LIKE MAILTXT-LINE.
    PARAMETERS: LINE4 LIKE MAILTXT-LINE.
    PARAMETERS: LINE5 LIKE MAILTXT-LINE.
    PARAMETERS: LINE6 LIKE MAILTXT-LINE DEFAULT 'The following PDF are produced by SAP and are digitally signed .'.
    SELECTION-SCREEN END OF BLOCK B0.
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-002.
    PARAMETERS: YHSD AS CHECKBOX DEFAULT 'X'.
    PARAMETERS: ZHAG AS CHECKBOX DEFAULT 'X'.
    PARAMETERS: ZPHL AS CHECKBOX DEFAULT 'X'.
    SELECTION-SCREEN END OF BLOCK B1.
    AT SELECTION-SCREEN OUTPUT.
      LOOP AT SCREEN.
        IF SCREEN-NAME = 'S_EMAIL'.
          SCREEN-INPUT = 0.
          SCREEN-INTENSIFIED = 0.
          MODIFY SCREEN.
          EXIT.
        ENDIF.
      ENDLOOP.
      LOOP AT SCREEN.
        IF SCREEN-NAME = 'SNAME'.
          SCREEN-INPUT = 0.
          SCREEN-INTENSIFIED = 0.
          MODIFY SCREEN.
          EXIT.
        ENDIF.
      ENDLOOP.
    AT SELECTION-SCREEN.
      SELECT SINGLE * FROM VBRK WHERE VBELN = SVBELN.
      IF SY-SUBRC = 0.
        SELECT SINGLE * FROM KNA1 WHERE KUNNR = VBRK-KUNRG.
        SNAME = KNA1-NAME1.
        SELECT SINGLE * FROM ADR6 WHERE ADDRNUMBER = KNA1-ADRNR.
        IF SY-SUBRC = 0 .
          S_EMAIL = ADR6-SMTP_ADDR.
        ELSE.
          S_EMAIL = 'No Email Address !!!!'.
        ENDIF.
      ELSE.
        S_EMAIL = 'No Email Address !!!!'.
      ENDIF.
    START-OF-SELECTION.
      PERFORM SEND_FORM_VIA_EMAIL.
    *&      Form  WRITE_FORM
          text
         -->P_WIN      text
         -->P_TYPE     text
         -->P_EL       text
         -->P_FUN      text
    FORM WRITE_FORM USING P_WIN P_TYPE P_EL P_FUN.
      CALL FUNCTION 'WRITE_FORM'
        EXPORTING
          ELEMENT                  = P_EL
          FUNCTION                 = P_FUN
          TYPE                     = P_TYPE
          WINDOW                   = P_WIN
       IMPORTING
         PENDING_LINES            =
       EXCEPTIONS
          ELEMENT                  = 1
          FUNCTION                 = 2
          TYPE                     = 3
          UNOPENED                 = 4
          UNSTARTED                = 5
          WINDOW                   = 6
          BAD_PAGEFORMAT_FOR_PRINT = 7
          SPOOL_ERROR              = 8
          CODEPAGE                 = 9
          OTHERS                   = 10.
      IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                    "WRITE_FORM
    *&      Form  CLOSE_FORM
          text
    FORM CLOSE_FORM.
      CALL FUNCTION 'CLOSE_FORM'
         IMPORTING
              RESULT                   = ITCPP
              RDI_RESULT               =
          TABLES
               OTFDATA                  = OTF
           EXCEPTIONS
                UNOPENED                 = 1
                BAD_PAGEFORMAT_FOR_PRINT = 2
                SEND_ERROR               = 3
                OTHERS                   = 4.
    ENDFORM.                    " CLOSE_LAYOUT_DSS
    *&      Form  GET_DATA
          text
    FORM GET_DATA.
      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'.
      PERFORM COLLECT_DATA(YHAL_SHIPPING_DETAILS) USING SVBELN."VBRK-VBELN.
      CALL FUNCTION 'OPEN_FORM'
        EXPORTING
          FORM     = 'YHAL_SHIP_DETAIL'
          LANGUAGE = SY-LANGU
          OPTIONS  = ITCPO
          DIALOG   = ' '
        EXCEPTIONS
          OTHERS   = 1.
      PERFORM DISPLAY_DATA(YHAL_SHIPPING_DETAILS) USING SVBELN." VBRK-VBELN.
    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.                    "GET_DATA
    *&      Form  GET_DATA1
          text
    FORM GET_DATA1.
      DATA: BEGIN OF OTF OCCURS 0.
              INCLUDE STRUCTURE ITCOO .
      DATA: END OF OTF.
      DATA: ITCPO LIKE ITCPO.
      DATA: ITCPP LIKE ITCPP.
      CLEAR OTF.
      CLEAR ITCPO.
      ITCPO-TDGETOTF = 'X'.
      PERFORM COLLECT_DATA(Z111_PACKING_LIST) USING SVBELN."VBRK-VBELN.
      CALL FUNCTION 'OPEN_FORM'
        EXPORTING
          FORM     = 'Z1111_PACKING'
          LANGUAGE = SY-LANGU
          OPTIONS  = ITCPO
          DIALOG   = ' '
        EXCEPTIONS
          OTHERS   = 1.
      PERFORM DISPLAY_DATA(Z111_PACKING_LIST). "USING SVBELN." VBRK-VBELN.
    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.                                                    "GET_DATA1
    *&      Form  GET_DATA2
          text
    FORM GET_DATA2.
      DATA: BEGIN OF OTF OCCURS 0.
              INCLUDE STRUCTURE ITCOO .
      DATA: END OF OTF.
      DATA: ITCPO LIKE ITCPO.
      DATA: ITCPP LIKE ITCPP.
      CLEAR OTF.
      CLEAR ITCPO.
      ITCPO-TDGETOTF = 'X'.
      PERFORM COLLECT_DATA(Z111_AGENCY_NOTE) USING SVBELN."VBRK-VBELN.
      CALL FUNCTION 'OPEN_FORM'
        EXPORTING
          FORM     = 'Z1111_AGENCY'
          LANGUAGE = SY-LANGU
          OPTIONS  = ITCPO
          DIALOG   = ' '
        EXCEPTIONS
          OTHERS   = 1.
      PERFORM DISPLAY_DATA(Z111_AGENCY_NOTE) USING SVBELN." VBRK-VBELN.
    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.                                                    "GET_DATA2
          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 = SUBJ ."'EGGRAFA BIBLOY'.
    Mail Contents
      MAILTXT-LINE = LINE1.
      APPEND MAILTXT.
      MAILTXT-LINE = LINE2.
      APPEND MAILTXT.
      MAILTXT-LINE = LINE3.
      APPEND MAILTXT.
      MAILTXT-LINE = LINE4.
      APPEND MAILTXT.
      MAILTXT-LINE = LINE5.
      APPEND MAILTXT.
      MAILTXT-LINE = LINE6.
      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.
      COMMIT WORK.
    ENDFORM.                    "SEND_FORM_VIA_EMAIL
         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.
      IF YHSD = 'X' .
        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.
      ENDIF.
    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 = 'TEST01'.
    MAILPACK-OBJ_DESCR = 'Subject01'.
    MAILPACK-DOC_SIZE = TAB_LINES * 255.
    APPEND MAILPACK.
      IF ZHAG = 'X'.
        PERFORM GET_OTF_CODE1.      "----
        LOOP AT SOLISTI1.
          MOVE-CORRESPONDING SOLISTI1 TO MAILBIN.
          APPEND MAILBIN.
        ENDLOOP.
        DESCRIBE TABLE MAILBIN LINES TAB_LINES.
        MAILHEAD = 'TEST1.OTF'.
        APPEND MAILHEAD.
      ENDIF.
    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 = 'TEST02'.
    MAILPACK-OBJ_DESCR = 'Subject02'.
    MAILPACK-DOC_SIZE = TAB_LINES * 255.
    APPEND MAILPACK.
      IF ZPHL = 'X'.
        PERFORM GET_OTF_CODE2.      "----
        LOOP AT SOLISTI1.
          MOVE-CORRESPONDING SOLISTI1 TO MAILBIN.
          APPEND MAILBIN.
        ENDLOOP.
        DESCRIBE TABLE MAILBIN LINES TAB_LINES.
        MAILHEAD = 'TEST2.OTF'.
        APPEND MAILHEAD.
      ENDIF.
    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 = 'TEST03'.
      MAILPACK-OBJ_DESCR = 'Ship.details-Agency.report-Packing.list'.
      MAILPACK-DOC_SIZE = TAB_LINES * 255.
      APPEND MAILPACK.
    ENDFORM.                    "PREPARE_PACKING_LIST
         Form  GET_OTF_CODE
    FORM  GET_OTF_CODE.
      PERFORM GET_DATA.
    ENDFORM.                    "GET_OTF_CODE
         Form  GET_OTF_CODE1
    FORM  GET_OTF_CODE1.
      PERFORM GET_DATA1.
    ENDFORM.                    "GET_OTF_CODE1
         Form  GET_OTF_CODE2
    FORM  GET_OTF_CODE2.
      PERFORM GET_DATA2.
    ENDFORM.                    "GET_OTF_CODE2
    END-OF-SELECTION.

    Hi Dimath,
    Try the following FM:
    CONVERT_OTF Convert SAP documents (SAPScript) to other types.
    Example:
    CALL FUNCTION "CONVERT_OTF"
           EXPORTING    FORMAT                = "PDF"
           IMPORTING    BIN_FILESIZE          = FILE_LEN
           TABLES       OTF                   = OTFDATA
                        LINES                 = PDFDATA
           EXCEPTIONS   ERR_MAX_LINEWIDTH     = 1                  
                        ERR_FORMAT            = 2
                        ERR_CONV_NOT_POSSIBLE = 3
                        OTHERS                = 4.
    Hope this helps.
    Reward if helpful.
    Regards,
    Sipra

  • Send email from PA30 user exit

    When I try to send an email from user exit in ZXPADU02 it never makes it to SOST.  WIll always go to SBWP outbox if I set the flag but never gets sent to receiver address.
    If I paste the following code into a report it works fine.  Is there some other parameter for this FM or some additional process needed to send email from a user exit?
        DATA: maildata TYPE sodocchgi1.
        DATA: mailtxt  TYPE TABLE OF solisti1 WITH HEADER LINE.
        DATA: mailrec  TYPE TABLE OF somlrec90 WITH HEADER LINE.
          CLEAR maildata.
          REFRESH: mailtxt, mailrec.
          maildata-obj_name = 'SRVC_EMAIL'.
          maildata-obj_descr = 'Email test'.
          maildata-obj_langu = sy-langu.
          mailtxt-line = 'Test line from user exit'.
          APPEND mailtxt.
          mailrec-receiver = '[email protected]'.
          mailrec-rec_type  = 'U'.
          APPEND mailrec.
          CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
            EXPORTING
              document_data              = maildata
              document_type              = 'RAW'
              put_in_outbox                = 'X'
              commit_work                  = 'X'
            TABLES
              object_header                = mailtxt
              object_content               = mailtxt
              receivers                       = mailrec
            EXCEPTIONS
              too_many_receivers            = 1
              document_not_sent            = 2
              document_type_not_exist    = 3
              operation_no_authorization  = 4
              parameter_error                  = 5
              x_error                              = 6
              enqueue_error                    = 7
              others                           = 8.

    Put the function call 'SO_NEW_DOCUMENT_SEND_API1'
    in a report Program & SUBMIT that report from ZXPADU02.
    Arya

  • Sending HTML mail doesn't work

    Hi experts,
    I'm trying to send an HTML eMail by using function module 'SO_NEW_DOCUMENT_SEND_API1'.
    Without success! When I debug the code, the format os switched from HTM to RAW and I have no clue why.
    Here's my code:
    data objpack like sopcklsti1 occurs  2 with header line.
      data objhead like solisti1   occurs  1 with header line.
      data objbin  like solisti1   occurs 10 with header line.
      data objtxt  like solisti1   occurs 10 with header line.
      DATA ls_doc_send  TYPE sodocchgi1.
      ls_doc_send-obj_name = 'Exp.Auth. Notif.'.
      ls_doc_send-obj_descr = 'Expiring Authentication Notification'.
      ls_doc_send-sensitivty = 'O'.
      ls_doc_send-obj_langu = 'E'.
      DESCRIBE TABLE i_mailtext LINES lv_int_send.
      READ TABLE i_mailtext into lv_last_line INDEX lv_int_send.
      ls_doc_send-doc_size = ( lv_int_send - 1 ) * 255 + STRLEN( lv_last_line ).
      CLEAR objpack-transf_bin.
    *  objpack-transf_bin = 'X'.
      objpack-head_start = 1.
      objpack-head_num   = 0.
      objpack-body_start = 1.
      DESCRIBE TABLE i_mailtext LINES tab_lines.
      objpack-body_num   = tab_lines.
      objpack-doc_type   = 'HTM'.
      objpack-doc_size   = ls_doc_send-doc_size.
      APPEND objpack.
    CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
        EXPORTING
         document_data                    = ls_doc_send
         document_type                    = 'HTM'
         PUT_IN_OUTBOX                    = 'X'
         commit_work                      = 'X'
    * IMPORTING
    *   SENT_TO_ALL                      =
    *   NEW_OBJECT_ID                    =
        TABLES
         object_header                    = objhead
         object_content                   = i_mailtext
    *     CONTENTS_HEX                     = i_mailtext
    *   OBJECT_PARA                      =
    *   OBJECT_PARB                      =
          receivers                        = i_receiver
       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.
    The parameter i_Mailtext is the prepared HTML document. Do oyu know which HTML elements/tags are mandatory?
    objhead and objbin are not set, should I?
    Thanks and regards,
    Steffen

    Hi,
    try This u ill get some idea ..
    data: maildata   like sodocchgi1.
    data: mailtxt    like solisti1 occurs 10 with header line.
    data: mailrec    like somlrec90 occurs 0  with header line.
    start-of-selection.
      clear:    maildata, mailtxt,  mailrec.
      refresh:  mailtxt, mailrec.
    submit ztestalv02 and return.
    call function 'SO_NEW_DOCUMENT_SEND_API1'
           exporting
                document_data              = maildata
                document_type              = 'HTM'
                put_in_outbox              = 'X'
           tables
                object_header              = mailtxt
                object_content             = mailtxt
                receivers                  = mailrec
           exceptions
                too_many_receivers         = 1
                document_not_sent          = 2
                document_type_not_exist    = 3
                operation_no_authorization = 4
                parameter_error            = 5
                x_error                    = 6
                enqueue_error              = 7
                others                     = 8.
      if sy-subrc = 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      endif.
    Regards...
    if not let me know.

  • Driver Program of Smartform

    Hi Folks,
    Can any body post the sample driver program of smart form? I need the same to call a smartform which created.
    thanks
    Siddarth

    Hi,
    Check this....
    *& Report  ZSEND_PDF_EMAIL
    REPORT  zsend_pdf_email.
    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              = 'X'
        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.
    commit work.
    ENDFORM.                    "SEND_FORM_VIA_EMAIL
    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.                    "PREPARE_PACKING_LIST
    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.
      data control type SSFCTRLOP.
      data output type SSFCOMPOP.
      data otfdata type SSFCRESCL.
      control-getotf = 'X'.
      OUTPUT-TDDEST = 'Lp01'.
    control-DEVICE = 'LOCL'.
      control-NO_DIALOG = 'X'.
      CLEAR itcpo.
      itcpo-tdgetotf = 'X'.
    CALL FUNCTION '/1BCDWB/SF00000279'
    EXPORTING
       CONTROL_PARAMETERS         = control
       OUTPUT_OPTIONS             = output
       USER_SETTINGS              = ' '
    IMPORTING
      DOCUMENT_OUTPUT_INFO       =
       JOB_OUTPUT_INFO            = otfdata
      JOB_OUTPUT_OPTIONS         =
    EXCEPTIONS
       FORMATTING_ERROR           = 1
       INTERNAL_ERROR             = 2
       SEND_ERROR                 = 3
       USER_CANCELED              = 4
       OTHERS                     = 5.
    IF sy-subrc <> 0.
    ENDIF.
    Move OTF code to structure SOLI form email
      CLEAR solisti1. REFRESH solisti1.
      LOOP AT otfdata-otfdata into otf.
        solisti1-line = otf.
        APPEND solisti1.
      ENDLOOP.
    ENDFORM.                    "GET_OTF_CODE
    Regards,
    Sankar

  • Send sapscript to customer

    Hi,
    could I use the function USE_SEND_OBJECT to send a sapscript (an invoice) to an external mail (customer email) ?
    Thanks!!!!

    Hi Juan
    Go through the follwoing Code
    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 = 'ZTEST_FORM'
    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 this links
    SAPscript: Sending mail from Sapscript in 4.7
    Script- converting in PDF and sending by mail.
    Reward all helpfull answers
    regards
    Pavan

  • HAving issues in sending txt attachment in abap email pgm

    Hi,
        I need to send an email from my Abap program with a txt attachment in the flowing format:
    We are glad to see these results
    Kindly forward the details                                        Number
    Vendor details:123
    However, this is not getting formatted properly and the txt file is getting unnessacary spaces. I am working in ECC 6 and is Unicode complaint.
    I am not able to format this in the txt attachment.
    I am providing the sample code as below.Please kindly help me.Thanks!
    Creation of the document to be sent File Name
      maildata-obj_name = 'Payee extraction data'. "EC NOTEXT
    Mail Subject
      maildata-obj_descr = 'Payee Positive pay'. "EC NOTEXT
    Mail Contents
      loop at lt_file into l_file.
        mailtxt-line = l_file.
      xtex1-line = l_file.
      append xtex1.
        append mailtxt.
      endloop.
      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 = 'PayeePositivepay.txt'.
      append mailhead.
    Mail Contents
      loop at lt_file into l_file.
        mailbin-line = l_file.
        append mailbin.
      endloop.
    break-point.
      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 = 'payee'.
      mailpack-obj_descr = 'Subject'. "EC NOTEXT
      mailpack-doc_size = tab_lines * 140.
      append mailpack.
    Get the neccessary email ids from the table
      SELECT * FROM ZFI_EMAILIDS INTO table I_ZFI_EMAILIDS.
      LOOP AT I_ZFI_emailids.
        mailrec-receiver = i_zfi_emailids-zemailid .
        mailrec-rec_type  = 'U'.
        mailrec-com_type = 'INT'.
        mailrec-notif_del = 'X'.
        mailrec-notif_ndel = 'X'.
        mailrec-express = 'X'.
        append mailrec.
      endloop.
    Sending the document
      call function 'SO_NEW_DOCUMENT_ATT_SEND_API1'
        EXPORTING
          document_data              = maildata
          put_in_outbox              = 'X'
          commit_work                = 'X'
        TABLES
          packing_list               = mailpack
          object_header              = mailhead
          contents_bin               = mailbin[]
          contents_txt               = mailtxt
         CONTENTS_HEX               = xtex
          receivers                  = mailrec
        EXCEPTIONS
          too_many_receivers         = 1
          document_not_sent          = 2
          operation_no_authorization = 4
          others                     = 99.
    endform.                    "send_email

    Hi,
    You need to use attribute CL_ABAP_CHAR_UTILITIES=> NEWLINE or CR to use format the mail contents.

  • Error while sending PDF file by Email

    Hi All,
    I have a requirement to send multiple files by Email attachement from SAP to internet address.
    All files sent correctly, except one PDF file.
    I have 2 spools, and I am using FM CONVERT_OTFSPOOLJOB_2_PDF to get PDF data for Spool.
    Then I am converting the 134 length PDF data to 255 Email Attachement binary table.
    Now I have 2 file F1.PDF and F2.PDF, in SAP Office outbox and in receivers email, F2.PDF opening fine, however for F1.PDF I am getting some error no 109 in Adobe, which says "There was an error processing a page.There was a problem reading this document. (109)".
    Please help in figuring out the reason for this.
    Additional Information F2.PDF has some text data (SAP Script output) and F1.PDF has some text data with logo (SAP Script Output)
    Thanks in advance

    hi check out following code..
    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.
    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 = 'ZTEST_FORM'
    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.

  • Unable to e-mail a pdf  through FM  'SO_NEW_DOCUMENT_ATT_SEND_API1'

    Hi
    My requirement is to send purchase order pdf to vendor mail id.i am able to create pdf . i am using function module sO_NEW_DOCUMENT_ATT_SEND_API1.I am not getting any error as my sy-subrc returns 0 but my mail is not sent to vendor email id.can anybody please help me in solving this problem i am pasting my code here. i am passing commit_work = 'X'
    and afterwords i am writing commit work .
    if i didnt write commit work my function module is returning sy-subrc 2.
    thanks in advance
    regards,
    kiran malepati.
    CALL FUNCTION 'CLOSE_FORM'
    IMPORTING
      RESULT                         = ITCPP
      RDI_RESULT                     =
    TABLES
      OTFDATA                        = OTF
    EXCEPTIONS
      UNOPENED                       = 1
      BAD_PAGEFORMAT_FOR_PRINT       = 2
      SEND_ERROR                     = 3
      SPOOL_ERROR                    = 4
      CODEPAGE                       = 5
      OTHERS                         = 6
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    CLEAR SOLISTI1. REFRESH SOLISTI1.
    LOOP AT OTF.
    SOLISTI1-LINE = OTF.
    APPEND SOLISTI1.
    ENDLOOP.
    perform pdfconversion.
    form pdfconversion.
    CALL FUNCTION 'CONVERT_OTF_2_PDF'
    EXPORTING
      USE_OTF_MC_CMD               = 'X'
      ARCHIVE_INDEX                =
    IMPORTING
       BIN_FILESIZE                 = NOOFLINES
      TABLES
        OTF                          = OTF
        DOCTAB_ARCHIVE               = DOCS
        LINES                        = PDF_LINES
    EXCEPTIONS
      ERR_CONV_NOT_POSSIBLE        = 1
      ERR_OTF_MC_NOENDMARKER       = 2
      OTHERS                       = 3
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    PERFORM SEND_FORM_VIA_EMAIL.
          wait up to 2 seconds.
          SUBMIT rsconn01 WITH mode   = 'INT'
                         WITH output = 'X'
                          AND RETURN.
    endform.
    FORM SEND_FORM_VIA_EMAIL.
    CLEAR: MAILDATA, MAILTXT, MAILBIN, MAILPACK, MAILHEAD,
    MAILREC.
    REFRESH: MAILTXT, MAILBIN, MAILPACK, MAILHEAD,
    MAILREC.
    select addrnumber consnumber smtp_addr
           from adr6
           into table iaddress
           for all entries in ilfa1
           where addrnumber = ilfa1-adrnr.
    loop at iaddress.
    WORK-L_EMAIL = iaddress-smtp_addr.
    endloop.
    MAILDATA-OBJ_NAME = 'TEST'.
    MAILDATA-OBJ_DESCR = 'Subject'.
    MAILDATA-OBJ_LANGU = SY-LANGU.
    MAILDATA-SENSITIVTY = 'F'.
    MAILTXT-LINE = 'Here is your file'.
    APPEND MAILTXT.
    PERFORM PREPARE_PACKING_LIST.
    *REFRESH RECEIVER.
    CLEAR RECEIVER.
    MOVE: SY-UNAME TO RECEIVER-RECEIVER,
          'X'      TO RECEIVER-EXPRESS,
          'B'      TO RECEIVER-REC_TYPE.
    APPEND RECEIVER.
    MAILREC-RECEIVER = WORK-L_EMAIL.
    MAILREC-REC_TYPE = 'U'.
    MAILREC-COM_TYPE = 'INT'.
    MAILREC-EXPRESS = C_X.
    *MAILREC-COPY =  C_X.
    APPEND MAILREC.
    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
    EXPORTING
    DOCUMENT_DATA = MAILDATA
    PUT_IN_OUTBOX = 'X'
    COMMIT_WORK = 'X'
    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.
    commit work.(if i didnt write this stmt it is returning sy-subrc = 2.)
    write : / sy-subrc.
    CASE SY-SUBRC.
    WHEN 0.
        WRITE: / 'Result of the send process:'.
        LOOP AT mailrec.
          WRITE: / mailrec-RECEIVER(48), ':'. ("here i am getting 69 as return value)
    write : / sy-subrc.( returning 0)
    write : / mailrec-retrn_code.
          IF mailrec-RETRN_CODE = 0.
            WRITE 'sent successfully'.
           endif.
           ENDLOOP.
      WHEN 1.
        WRITE: / 'no authorization to send to the specified number of recipients!'.
      WHEN 2.
        WRITE: / 'document could not be sent to any of the recipients!'.
      WHEN 4.
        WRITE: / 'no authorization to send !'.
      WHEN OTHERS.
        WRITE: / 'error occurred during sending !'.
    ENDCASE.
    ENDFORM.
    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 ).
    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.
    *perform get_otf data.
    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.

    Hi,
    RSTXPDFT4 is the standard SAP program to convert to PDF format.
    Check whether the settings below are there in your SAP system:
    In t.code SCOT you can set the format conversions by using menu path SETTINGS --> CONVERSIONS and specifying that your sapscript out put (I think SCR) should convert to PDF and then put in the appropriate Function module (try SX_OBJECT_CONVERT_SCR_PDF).
    You also have to allow PDF in the EXCHG node setup.
    Hope this helps.
    Thanks,
    Viswanath

  • How to send mail using HTML format using tags

    Hello experts,
    I am currently using FM SO_NEW_DOCUMENT_SEND_API1 to send e-mails to our users' Outlook accounts. Now, I converted its document type from 'RAW' to 'HTM'. I enclosed my texts in HTML tags. But the problem is, I cannot see a thing when I check my message in SCOT. It just opens internet explorer and thats it. Anyway, Below is my code:
    get e-mail addresses of controllers in table ZSHIPTO_EMAIL
      SELECT * FROM zshipto_email
      INTO TABLE it_zshipto_email
      WHERE zevent = '2'.
      IF sy-dbcnt > 0.
        IF NOT it_del_entries[] IS INITIAL.
          CLEAR lv_contents.
          maildata-obj_name  = 'Record Deleted in table ZTS0001'.
          maildata-obj_descr = 'Record Deleted in table ZTS0001'.
          maildata-obj_langu = sy-langu.
       records deleted in ZTS0001 and ZTS_STPGEOLOC
          CLEAR: lv_flag, lv_counter.
          LOOP AT it_zshipto_email.
            CLEAR: it_del_entries, mailtxt.
            LOOP AT it_del_entries ASSIGNING <fs_del_entries>.
            get name of dealer
              SELECT SINGLE name1 FROM kna1
              INTO <fs_del_entries>-name1
              WHERE kunnr = <fs_del_entries>-kunnr.
              IF lv_counter IS INITIAL.
                CONCATENATE: '<p>'
                             'FYI: The ff record/s were deleted in tables'
                             'ZTS0001 and ZTS_STPGEOLOC by user' sy-uname
                             '</p>'
                             INTO lv_contents
                             SEPARATED BY space.
                mailtxt-line = lv_contents.
                APPEND mailtxt.
                CLEAR: mailtxt, lv_contents.
              ENDIF.
              APPEND mailtxt.
              CONCATENATE: '<p>'
                           'Dealer :' <fs_del_entries>-kunnr '-'
                           <fs_del_entries>-name1 '</p>'
                           INTO lv_contents
                           SEPARATED BY space.
              mailtxt-line = lv_contents.
              APPEND mailtxt.
              CLEAR: mailtxt, lv_contents.
              CONCATENATE: '<p>'
                           'Ship-To:' <fs_del_entries>-cdseq '</p>'
                           INTO lv_contents
                           SEPARATED BY space.
              mailtxt-line = lv_contents.
              APPEND mailtxt.
              CLEAR: mailtxt, lv_contents.
              CONCATENATE: '<p>'
                           'Address:' <fs_del_entries>-zaddress '</p>'
                           INTO lv_contents
                           SEPARATED BY space.
              mailtxt-line = lv_contents.
              APPEND mailtxt.
              CLEAR: mailtxt, lv_contents.
              CONCATENATE: '<p>'
                           'Contact person:' <fs_del_entries>-zcperson
                           '</p>'
                           INTO lv_contents
                           SEPARATED BY space.
              mailtxt-line = lv_contents.
              APPEND mailtxt.
              CLEAR: mailtxt, lv_contents.
              CONCATENATE: '<p>'
                           'Contact number:' <fs_del_entries>-zcnumber
                           '</p>'
                           INTO lv_contents
                           SEPARATED BY space.
              mailtxt-line = lv_contents.
              APPEND mailtxt.
              CLEAR: mailtxt, lv_contents.
              lv_counter = 1.
            ENDLOOP.
            APPEND mailtxt.
            mailrec-receiver = it_zshipto_email-zemail.
            mailrec-rec_type  = 'U'.
            APPEND mailrec.
            CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
                 EXPORTING
                      document_data              = maildata
                      document_type              = 'HTM'
                      put_in_outbox              = 'X'
                      commit_work                = 'X'
                 TABLES
                     object_header              = mailtxt
                      object_content             = mailtxt
                      receivers                  = mailrec
                 EXCEPTIONS
                      too_many_receivers         = 1
                      document_not_sent          = 2
                      document_type_not_exist    = 3
                      operation_no_authorization = 4
                      parameter_error            = 5
                      x_error                    = 6
                      enqueue_error              = 7
                      OTHERS                     = 8.
            IF sy-subrc <> 0.
              MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                  WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
            ENDIF.
            CLEAR:    mailtxt, mailrec, lv_counter.
            REFRESH:  mailtxt, mailrec.
          ENDLOOP.
        ENDIF.
    Message was edited by: viraylab

    Hi,
    Check this...
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/5931ff64-0a01-0010-2bb7-ff2f9a6165a0
    Regards
    vijay

  • How to send html in an email (46C) using SO_NEW_DOCUMENT_SEND_API1

    I am having trouble sending an email so that it appears in HTML format, nice and pretty.  I have been experimenting with FM SO_NEW_DOCUMENT_SEND_API1 and ATTSEND_API1.  I have been able to successfully send an email to myself (using an email address outside of SAP), but all I see is the html source code.   If I set the DOC_TYP to "HTM", I get the error "Message cannot be processed as it cannot be converted.".  Below is my sample code.   Has anyone been able to do this in 46C ?
    Thanks,  Mark
    REPORT ZYR_EMAIL_TEST1 .
    * SAP 46C
    data: maildata   type sodocchgi1,
          mailhdr    type table of solisti1    with header line,
          mailtxt    type table of solisti1    with header line,
          mailbin    type table of solisti1    with header line,
          mailpack   type table of sopcklsti1  with header line,
          mailrec    type table of somlreci1   with header line,
          tab_lines  type i.
    define bld_txt.
         clear mailtxt.
         mailtxt = &1.
         append mailtxt.
    end-of-definition.
    define bld_bin.
         clear mailbin.
         mailbin = &1.
         append mailbin.
    end-of-definition.
    start-of-selection.
      clear:    maildata, mailhdr, mailtxt,  mailbin, mailrec, tab_lines.
      refresh:  mailhdr, mailtxt, mailbin, mailrec.
      perform build_header.
      perform build_message.
      perform build_pack_list.
      perform build_receivers.
      perform send_mail_nodialog..
    * Use form initiate_mail_execute_program OR process
    * with txn SCOT.  Check status of mail with txn SOST.
    *  perform initiate_mail_execute_program.
      write: / 'End of program.'.
    *      Form  BUILD_HEADER
    form build_header.
      maildata-obj_name   = 'Email_Name'.
      maildata-obj_descr  = 'Email_Description'.
    *  maildata-obj_langu  =
    *  maildata-obj_sort   =
      mailhdr  = 'MYTEST.HTM'.
      append mailhdr.
    endform.
    *      Form  BUILD_MESSAGE
    form build_message.
      bld_txt '<html>'.
      bld_txt '<head>'.
      bld_txt '<title>Untitled Document</title>'.
      bld_txt '<meta http-equiv="Content-Type" content="text/html;'.
      bld_txt 'charset=iso-8859-1">'.
      bld_txt '</head>'.
      bld_txt '<body>'.
      bld_txt '<div align="center"><em><font' .
      bld_txt 'color="#0000FF" size="+7" face="Arial,'.
      bld_txt 'Helvetica, sans-serif">THIS'.
      bld_txt '  IS A TEST </font></em><br><font' .
      bld_txt 'color="#0000FF" size="+7" face="Arial,'.
      bld_txt 'Helvetica, sans-serif">Yahoo</font>'.
      bld_txt '</div>'.
      bld_txt '</body>'.
      bld_txt '</html>'.
    * Doc_Size is length of last line + ( nbr of other lines x 255 ).
      describe table mailtxt lines tab_lines.
      read     table mailtxt index tab_lines.
      maildata-doc_size = ( ( tab_lines - 1 ) * 255 ) + strlen( mailtxt ).
    endform.
    *      Form  BUILD_PACK_LIST
    form build_pack_list.
      clear mailpack.
      refresh mailpack.
    *  mailpack-transf_bin = 'X'.
      mailpack-head_start = 1.
      mailpack-head_num = 0.
      mailpack-body_start = 1.
      describe table mailtxt lines tab_lines.
      mailpack-body_num = tab_lines.
      mailpack-doc_type = 'HTM'.
      append mailpack.
    endform.
    *      Form  BUILD_RECEIVERS
    form build_receivers.
      mailrec-receiver  = '[email protected]'.
      mailrec-rec_type  = 'U'.
      mailrec-com_type = 'INT'.
      append mailrec.
    endform.
    *      Form  SEND_MAIL
    form send_mail.
      call function 'SO_NEW_DOCUMENT_SEND_API1'
           exporting
                document_type              = 'HTM'
                document_data              = maildata
    *           put_in_outbox              = ' '
           tables
                object_header              = mailhdr
                object_content             = mailtxt
                receivers                  = mailrec
           exceptions
                too_many_receivers         = 1
                document_not_sent          = 2
                document_type_not_exist    = 3
                operation_no_authorization = 4
                parameter_error            = 5
                x_error                    = 6
                enqueue_error              = 7
                others                     = 8.
      if sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        write: / 'There was error.  sy-subrc = ', sy-subrc.
      endif.
    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.

    Yes, the OBJ_HTM function exists.  I found these also, that exist on our system.
    SX_OBJECT_CONVERT        
    SX_OBJECT_CONVERT_ALI_HTM
    SX_OBJECT_CONVERT_ALI_PRT
    SX_OBJECT_CONVERT_ALI_RAW
    SX_OBJECT_CONVERT_ALI_TXT
    SX_OBJECT_CONVERT_INT_RAW
    SX_OBJECT_CONVERT_OBJ_HTM
    SX_OBJECT_CONVERT_OBJ_R3O
    SX_OBJECT_CONVERT_OTF_PDF
    SX_OBJECT_CONVERT_OTF_PRT
    SX_OBJECT_CONVERT_OTF_RAW
    SX_OBJECT_CONVERT_RAW_SCR
    SX_OBJECT_CONVERT_RAW_TXT
    SX_OBJECT_CONVERT_SCR_OTF
    SX_OBJECT_CONVERT_TO_AFX 
    SX_OBJECT_CONVERT_TXT_INT
    And these are the entries I see in the SXCONVERT table:
    SX_OBJECT_CONVERT_ALI_HTM 
    SX_OBJECT_CONVERT_ALI_PRT 
    SX_OBJECT_CONVERT_ALI_RAW 
    SX_OBJECT_CONVERT_ICS_RAW 
    SX_OBJECT_CONVERT_INT_RAW 
    SX_OBJECT_CONVERT_OBJ_HTM 
    SX_OBJECT_CONVERT_OTF_PDF 
    SX_OBJECT_CONVERT_OTF_PRT 
    SX_OBJECT_CONVERT_OTF_RAW 
    SX_OBJECT_CONVERT_RAW_SCR 
    SX_OBJECT_CONVERT_RAW_TXT 
    SX_OBJECT_CONVERT_SCR_OTF 
    SX_OBJECT_CONVERT_TXT_INT 
    SX_OBJECT_CONVERT_OBJL_HTM

  • Email attachment with .txt file (first line blank in the file)

    Hi all ,
    Iam trying attach .txt file to email , the file that iam accessing from server  . But first line blank (extra) even though i dont have blank line in original file .Can any help me out to resolve this issue?
    <u>Example</u> original file
    12345     aa    pq
    <u>Email attachment file</u>
                                        -> This line
    12345     aa    pq
    This is my code:
    REPORT  ZTEST_FILE  .
    DATA:BEGIN OF t_upload occurs 0,
           matnr LIKE zwplcsmev-matnr,
           zwgehrrg LIKE zwplcsmev-zwgehrrg,
           zwgehrct LIKE zwplcsmev-zwgehrct,
           zwgbev LIKE   zwplcsmev-zwgbev,
           zwpldt LIKE zwplcsmev-zwpldt,
           zwacdt LIKE zwplcsmev-zwacdt,
         END OF t_upload.
    *DATA:  maildata type sodocchgi1.
    *DATA:  mailtxt type table of solisti1 with header line.
    *DATA:  mailrec type table of somlrec90 with header line.
    DATA:   it_message TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0
                    WITH HEADER LINE.
    DATA:REC(80) TYPE C.
    DATA g_mask(20) TYPE c VALUE ',., ..'.
    DATA:   it_attach TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0
                    WITH HEADER LINE.
    DATA:P_ERROR(3).
    DATA:P_REFO(3).
    DATA:   gd_error TYPE sy-subrc,
            gd_reciever TYPE sy-subrc.
    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.
    selection-screen begin of block b1 with frame title text-001.
    parameters:p_file type localfile.
    parameter:p_email type ad_smtpadr.
    selection-screen end of block b1.
    --At Selection-Screen- -
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
      CALL FUNCTION 'TB_LIMIT_WS_FILENAME_GET'
          EXPORTING
            def_filename     = p_file
            mask             = g_mask
         mode             = 'S'
            title            = 'INPUT FILE'
          IMPORTING
            filename         = p_file
          EXCEPTIONS
            selection_cancel = 1
            selection_error  = 2
            OTHERS           = 3.
      IF sy-subrc <> 0.
           MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                   WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    START-OF-SELECTION.
      PERFORM process_file.
      if p_error = 'X' AND P_REFO <> 'X'.
      PERFORM populate_message_body.
      ENDIF.
      IF P_REFO = 'X' AND P_ERROR <> 'X'.
      it_message = 'Please find Attached file'.
      APPEND it_message.
      PERFORM send_attachment tables it_message
                                 it_attach
                          using  p_email
                         'Crest to Plc Data'
                                          'TXT'
                                          p_file
                                 changing gd_error
                                          gd_reciever.
      ENDIF.
      Instructs mail send program for SAPCONNECT to send email(rsconn01)
    PERFORM initiate_mail_execute_program.
    END-OF-SELECTION.
    *&      Form  process_file
          text
    FORM process_file.
    *CONSTANTS: con_cret TYPE x VALUE '0D',  "OK for non Unicode
                con_tab TYPE x VALUE '09'.   "OK for non Unicode
      DATA :l_path TYPE  string.
      l_path = p_file.
    CONSTANTS:  con_tab  type c value cl_abap_char_utilities=>HORIZONTAL_TAB
      con_cret type c value cl_abap_char_utilities=>newline.
    OPEN DATASET P_FILE  FOR INPUT IN TEXT MODE encoding default.
    if sy-subrc = 0.
    do.
    read dataset p_file into IT_ATTACH.
    IF SY-SUBRC  NE 0 .
    EXIT.
    ELSE.
    T_UPLOAD = IT_ATTACH.
    CONCATENATE con_cret it_attach  INTO it_attach .
    append it_attach.
    clear it_attach.
    P_REFO = 'X'.
    APPEND T_UPLOAD .
    clear t_upload.
    ENDIF.
    ENDDO.
    else.
    p_error = 'X'.
    ENDIF.
    ENDFORM.                    "process_file
    *&      Form  populate_message_body
          text
    FORM populate_message_body.
    w_doc_data-obj_name = 'TEST'.
      w_doc_data-obj_descr = 'Crest to Plc Data'.
      w_doc_data-obj_langu = sy-langu.
      it_message = 'File Not Found'.
      APPEND it_message.
    t_receivers-receiver = p_email.
      t_receivers-rec_type = 'U'.
      append t_receivers.
      call function 'SO_NEW_DOCUMENT_SEND_API1'
           exporting
                document_data              = w_doc_data
                document_type              = 'RAW'
                put_in_outbox              = 'X'
           tables
                object_header              = it_message
                object_content             = 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.
        if sy-subrc = 0.
      commit work.
        SUBMIT rsconn01 USING SELECTION-SET 'SAP&CONNECTINT' AND RETURN.
      else.
        MESSAGE s027(vv) WITH 'E-mail not sent'.
      endif.
    ENDFORM.                    "populate_message_body
    *&      Form  send_attachment
          text
    FORM send_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.
      w_doc_data-doc_size = 1.
      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[].
      clear t_attachment.
    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
          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.
      if sy-subrc = 0.
        commit work.
        SUBMIT rsconn01 USING SELECTION-SET 'SAP&CONNECTINT' AND RETURN.
      else.
        MESSAGE s027(vv) WITH 'E-mail not sent'.
      endif.
    Populate error return code
      ld_error = sy-subrc.
    Populate zreceiver return code
      LOOP AT t_receivers.
        ld_receiver = t_receivers-retrn_code.
      ENDLOOP.
    ENDFORM.                    "send_attachment

    Just copy the code below and execute . I just checked and found the exact values on attachment with no blank lines. This is more simple than the one u have written , just include ur data upload logic . For ITAB values to be attached i have written a simple logic to retrive from EKPO. Just copy this code and execute. u will understand then.
    I understand that ur initial requirement was to attach the file directly and not to upload and attach. If u still want to go for the old requirement then check out the code(2nd program of the two that i have sent) that i have sent u on ur previous post.
    REPORT  ZEMAIL_ATTACH                   .
    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.
    *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_TXT_data_table.
    *END-OF-SELECTION
    END-OF-SELECTION.
    Populate message body text
      perform populate_email_message_body.
    Send file by email as .TXT speadsheet
      PERFORM send_file_as_email_attachment
                                   tables it_message
                                          it_attach
                                    using p_email
                                          'Example .TXT documnet attachment'
                                          'TXT'
                                          '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_TXT_DATA_TABLE
          Build data table for .txt document
    FORM build_txt_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 SPACE . "con_tab.
    CONCATENATE con_cret it_attach  INTO it_attach." Use this if req.
      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 SPACE ."con_tab.
       CONCATENATE con_cret it_attach  INTO it_attach." Use this if req.
        APPEND  it_attach.
      ENDLOOP.
    ENDFORM.                    " BUILD_txt_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
                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
    execute this code and i hope that will help u.
    regards,
    Barath.

  • How to send a ttachment with email.

    Dear all ,
    i have written the below code to send mails ..it is workiing fine
    my problem is data to be shown in the mail is contained in itab
    mailtxt77 .... but i want the data contained in this itab
    to be sent as attachment ... how to do dat.
    *& Report  ZTRANSPORTER_EMAIL                                          *
    REPORT  ZTRANSPORTER_EMAIL                      .
    data: maildata type sodocchgi1.
    data: entries like sy-tabix.
    data: newid like sofolenti1-object_id.
    data: sent like sonv-flag.
    data: BEGIN OF mailtxt OCCURS 0,
          LINE(300),
          END OF MAILTXT.
    data: mailrec  type table of SOMLRECI1 WITH HEADER LINE .
    DATA : MAILREC1 type table of SOMLRECI1.
    *data: mailrec type string.
    data: lt_transporter like ztransporter occurs 0 with header line.
    data: begin of lt_transporter2 occurs 0,
          transporter(18),
          end of lt_transporter2.
    DATA : MAILTXT1(10),
    MAILTXT2(30),
    MAILTXT3(4),
    MAILTXT4(18),
    MAILTXT5(10),
    MAILTXT6(35),
    MAILTXT7(30),
    MAILTXT8(40),
    MAILTXT9(10),
    MAILTXT10(5),
    MAILTXT11(8),
    MAILTXT12(10),
    mail1 type string,
    mail2 type string,
    mail3 type string,
    mail4 type string,
    mail5 type string,
    mail6 type string,
    mail7 type string,
    mail8 type string,
    mail9 type string,
    mail10 type string,
    mail11 type string,
    mail12 type string.
    DATA : MAILTXT77 TYPE TABLE OF SOLISTI1 WITH HEADER LINE.
    data: begin of lt_transporter1 occurs 0,
          Sr_no(10),
          transporter(30),
          plant(4),
          material(18),
          VENDOR(10),
          vendor_name(35),
          vendor_place(30),
          material_desc(40),
          sched_agreement(10),
          sched_line_item(5),
          delivery_date(8),
          delivery_qty(10),
          end of lt_transporter1.
    data: lt_email like ztrans_email occurs 0 with header line.
    DATA: BEGIN OF MAILTXT13 OCCURS 0 ,
    LINE(300),
    END OF MAILTXT13.
    data: var1 type i,
          var2 type i,
          var3 type i,
    var4 type i,
    var5 type i,
    var6 type i,
    var7 type i,
    var8 type i,
    var9 type i,
    var10 type i,
    var11 type i,
    var12 type i.
    start-of-selection.
      clear:    maildata, mailtxt,  mailrec.
      refresh:  mailtxt. "mailrec.
    select * from ztransporter into table lt_transporter.
    select distinct transporter from ztransporter into table lt_transporter2
    loop at lt_transporter.
    move-corresponding lt_transporter to lt_transporter1.
    append lt_transporter1.
    clear lt_transporter1.
    endloop.
    if not lt_transporter[] is initial.
    select * from ztrans_email into table lt_email
    for all entries in lt_transporter
    where transporter = lt_transporter-transporter.
    endif.
    loop at lt_transporter2.
      maildata-obj_name = 'TEST'.
      maildata-obj_descr = 'Test'.
      maildata-obj_langu = sy-langu.
    MAIL1 = 'SR NO-'.
    MAIL2 = '---TRANSPORTER--
    mail3 = 'plant'.
    mail4 = '---material---'.
    mail5 = '-vendor'.
    mail6 = '--vendor_name--
    mail7 = '--vendor_place--
    mail8 = '--material_desc--
    mail9 = 'sched_agrt'.
    mail10 = 'item-'.
    mail11 = 'del. date'.
    mail12 = '-del. qty-'.
    concatenate mail1 ',' mail2 ',' mail3 ',' mail4 ',' mail5 ',' mail6 ','
    mail7 ',' mail8 ',' mail9 ',' mail10 ',' mail11 ',' mail12  into
    mailtxt77-line
    separated by space.
    *mailtxt = '  Srno  Transporter  plant  material  vendor  vendorplace
    *materialdesc  schedagreement  LINEITEM  DELIVERYDATE  DELIVERYQTY'.
      append mailtxt77.
      clear mailtxt77.
    loop at lt_transporter1 where transporter = lt_transporter2-transporter.
    *MOVE  LT_TRANSPORTER1+(10) TO MAILTXT(10).
    MAILTXT1 = LT_TRANSPORTER1+(10).
    *MAILTXT33 = '  '.
    var1 = strlen( mailtxt1 ).
    var1 = 10 - var1.
    shift mailtxt1 right by var1 places.
    MAILTXT2 = LT_TRANSPORTER1+10(30).
    var2 = strlen( mailtxt2 ).
    var2 = 30 - var2.
    shift mailtxt2 right by var2 places.
    *concatenate mailtxt1 mailtxt2 into mailtxt13-line respecting blanks.
    MAILTXT3 = LT_TRANSPORTER1+40(4).
    var3 = strlen( mailtxt3 ).
    var3 = 4 - var3.
    shift mailtxt3 right by var3 places.
    MAILTXT4 = LT_TRANSPORTER1+44(18).
    var4 = strlen( mailtxt4 ).
    var4 = 18 - var4.
    shift mailtxt4 right by var4 places.
    MAILTXT5 = LT_TRANSPORTER1+62(10).
    var5 = strlen( mailtxt5 ).
    var5 = 10 - var5.
    shift mailtxt5 right by var5 places.
    MAILTXT6 = LT_TRANSPORTER1+72(35).
    var6 = strlen( mailtxt6 ).
    var6 = 35 - var6.
    shift mailtxt6 right by var6 places.
    MAILTXT7 = LT_TRANSPORTER1+107(30).
    var7 = strlen( mailtxt7 ).
    var7 = 30 - var7.
    shift mailtxt7 right by var7 places.
    MAILTXT8 = LT_TRANSPORTER1+137(40).
    var8 = strlen( mailtxt8 ).
    var8 = 40 - var8.
    shift mailtxt8 right by var8 places.
    MAILTXT9 = LT_TRANSPORTER1+177(10).
    var9 = strlen( mailtxt9 ).
    var9 = 10 - var9.
    shift mailtxt9 right by var9 places.
    MAILTXT10 =  LT_TRANSPORTER1+187(5).
    var10 = strlen( mailtxt10 ).
    var10 = 5 - var10.
    shift mailtxt10 right by var10 places.
    MAILTXT11 = LT_TRANSPORTER1+192(8).
    var11 = strlen( mailtxt11 ).
    var11 = 8 - var11.
    shift mailtxt11 right by var11 places.
    MAILTXT12 = LT_TRANSPORTER1+200(10).
    var12 = strlen( mailtxt12 ).
    var12 = 10 - var12.
    shift mailtxt12 right by var12 places.
    *CONCATENATE LT_TRANSPORTER1(10) LT_TRANSPORTER112(30)
    *LT_TRANSPORTER142(4) LT_TRANSPORTER148(18)
    *LT_TRANSPORTER166(10) LT_TRANSPORTER178(35)
    *LT_TRANSPORTER1115(30) LT_TRANSPORTER1147(40)
    *LT_TRANSPORTER1189(10) LT_TRANSPORTER1201(5)
    *LT_TRANSPORTER1208(10) LT_TRANSPORTER1220(10) INTO MAILTXT-LINE.
    CONCATENATE MAILTXT1 ',' MAILTXT2 ',' MAILTXT3 ',' MAILTXT4 ','
    MAILTXT5 ','
    MAILTXT6 ',' MAILTXT7 ',' MAILTXT8 ',' MAILTXT9 ',' MAILTXT10 ','
    MAILTXT11
    ',' MAILTXT12 INTO MAILTXT77-LINE SEPARATED BY SPACE.
    mailtxt = lt_transporter1.
      append mailtxt77.
       clear mailtxt77.
    endloop.
    clear lt_email.
    read table lt_email with key transporter = lt_transporter2-transporter.
    if sy-subrc = 0.
      mailrec-receiver = lt_email-main_email.
      mailrec = lt_email-main_email.
      mailrec-rec_type  = 'U'.
    mailrec-com_type = 'INT'.
    mailrec-notif_del = 'X'.
    mailrec-notif_ndel = 'X'.
      append mailrec.
    *perform email.
       clear mailrec.
       if not lt_email-email2 = ''.
      mailrec-receiver = lt_email-email2.
      mailrec-rec_type  = 'U'.
       mailrec-com_type = 'INT'.
    mailrec-notif_del = 'X'.
    mailrec-notif_ndel = 'X'.
    *mailrec = lt_email-email2.
    perform email.
      append mailrec.
       clear mailrec.
       endif.
       if not lt_email-email3 = ''.
      mailrec-receiver = lt_email-email3.
      mailrec-rec_type  = 'U'.
       mailrec-com_type = 'INT'.
    mailrec-notif_del = 'X'.
    mailrec-notif_ndel = 'X'.
      append mailrec.
    *mailrec = lt_email-email3.
    perform email.
       clear mailrec.
       endif.
        if not lt_email-email4 = ''.
      mailrec-receiver = lt_email-email4.
      mailrec-rec_type  = 'U'.
       mailrec-com_type = 'INT'.
    mailrec-notif_del = 'X'.
    mailrec-notif_ndel = 'X'.
      append mailrec.
    *mailrec = lt_email-email4.
    perform email.
       clear mailrec.
       endif.
       if not lt_email-email5 = ''.
      mailrec-receiver = lt_email-email5.
      mailrec-rec_type  = 'U'.
      append mailrec.
    mailrec = lt_email-email5.
    perform email.
       clear mailrec.
       endif.
    endif.
        call function 'SO_NEW_DOCUMENT_SEND_API1'
             exporting
                  document_data              = maildata
                  document_type              = 'RAW'
                  put_in_outbox              = 'X'
                  commit_work                = 'X'
             importing
                  sent_to_all                = sent
                  new_object_id             = newid
             tables
                  object_content             = mailtxt77
                  receivers                  = mailrec
             exceptions
                  too_many_receivers         = 1
                  document_not_sent          = 2
                  document_type_not_exist    = 3
                  operation_no_authorization = 4
                  parameter_error            = 5
                  x_error                    = 6
                  enqueue_error              = 7
                  others                     = 8.
        if sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        endif.

    dear all,
      i  am now able to get attachments with the mail
      but there are 2 attachments
      1.     . raw
      2.     .ali -  this attachment shows junk characters
    i need only one .html file as attachement
    if you can kindly find the fault in this code
    *& Report  ZTRANSPORTER_EMAIL                                          *
    REPORT  ZTRANSPORTER_EMAIL                      .
    data: maildata type sodocchgi1.
    DATA:
    l_datum(10),
    ls_docdata TYPE sodocchgi1,
    lt_objpack TYPE TABLE OF sopcklsti1 WITH HEADER LINE,
    lt_objhead TYPE TABLE OF solisti1 WITH HEADER LINE,
    lt_objtxt TYPE TABLE OF solisti1 WITH HEADER LINE,
    lt_objbin TYPE TABLE OF solisti1 WITH HEADER LINE,
    lt_reclist TYPE TABLE OF somlreci1 WITH HEADER LINE,
    lt_listobject TYPE TABLE OF abaplist WITH HEADER LINE,
    l_tab_lines TYPE i,
    l_att_type LIKE soodk-objtp.
    data: entries like sy-tabix.
    data: newid like sofolenti1-object_id.
    data: sent like sonv-flag.
    data: BEGIN OF mailtxt OCCURS 0,
          LINE(300),
          END OF MAILTXT.
    data: mailrec  type table of SOMLRECI1 WITH HEADER LINE .
    DATA : MAILREC1 type table of SOMLRECI1.
    *data: mailrec type string.
    data: lt_transporter like ztransporter occurs 0 with header line.
    data: begin of lt_transporter2 occurs 0,
          transporter(18),
          end of lt_transporter2.
    DATA : MAILTXT1(10),
    MAILTXT2(30),
    MAILTXT3(4),
    MAILTXT4(18),
    MAILTXT5(10),
    MAILTXT6(35),
    MAILTXT7(30),
    MAILTXT8(40),
    MAILTXT9(10),
    MAILTXT10(5),
    MAILTXT11(8),
    MAILTXT12(10),
    mail1 type string,
    mail2 type string,
    mail3 type string,
    mail4 type string,
    mail5 type string,
    mail6 type string,
    mail7 type string,
    mail8 type string,
    mail9 type string,
    mail10 type string,
    mail11 type string,
    mail12 type string.
    DATA : MAILTXT77 TYPE TABLE OF SOLISTI1 WITH HEADER LINE.
    data: begin of lt_transporter1 occurs 0,
          Sr_no(10),
          transporter(30),
          plant(4),
          material(18),
          VENDOR(10),
          vendor_name(35),
          vendor_place(30),
          material_desc(40),
          sched_agreement(10),
          sched_line_item(5),
          delivery_date(8),
          delivery_qty(10),
          end of lt_transporter1.
    data: lt_email like ztrans_email occurs 0 with header line.
    DATA: BEGIN OF MAILTXT13 OCCURS 0 ,
    LINE(300),
    END OF MAILTXT13.
    data: var1 type i,
          var2 type i,
          var3 type i,
    var4 type i,
    var5 type i,
    var6 type i,
    var7 type i,
    var8 type i,
    var9 type i,
    var10 type i,
    var11 type i,
    var12 type i.
    start-of-selection.
      clear:    maildata, mailtxt,  mailrec.
      refresh:  mailtxt. "mailrec.
    select * from ztransporter into table lt_transporter.
    select distinct transporter from ztransporter into table lt_transporter2
    loop at lt_transporter.
    move-corresponding lt_transporter to lt_transporter1.
    append lt_transporter1.
    clear lt_transporter1.
    endloop.
    if not lt_transporter[] is initial.
    select * from ztrans_email into table lt_email
    for all entries in lt_transporter
    where transporter = lt_transporter-transporter.
    endif.
    loop at lt_transporter2.
      maildata-obj_name = 'TEST'.
      maildata-obj_descr = 'Test'.
      maildata-obj_langu = sy-langu.
    MAIL1 = 'SR NO-'.
    MAIL2 = '---TRANSPORTER--
    mail3 = 'plant'.
    mail4 = '---material---'.
    mail5 = '-vendor'.
    mail6 = '--vendor_name--
    mail7 = '--vendor_place--
    mail8 = '--material_desc--
    mail9 = 'sched_agrt'.
    mail10 = 'item-'.
    mail11 = 'del. date'.
    mail12 = '-del. qty-'.
    concatenate mail1 ',' mail2 ',' mail3 ',' mail4 ',' mail5 ',' mail6 ','
    mail7 ',' mail8 ',' mail9 ',' mail10 ',' mail11 ',' mail12  into
    mailtxt77-line
    separated by space.
    *mailtxt = '  Srno  Transporter  plant  material  vendor  vendorplace
    *materialdesc  schedagreement  LINEITEM  DELIVERYDATE  DELIVERYQTY'.
      append mailtxt77.
      clear mailtxt77.
    loop at lt_transporter1 where transporter = lt_transporter2-transporter.
    *MOVE  LT_TRANSPORTER1+(10) TO MAILTXT(10).
    MAILTXT1 = LT_TRANSPORTER1+(10).
    *MAILTXT33 = '  '.
    var1 = strlen( mailtxt1 ).
    var1 = 10 - var1.
    shift mailtxt1 right by var1 places.
    MAILTXT2 = LT_TRANSPORTER1+10(30).
    var2 = strlen( mailtxt2 ).
    var2 = 30 - var2.
    shift mailtxt2 right by var2 places.
    *concatenate mailtxt1 mailtxt2 into mailtxt13-line respecting blanks.
    MAILTXT3 = LT_TRANSPORTER1+40(4).
    var3 = strlen( mailtxt3 ).
    var3 = 4 - var3.
    shift mailtxt3 right by var3 places.
    MAILTXT4 = LT_TRANSPORTER1+44(18).
    var4 = strlen( mailtxt4 ).
    var4 = 18 - var4.
    shift mailtxt4 right by var4 places.
    MAILTXT5 = LT_TRANSPORTER1+62(10).
    var5 = strlen( mailtxt5 ).
    var5 = 10 - var5.
    shift mailtxt5 right by var5 places.
    MAILTXT6 = LT_TRANSPORTER1+72(35).
    var6 = strlen( mailtxt6 ).
    var6 = 35 - var6.
    shift mailtxt6 right by var6 places.
    MAILTXT7 = LT_TRANSPORTER1+107(30).
    var7 = strlen( mailtxt7 ).
    var7 = 30 - var7.
    shift mailtxt7 right by var7 places.
    MAILTXT8 = LT_TRANSPORTER1+137(40).
    var8 = strlen( mailtxt8 ).
    var8 = 40 - var8.
    shift mailtxt8 right by var8 places.
    MAILTXT9 = LT_TRANSPORTER1+177(10).
    var9 = strlen( mailtxt9 ).
    var9 = 10 - var9.
    shift mailtxt9 right by var9 places.
    MAILTXT10 =  LT_TRANSPORTER1+187(5).
    var10 = strlen( mailtxt10 ).
    var10 = 5 - var10.
    shift mailtxt10 right by var10 places.
    MAILTXT11 = LT_TRANSPORTER1+192(8).
    var11 = strlen( mailtxt11 ).
    var11 = 8 - var11.
    shift mailtxt11 right by var11 places.
    MAILTXT12 = LT_TRANSPORTER1+200(10).
    var12 = strlen( mailtxt12 ).
    var12 = 10 - var12.
    shift mailtxt12 right by var12 places.
    *CONCATENATE LT_TRANSPORTER1(10) LT_TRANSPORTER112(30)
    *LT_TRANSPORTER142(4) LT_TRANSPORTER148(18)
    *LT_TRANSPORTER166(10) LT_TRANSPORTER178(35)
    *LT_TRANSPORTER1115(30) LT_TRANSPORTER1147(40)
    *LT_TRANSPORTER1189(10) LT_TRANSPORTER1201(5)
    *LT_TRANSPORTER1208(10) LT_TRANSPORTER1220(10) INTO MAILTXT-LINE.
    CONCATENATE MAILTXT1 ',' MAILTXT2 ',' MAILTXT3 ',' MAILTXT4 ','
    MAILTXT5 ','
    MAILTXT6 ',' MAILTXT7 ',' MAILTXT8 ',' MAILTXT9 ',' MAILTXT10 ','
    MAILTXT11
    ',' MAILTXT12 INTO MAILTXT77-LINE SEPARATED BY SPACE.
    mailtxt = lt_transporter1.
      append mailtxt77.
       clear mailtxt77.
    Create receiver list
    **LOOP AT s_name.
    *lt_reclist-receiver = s_name-low.
    **lt_reclist-rec_type = 'B'.
    **APPEND lt_reclist.
    **ENDLOOP.
    Send Message
    endloop.
    submit zreport with transporter = lt_transporter2-transporter
       exporting list to memory and return.
    *REFRESH LT_LISTOBJECT.
       CALL FUNCTION 'LIST_FROM_MEMORY'
    TABLES
    listobject = lt_listobject
    EXCEPTIONS
    not_found = 1
    OTHERS = 2.
    IF sy-subrc <> 0.
    Error in function module &1
    MESSAGE ID '61' TYPE 'E' NUMBER '731'
    WITH 'LIST_FROM_MEMORY'.
    ENDIF.
    Because listobject is of size RAW(1000)
    and objbin is of size CHAR(255) we make this table copy
    CALL FUNCTION 'TABLE_COMPRESS'
    TABLES
    in = lt_listobject
    out = lt_objbin
    EXCEPTIONS
    compress_error = 1
    OTHERS = 2.
    IF sy-subrc <> 0.
    Error in function module &1
    MESSAGE ID '61' TYPE 'E' NUMBER '731'
    WITH 'TABLE_COMPRESS'.
    ENDIF.
    ls_docdata-obj_name = 'USERS_LIST'.
    CONCATENATE 'List of Users' sy-sysid '-' l_datum "#EC *
    INTO ls_docdata-obj_descr SEPARATED BY space.
    Main Text
    lt_objtxt = 'List of Users According to Logon Date' &
    ' and Password Change'. "#EC *
    APPEND lt_objtxt.
    Write Packing List (Main)
    DESCRIBE TABLE lt_objtxt LINES l_tab_lines.
    READ TABLE lt_objtxt INDEX l_tab_lines.
    ls_docdata-doc_size = ( l_tab_lines - 1 ) * 255 + STRLEN( lt_objtxt ).
    CLEAR lt_objpack-transf_bin.
    lt_objpack-head_start = 1.
    lt_objpack-head_num = 0.
    lt_objpack-body_start = 1.
    lt_objpack-body_num = l_tab_lines.
    lt_objpack-doc_type = 'RAW'.
    APPEND lt_objpack.
    Create Message Attachment
    Write Packing List (Attachment)
    l_att_type = 'ALI'.
    DESCRIBE TABLE lt_objbin LINES l_tab_lines.
    READ TABLE lt_objbin INDEX l_tab_lines.
    lt_objpack-doc_size = ( l_tab_lines - 1 ) * 255 + STRLEN( lt_objbin ).
    lt_objpack-transf_bin = 'X'.
    lt_objpack-head_start = 1.
    lt_objpack-head_num = 0.
    lt_objpack-body_start = 1.
    lt_objpack-body_num = l_tab_lines.
    lt_objpack-doc_type = l_att_type.
    lt_objpack-obj_name = 'ATTACHMENT'.
    lt_objpack-obj_descr = 'List_of_Users'. "#EC *
    APPEND lt_objpack.
    clear lt_email.
    read table lt_email with key transporter = lt_transporter2-transporter.
    if sy-subrc = 0.
      mailrec-receiver = lt_email-main_email.
      mailrec = lt_email-main_email.
      mailrec-rec_type  = 'U'.
    mailrec-com_type = 'INT'.
    mailrec-notif_del = 'X'.
    mailrec-notif_ndel = 'X'.
      append mailrec.
    *perform email.
       clear mailrec.
       if not lt_email-email2 = ''.
      mailrec-receiver = lt_email-email2.
      mailrec-rec_type  = 'U'.
       mailrec-com_type = 'INT'.
    mailrec-notif_del = 'X'.
    mailrec-notif_ndel = 'X'.
    *mailrec = lt_email-email2.
    perform email.
      append mailrec.
       clear mailrec.
       endif.
       if not lt_email-email3 = ''.
      mailrec-receiver = lt_email-email3.
      mailrec-rec_type  = 'U'.
       mailrec-com_type = 'INT'.
    mailrec-notif_del = 'X'.
    mailrec-notif_ndel = 'X'.
      append mailrec.
    *mailrec = lt_email-email3.
    perform email.
       clear mailrec.
       endif.
        if not lt_email-email4 = ''.
      mailrec-receiver = lt_email-email4.
      mailrec-rec_type  = 'U'.
       mailrec-com_type = 'INT'.
    mailrec-notif_del = 'X'.
    mailrec-notif_ndel = 'X'.
      append mailrec.
    *mailrec = lt_email-email4.
    perform email.
       clear mailrec.
       endif.
       if not lt_email-email5 = ''.
      mailrec-receiver = lt_email-email5.
      mailrec-rec_type  = 'U'.
      append mailrec.
    mailrec = lt_email-email5.
    perform email.
       clear mailrec.
       endif.
    endif.
    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
    EXPORTING
    document_data = ls_docdata
    put_in_outbox = ''
    commit_work = 'X'
    TABLES
    packing_list = lt_objpack
    object_header = lt_objhead
    contents_bin = lt_objbin
    contents_txt = lt_objtxt
    receivers = MAILREC
    EXCEPTIONS
    too_many_receivers = 1
    document_not_sent = 2
    document_type_not_exist = 3
    operation_no_authorization = 4
    parameter_error = 5
    x_error = 6
    enqueue_error = 7
    OTHERS = 8.
    IF sy-subrc = 0.
    Document sent
    MESSAGE ID 'SO' TYPE 'S' NUMBER '022'.
    ELSE.
    Document <&> could not be sent
    MESSAGE ID 'SO' TYPE 'S' NUMBER '023'
    WITH ls_docdata-obj_name.
    ENDIF.
    kindly help..
    APT POINTS WILL BE GIVEN..

Maybe you are looking for

  • How can I import photos from apple tv back to a computer?

    I am using Apple TV and loaded photos from another Macbook. Can I import photos on Apple TV to my Macbook Air connected to my Apple TV?

  • Quick Search Enhancement

    Hello all, I encountered a requirement, where I need to make an enhancement in the Inbox search functionality-<b>Quick search dropdown</b> to include a new set of predefined search criteria to be populated there. Can anyone please help me with the co

  • I need to merge two clips

    AHH!! I really need to merge these two clips, the videos just split for no reason and it sounds sorta like heh..heh eeeee I REALLY need to fix it A.S.A.P.!!!!! Please help! Thanks!!!! Q.T

  • ASM on Solaris 10 without Veritas ?

    Looks like most ASM documentation assumes Linux or Solaris Veritas ? Is it possible to use inherent Solaris functionality and RAW as ASM devices, if not what aer the storage options

  • 3D in photoshop is not working.

    I checked my vRAM and it is more then the 512MB required and it is still not working. Can anyone suggest how I can get this to work? I am working on a iMac.