Sending Smartform as an Email Attachment

Hi All,
After executing the FM SO_NEW_DOCUMENT_ATT_SEND_API1, I' m getting sy-subrc as 0.
However in receivers table I'm getting the return code 27.
Can anybody please suggest what might went wrong.
Regards
Adi

Hi,
The return code 27 represents the error "receiver_not_exist". So check the entry passed into the "RECEIVERS" internal table into the FM. Mainly the values in "RECEIVER" and "REC_TYPE" field etc.
Regards,
Harish

Similar Messages

  • How do I save my exported doc in order to send it as an email attachment?

    how do I save my exported doc in order to send it as an email attachment?

    Plug your ipod in and pull up itunes. Then click on the device name in the left hand side. Click the restore option. When it goes all the way through and says "your device has been restored and is restarting, once it restarts you want to choose the option that says "setup as a new device"

  • Can you send slideshows as an email attachment?

    can you send slideshows as an email attachment? Please provide the steps if it is possible, thank you

    Yes, but you shouldn't.
    Here's how.
    Export the Slideshow to the FInder - a process that will make a QuickTime movie of it.
    Attach that movie to the email. Send
    Why not? Videos are very large files. Most Internet providers have a limit on the largest file you can send. Sending one too large means it can bounce back to you. ALso, even if the other person can receive it, downloading large files via email is slow, and can even cause crashes on some email apps on older systems.
    Intead of emailing it, upload it to DropBox, YouTube, Vimeo, or any other sharing site and send the person a link.
    Then they can download it themselves
    Regards
    TD

  • How to send smartform output through email

    Hi,
    I want to send smartform output through email.....
    can u give me sample program to send it through email......
    Regards,
    Jenifer
    MOderator Message: Basic and Frequently asked question. Please search before posting.
    Edited by: kishan P on Nov 26, 2010 11:11 AM

    Hi Jenifer,
    There are many threads available on SDN.
    Just have a look at this thread
    <<link removed by moderator>>
    Kindly search before you post.
    Regard
    Abhii
    Moderator Message: You have been warned many times against point-hunting. Continuing ignoring of the Moderator warnings will lead to account deletion. Consider this your last warning
    Edited by: kishan P on Nov 26, 2010 11:09 AM

  • To send smartform output through email and fax

    Hi,
    I need to send smartform output through email if the email address is present else if the email address is present then it has to be sent through fax.If both the email address and fax are present,then it has to send an email.
    Now the issue is I am able to send the email and I am getting the message as 'Output was successfully issued'.But the entry corresponding to this is not shown in SOST transaction.
    Can anyone tell me what would be the reason for this?

    HI,
    Try to look in transaction SCOT
    Regards,
    Egle

  • How to retrive the archived (in PDF) smartform as a email attachment.

    Hi ,
    I have a requirement where the smartform is archived in PDF mode and I have to retrieve the archived smartfrom and send the mail with PDf attachment.
    I referred the sdn forum for the same and I could some posts posted earlier and quite a few are solved. I implemented the sample code provided by some of the posts and I still get the same error when I try to open the mail/attachment in SOST transaction. But I didnt understand what exactly they did to get away with the error when we try to open the attachment.
    Please help me with the correct code to get this issue solved.
    Thanks a lot in advance.
    Regards,
    Naresh

    Hi Sim,
    The Error says:
    "Adobe reader could not open 'InvoiceDetails_20110228094610.709_X.pdf' because it is either not a supported file or because the file has been damaged(for example, it was sent as an email attachment and wasn't correctly decorded).
    Below is the sample code that I got from one of the forum postings. I implemented the same and got the same error that the earlier posting was referring. From that step, I didnt know what to do further.
    *// Internal Table Declarations
    DATA : li_toa01 TYPE TABLE OF toa01,
           li_archivobject TYPE TABLE OF docs,
           li_binarchivobject TYPE TABLE OF tbl1024,
           li_objcont TYPE TABLE OF soli,
           li_receivers TYPE TABLE OF soos1.
    *// Work Area Declarations
    DATA : lwa_toa01 TYPE toa01,
           lwa_objcont TYPE soli,
           lwa_receivers TYPE soos1,
           lwa_archivobject TYPE docs,
           lwa_binarchivobject TYPE tbl1024.
    *// Variable Declaration
    DATA : lv_length   TYPE num12,
           lv_binlength TYPE num12,
           lv_buffer TYPE xstring,
           lv_x TYPE i.
    DATA : wa_objbin TYPE solisti1,
           i_objbin TYPE TABLE OF solisti1,
           wa_objtxt TYPE solisti1,
           i_objtxt TYPE TABLE OF solisti1.
    DATA : wa_doc_chng TYPE sodocchgi1,
           w_l1 TYPE i.
    DATA : wa_objpack TYPE sopcklsti1,
           i_objpack TYPE TABLE OF sopcklsti1.
    DATA : wa_reclist TYPE somlreci1,
           i_reclist TYPE TABLE OF somlreci1.
    CALL FUNCTION 'ARCHIVOBJECT_GET_TABLE'
              EXPORTING
                archiv_id                      = 'ZF'
                document_type                  = 'PDF'
                archiv_doc_id                  = 'DF88D06227DFAEF1A31D0050568361B1'
    *           ALL_COMPONENTS                 =
    *           SIGNATURE                      = 'X'
    *           COMPID                         = 'data'
              IMPORTING
                length                         = lv_length
                binlength                      = lv_binlength
              TABLES
                archivobject                   = li_archivobject
                binarchivobject                = li_binarchivobject
    *         EXCEPTIONS
    *           ERROR_ARCHIV                   = 1
    *           ERROR_COMMUNICATIONTABLE       = 2
    *           ERROR_KERNEL                   = 3
    *           OTHERS                         = 4
    IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    LOOP AT li_binarchivobject INTO lwa_binarchivobject.
      CONCATENATE lv_buffer lwa_binarchivobject-line INTO lv_buffer
      IN BYTE MODE.
    ENDLOOP.
    lv_x = 0.
    DO.
      wa_objbin-line = lv_buffer+lv_x.
      APPEND wa_objbin TO i_objbin.
      lv_x = lv_x + 255.
      IF lv_x GT lv_binlength.
        EXIT.
      ENDIF.
    ENDDO.
    wa_objtxt = 'Test Mail'.
    APPEND wa_objtxt TO i_objtxt.
    CLEAR wa_doc_chng.
    wa_doc_chng-obj_name = 'Invoice Details'.
    wa_doc_chng-obj_descr = 'Invoice Details'.
    DESCRIBE TABLE i_objtxt LINES w_l1.
    READ TABLE i_objtxt INTO wa_objtxt INDEX w_l1.
    wa_doc_chng-doc_size = ( w_l1 - 1 ) * 255 + strlen( wa_objtxt ).
    CLEAR wa_objpack-transf_bin.
    wa_objpack-head_start = 1.
    wa_objpack-head_num = 0.
    wa_objpack-body_start = 1.
    wa_objpack-body_num = w_l1.
    wa_objpack-doc_type = 'PDF'.
    APPEND wa_objpack TO i_objpack.
    CLEAR wa_objpack.
    wa_objpack-transf_bin = 'X'.
    wa_objpack-head_start = 1.
    wa_objpack-head_num = 1.
    wa_objpack-doc_type = 'DAT'.
    wa_objpack-body_num = w_l1 .
    wa_objpack-doc_size = w_l1 * lv_binlength .
    wa_objpack-obj_name = 'TEST'.
    wa_objpack-obj_descr = 'Naresh'.
    APPEND wa_objpack TO i_objpack.
    wa_reclist-receiver =   -->emailaddress given.
    wa_reclist-rec_type = 'U'.
    APPEND wa_reclist TO i_reclist.
    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
    EXPORTING
      document_data = wa_doc_chng
      put_in_outbox = 'X'
      commit_work = 'X'
    * IMPORTING
    * SENT_TO_ALL =
    * NEW_OBJECT_ID =
    TABLES
      packing_list = i_objpack
    * OBJECT_HEADER =
      contents_bin = i_objbin
      contents_txt = i_objtxt
      receivers = i_reclist
    EXCEPTIONS
      too_many_receivers = 1
      document_not_sent = 2
      document_type_not_exist = 3
      operation_no_authorization = 4
      parameter_error = 5
      x_error = 6
      enqueue_error = 7
    OTHERS = 8
    IF sy-subrc = 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.

  • Sending smartform output as PDF attachment, Error opening PDF attachment

    Hi Experts,
    I am using the code form the following link to send a smartform output as PDF attachment. I can able to see the message, but can not open PDF document.
    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/convertSmartformtoPDFformat&
    The information should be on my smartform are some text, company logo and a barcode.
    With all of these received error: "There was an error opening this document. The file is damaged and could not be repaired."
    I tried different ways like only text, text with company logo, text with barcode. I got the following errors:
    An unrecognized token 'Td0' was found
    There was problem reading this document(16).
    There was problem reading this document(111).
    Does anyone have idea of these ? Your help is greatly appreciated.
    Thank you,
    Surya

    please see this code  ...  for sending the  Email as  PDF attach file,
    *& Report  ZSPOOLTOPDF                                                 *
    *& Converts spool request into PDF document and emails it to           *
    *& recipicant.                                                         *
    *& Execution                                                           *
    *& This program must be run as a background job in-order for the write *
    *& commands to create a Spool request rather than be displayed on      *
    *& screen                                                              *
    REPORT  zspooltopdf.
    PARAMETER: p_email1 LIKE somlreci1-receiver
                                        DEFAULT '[email protected]',
               p_sender LIKE somlreci1-receiver
                                        DEFAULT '[email protected]',
               p_delspl  AS CHECKBOX.
    *DATA DECLARATION
    DATA: gd_recsize TYPE i.
    * Spool IDs
    TYPES: BEGIN OF t_tbtcp.
            INCLUDE STRUCTURE tbtcp.
    TYPES: END OF t_tbtcp.
    DATA: it_tbtcp TYPE STANDARD TABLE OF t_tbtcp INITIAL SIZE 0,
          wa_tbtcp TYPE t_tbtcp.
    * Job Runtime Parameters
    DATA: gd_eventid LIKE tbtcm-eventid,
          gd_eventparm LIKE tbtcm-eventparm,
          gd_external_program_active LIKE tbtcm-xpgactive,
          gd_jobcount LIKE tbtcm-jobcount,
          gd_jobname LIKE tbtcm-jobname,
          gd_stepcount LIKE tbtcm-stepcount,
          gd_error    TYPE sy-subrc,
          gd_reciever TYPE sy-subrc.
    DATA:  w_recsize TYPE i.
    DATA: gd_subject   LIKE sodocchgi1-obj_descr,
          it_mess_bod LIKE solisti1 OCCURS 0 WITH HEADER LINE,
          it_mess_att LIKE solisti1 OCCURS 0 WITH HEADER LINE,
          gd_sender_type     LIKE soextreci1-adr_typ,
          gd_attachment_desc TYPE so_obj_nam,
          gd_attachment_name TYPE so_obj_des.
    * Spool to PDF conversions
    DATA: gd_spool_nr LIKE tsp01-rqident,
          gd_destination LIKE rlgrap-filename,
          gd_bytecount LIKE tst01-dsize,
          gd_buffer TYPE string.
    * Binary store for PDF
    DATA: BEGIN OF it_pdf_output OCCURS 0.
            INCLUDE STRUCTURE tline.
    DATA: END OF it_pdf_output.
    CONSTANTS: c_dev LIKE  sy-sysid VALUE 'DEV',
               c_no(1)     TYPE c   VALUE ' ',
               c_device(4) TYPE c   VALUE 'LOCL'.
    *START-OF-SELECTION.
    START-OF-SELECTION.
    * Write statement to represent report output. Spool request is created
    * if write statement is executed in background. This could also be an
    * ALV grid which would be converted to PDF without any extra effort
      WRITE 'Hello World'.
      new-page.
      commit work.
      new-page print off.
      IF sy-batch EQ 'X'.
        PERFORM get_job_details.
        PERFORM obtain_spool_id.
    *** Alternative way could be to submit another program and store spool
    *** id into memory, will be stored in sy-spono.
    *submit ZSPOOLTOPDF2
    *        to sap-spool
    *        spool parameters   %_print
    *        archive parameters %_print
    *        without spool dynpro
    *        and return.
    * Get spool id from program called above
    *  IMPORT w_spool_nr FROM MEMORY ID 'SPOOLTOPDF'.
        PERFORM convert_spool_to_pdf.
        PERFORM process_email.
        if p_delspl EQ 'X'.
          PERFORM delete_spool.
        endif.
        IF sy-sysid = c_dev.
          wait up to 5 seconds.
          SUBMIT rsconn01 WITH mode   = 'INT'
                          WITH output = 'X'
                          AND RETURN.
        ENDIF.
      ELSE.
        SKIP.
        WRITE:/ 'Program must be executed in background in-order for spool',
                'request to be created.'.
      ENDIF.
    *       FORM obtain_spool_id                                          *
    FORM obtain_spool_id.
      CHECK NOT ( gd_jobname IS INITIAL ).
      CHECK NOT ( gd_jobcount IS INITIAL ).
      SELECT * FROM  tbtcp
                     INTO TABLE it_tbtcp
                     WHERE      jobname     = gd_jobname
                     AND        jobcount    = gd_jobcount
                     AND        stepcount   = gd_stepcount
                     AND        listident   <> '0000000000'
                     ORDER BY   jobname
                                jobcount
                                stepcount.
      READ TABLE it_tbtcp INTO wa_tbtcp INDEX 1.
      IF sy-subrc = 0.
        message s004(zdd) with gd_spool_nr.
        gd_spool_nr = wa_tbtcp-listident.
        MESSAGE s004(zdd) WITH gd_spool_nr.
      ELSE.
        MESSAGE s005(zdd).
      ENDIF.
    ENDFORM.
    *       FORM get_job_details                                          *
    FORM get_job_details.
    * Get current job details
      CALL FUNCTION 'GET_JOB_RUNTIME_INFO'
           IMPORTING
                eventid                 = gd_eventid
                eventparm               = gd_eventparm
                external_program_active = gd_external_program_active
                jobcount                = gd_jobcount
                jobname                 = gd_jobname
                stepcount               = gd_stepcount
           EXCEPTIONS
                no_runtime_info         = 1
                OTHERS                  = 2.
    ENDFORM.
    *       FORM convert_spool_to_pdf                                     *
    FORM convert_spool_to_pdf.
      CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
           EXPORTING
                src_spoolid              = gd_spool_nr
                no_dialog                = c_no
                dst_device               = c_device
           IMPORTING
                pdf_bytecount            = gd_bytecount
           TABLES
                pdf                      = it_pdf_output
           EXCEPTIONS
                err_no_abap_spooljob     = 1
                err_no_spooljob          = 2
                err_no_permission        = 3
                err_conv_not_possible    = 4
                err_bad_destdevice       = 5
                user_cancelled           = 6
                err_spoolerror           = 7
                err_temseerror           = 8
                err_btcjob_open_failed   = 9
                err_btcjob_submit_failed = 10
                err_btcjob_close_failed  = 11
                OTHERS                   = 12.
      CHECK sy-subrc = 0.
    * Transfer the 132-long strings to 255-long strings
      LOOP AT it_pdf_output.
        TRANSLATE it_pdf_output USING ' ~'.
        CONCATENATE gd_buffer it_pdf_output INTO gd_buffer.
      ENDLOOP.
      TRANSLATE gd_buffer USING '~ '.
      DO.
        it_mess_att = gd_buffer.
        APPEND it_mess_att.
        SHIFT gd_buffer LEFT BY 255 PLACES.
        IF gd_buffer IS INITIAL.
          EXIT.
        ENDIF.
      ENDDO.
    ENDFORM.
    *       FORM process_email                                            *
    FORM process_email.
      DESCRIBE TABLE it_mess_att LINES gd_recsize.
      CHECK gd_recsize > 0.
      PERFORM send_email USING p_email1.
    *  perform send_email using p_email2.
    ENDFORM.
    *       FORM send_email                                               *
    *  -->  p_email                                                       *
    FORM send_email USING p_email.
      CHECK NOT ( p_email IS INITIAL ).
      REFRESH it_mess_bod.
    * Default subject matter
      gd_subject         = 'Subject'.
      gd_attachment_desc = 'Attachname'.
    *  CONCATENATE 'attach_name' ' ' INTO gd_attachment_name.
      it_mess_bod        = 'Message Body text, line 1'.
      APPEND it_mess_bod.
      it_mess_bod        = 'Message Body text, line 2...'.
      APPEND it_mess_bod.
    * If no sender specified - default blank
      IF p_sender EQ space.
        gd_sender_type  = space.
      ELSE.
        gd_sender_type  = 'INT'.
      ENDIF.
    * Send file by email as .xls speadsheet
      PERFORM send_file_as_email_attachment
                                   tables it_mess_bod
                                          it_mess_att
                                    using p_email
                                          'Example .xls documnet attachment'
                                          'PDF'
                                          gd_attachment_name
                                          gd_attachment_desc
                                          p_sender
                                          gd_sender_type
                                 changing gd_error
                                          gd_reciever.
    ENDFORM.
    *       FORM delete_spool                                             *
    FORM delete_spool.
      DATA: ld_spool_nr TYPE tsp01_sp0r-rqid_char.
      ld_spool_nr = gd_spool_nr.
      CHECK p_delspl <> c_no.
      CALL FUNCTION 'RSPO_R_RDELETE_SPOOLREQ'
           EXPORTING
                spoolid = ld_spool_nr.
    ENDFORM.
    *&      Form  SEND_FILE_AS_EMAIL_ATTACHMENT
    *       Send email
    FORM send_file_as_email_attachment tables it_message
                                              it_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.
    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.
      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[] = it_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.
    reward  points  if it is usefull ....
    Girish

  • Sending document as an email attachment

    I have just installed pages '08 and trying to find out how to send a document as an email attachment. I accustomed to using Word, which has "send as an attachment" in the File menu, which is very convenient, since it takes a couple of seconds and you don't have to save and find files to drop into the email.
    Does Pages have anything like this?

    Pages doesn't have a function like that, and in fact Pages files are a bit cumbersome to mail, since they need to be archived (compressed/"zipped") first, to ensure they get sent correctly. In other words, the process is to select the document in the Finder, in the File menu choose "Create Archive" and then attach the resulting file to the email.
    There is a trick however that will make doing this easier -- if you have a saved Pages file, you can go up to the title bar and Control-click on the icon next to the file name. This action will produce a dropdown menu that lists the path to the file. The item just below the file name is the folder that the file is in -- if you choose that item, you will see a Finder window for that folder pop up, with the file name highlighted. You can now immediately go to the Finder's File menu and choose Create Archive. This technique means you don't have to hunt around for where the file is located on your computer, and can speed things up a bit. (This Control-click on the proxy icon works in all windows in OS X, not just for Pages.)

  • Send Report output as Email attachment (PDF)

    Hi Experts,
      i am trying to send the contents of an internal table from my report as email using PDF attachment. I have coded the logic and i get the attachment in the email. When i try to open the attachement, i cannot open it.
    The message i get is "_Adobe reader could not open the attachment "attach.pdf" because it is either not a supported file type or the file has been damaged(for example, it was sent as an email attachment and wasn't correctly decoded )._
    Not sure where i went wrong.
      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[] = it_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.                    "send_file_as_email_attachment

    Hello RnB,
    You can check the mentioned link for the same:
    [Simple Program to generate PDF from ABAP List Output.|http://www.abapmadeeasy.com/2011/02/sap-abap-simple-program-to-generate-pdf.html]
    Regards,
    Uttam Agrawal

  • Send report as an email attachment from a page

    Hi
    I have page which generates a report based on two filters. After the report is generated, 'I want to send that report as an email attachment from that page, when button is clicked "Send Email"
    Thanks a lot in advance.'

    I accomplished functionality I believe similar to what you are looking for in an application once by querying a report into an html e-mail message. This approach gives you all kinds of flexibility. At least this would be one way of doing it. I am going to include a simplified sample here of what the script looked like. I hope this is at least helpful.
    DECLARE
    l_body_html CLOB;
    BEGIN
    l_body_html :=
    '<html>
    <head>
    <style type="text/css">
    body{font-family: Arial, Helvetica, sans-serif;
    font-size:9pt;
    margin:30px;
    background-color:#ffffff;}
    </style>
    </head><body>
    ' || UTL_TCP.crlf;
    l_body_html :=
    l_body_html || '<table border="1"><tr bgcolor="#999999">
    <th width="75" scope="col">
    Department
    </th>
    <th width="75" scope="col">
    Course
    </th>
    </tr>' || UTL_TCP.crlf;
    FOR c1 IN (SELECT some_table.DEPARTMENT, some_table.COURSE FROM some_table)
    LOOP
    l_body_html :=
    l_body_html || '<tr><td>
    ' || c1.DEPARTMENT || '
    </td>' || UTL_TCP.crlf;
    l_body_html := l_body_html || '<td>
    ' || c1.COURSE || '
    </td>' || UTL_TCP.crlf;
    l_body_html := l_body_html || '</tr>' || UTL_TCP.crlf;
    END LOOP;
    l_body_html := l_body_html || '</table>' || UTL_TCP.crlf;
    apex_mail.send(
    p_to => '<some email address>',
    p_from => '<desired from address here>',
    p_body => NULL,
    p_body_html => l_body_html,
    p_subj => '<desired subject line here>');
    END loop;
    apex_mail.push_queue;
    END;
    Edited by: stbrownOSU on Dec 8, 2009 2:53 PM
    I think something must have happened when I copied and pasted the code from TOAD. I have corrected the above code. Please try it again.

  • Send payload content as email attachment

    Hi all
    I have a field in the source structure, the content of this field/tag has to be sent as an email attachment.
    Appreciate your help in advance
    -Keerthi

    Hi,
    Try using a receiver mail adpater, you can send the payload data as attachment.
    http://help.sap.com/saphelp_tm60/helpdata/en/6b/4493404f673028e10000000a1550b0/content.htm
    Thanks,
    Pragati

  • Send destination message in email attachment

    I have a source schema(let A) and it is converted into destination schema(let B) through mapping.The destination message is sent to a file location.Now I want to send this destination message in email attachment through c# code.but the destination message
    should be pick up from orchestration not from send file location.
    how it is possible ?

    Are you talking about sending your message as an attachment through the orchestration? Well that is what the SMTP Adapter is for. Refer
    http://winterdom.com/2005/08/smtpadapterinbts2006andhtmlformattedmessages and the official document on SMTP Adapter @http://msdn.microsoft.com/en-us/library/aa578267.aspx
    To receive mails into an orchestration, you should have a POP3 enabled e-mail account, use the POP3 Adapter with the MIME/S-MIME Pipeline Components to pick-up and read the mails from BizTalk.
    Regards.

  • Send PDF-Spool via email-Attachment

    Hi,
    i send an internal table to spool and convert it.
    this works ok.
    But when i send it via
       CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
    i have problem with the attachment (PDF-Error).
    Has anyboby a codeexample?
    Here my short report until Conversion into PDF
    REPORT ZGRO_TEST.
    TABLES: MARA.
    DATA: BEGIN OF ITAB OCCURS 0.
            INCLUDE STRUCTURE MARA.
    DATA: END   OF ITAB.
    DATA: FILESIZE     TYPE I.
    Spoolnummer
    DATA: SPOOL_NR     LIKE TSP01-RQIDENT.
    PDF Ausgabetabelle
    DATA: BEGIN OF PDF_OUTPUT OCCURS 0.
            INCLUDE STRUCTURE TLINE.
    DATA: END   OF PDF_OUTPUT.
    START-OF-SELECTION.
      SELECT * FROM MARA INTO TABLE ITAB UP TO 100 ROWS.
    Ausgabe in Spool umleiten
      NEW-PAGE PRINT ON LINE-SIZE 255
                     NO DIALOG
                     NO-TITLE
                     NO-HEADING
                     IMMEDIATELY ' '.
    interne tabelle ausgeben
      LOOP AT ITAB.
        WRITE:/ ITAB.
      ENDLOOP.
    Rücksetzen Spollausgabe auf Bildschirm.
      NEW-PAGE PRINT OFF.
    Spoolnummer besorgen
      SPOOL_NR = SY-SPONO.
      CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
           EXPORTING
                SRC_SPOOLID   = SPOOL_NR
           IMPORTING
                PDF_BYTECOUNT = FILESIZE
           TABLES
                PDF           = PDF_OUTPUT.
    END-OF-SELECTION.
    How can i use the PDF_OUTPUT as email attachment?
    Thanks for help.
    Regards, Dieter

    after you get the pdf output:
    do like this:
      LOOP AT it_pdf_output.
        TRANSLATE it_pdf_output USING ' ~'.
        CONCATENATE gd_buffer it_pdf_output INTO gd_buffer.
      ENDLOOP.
      TRANSLATE gd_buffer USING '~ '.
      DO.
        it_mess_att = gd_buffer.
        APPEND it_mess_att.
        SHIFT gd_buffer LEFT BY 255 PLACES.
        IF gd_buffer IS INITIAL.
          EXIT.
        ENDIF.
      ENDDO.
    REFRESH it_mess_bod.
    Default subject matter
      gd_subject         = 'Subject'.
      gd_attachment_desc = 'Attachname'.
    CONCATENATE 'attach_name' ' ' INTO gd_attachment_name.
      it_mess_bod        = 'Message Body text, line 1'.
      APPEND it_mess_bod.
      it_mess_bod        = 'Message Body text, line 2...'.
      APPEND it_mess_bod.
    If no sender specified - default blank
      IF p_sender EQ space.
        gd_sender_type  = space.
      ELSE.
        gd_sender_type  = 'INT'.
      ENDIF.
    Send file by email as pdf   PERFORM send_file_as_email_attachment
                                   tables it_mess_bod
                                          it_mess_att
                                    using p_email
                                          'Example .pdf documnet attachment'
                                          'PDF'
                                          gd_attachment_name
                                          gd_attachment_desc
                                          p_sender
                                          gd_sender_type
                                 changing gd_error
                                          gd_reciever.
    FORM send_file_as_email_attachment tables it_message
                                              it_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.
    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.
      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[] = it_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.
    Regards,
    Ravi

  • Do not know how to take a saved doc and send it as an email attachment in my gmail account

    how do i take a scanned doc, saved in my doc folder and send it as an email to recipient.
    I get confirmation that it was sent but person says it was not attached

    Hi,
    The following is the program[Click Here| http://saptechnical .com/Tips/ABAP/email/EmailProgram.txt] which will send any format file. Actual Creator of the program is Amit Bisht.
    Thanks & Regards,
    Rock.

  • Sending SmartForm as E-mail attachment, with email subject and content

    Hi,
    I'm, e-mailing a SmartForm using the SmartForm parameters (MAIL_RECIPIENT, MAIL_SENDER and MAIL_APPL_OBJ) using control device 'MAIL'.
    Create MAIL_RECEPIENT (swotobjid): CREATE_RECIPIENT_OBJ_PPF
    Create MAIL_SENDER (swotobjid): CREATE_SENDER_OBJECT_PPF
    Create MAIL_APPL_OBJ: This works a little different. The sender needs to have an SAP Office Inbox (SO_USER_AUTOMATIC_INSERT) where a folder is to be created using the marco's swc_create_object and swc_object_to_persistent (INCLUDE <cntn01>).
    Everything works fine.
    The mail is being send and the SmartForm can be accessed as attachment, the E-Mail subject (as the name of the attachment) is taken from the title of the SmartForm (output_options-tdtitle).
    QUESTION *
    No they want to change the E-mail subject en change the content(body) of the mail.
    Is this possible within the options of the MAIL_APPL_OBJ.
    Or do have to rebuild the SmartForm program, get the SmartForm as OTF, rebuild as PDF en mail the PDF to the recepient using the SO_NEW_DOCUMENT_ATT_SEND_API1.
    I was thinking of creating a container and set the elements of that container (swc_set_table ?) but I don't no in the end if this woll work.

    Refer the following Blog-
    http://www.sdn.sap.com/irj/scn/weblogs;jsessionid=(J2EE3417300)ID0426134050DB01517382336190791762End?blog=/pub/wlg/1798
    generate filename as yesterday's yyyymmdd format, and it must send file with same name with yyyymmdd
    You need to use the following UDF to generate yesterday's date-
    Imports: java.text.;java.util.;
    public String yesterday(Container container)
    long oneDay = (long) 1000.0 * 60 * 60 * 24;
    DateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
    java.util.Date today = new java.util.Date(System.currentTimeMillis());
    java.util.Date yesterday = new java.util.Date(System.currentTimeMillis()-oneDay);
    String b = dateFormat.format(yesterday);
    return b;
    Map this with Content_Disposition as mentioned in wiki.
    XI 3.0 message must be executed one a day automatically (for example at 9.00 Am).
    Use 'Availability Time planning' for CC as mentioned above.
    http://help.sap.com/saphelp_nw70/helpdata/EN/45/06bd029da31122e10000000a11466f/content.htm

Maybe you are looking for

  • Is there a method to check that a double is not null

    Hi all, I am trying to verify that a user has entered a double value when my system asks for the price of an item. I have tried doing if (price == null) throw new Exception ().. but that gives me a compiler error saying that null cannot be applied to

  • Develop a report program

    How to get  tcode  users and its authorization,restrictions Moderator message : Search for available information, thread locked. Edited by: Vinod Kumar on Nov 10, 2011 11:06 AM

  • Why does my Mbox keep disconnecting from Logic?

    Anytime I use my Mbox as an audio driver for picking up vocals or audio from my MPC1000 it works for a bit and then out of no where disconnects..what's up w/ that? any advice?..does Logic not like third party hardward??.. thanx in advance..

  • Please find the sound driver for pavilion dv4 1365dx

    I just downgrade vista from XP. However I cannot find any sound driver from my laptop...: ( I ve been tring all the drivers in realtek driver supports, but it did not work : ( Please help me  Message Edited by acaiself on 07-23-2009 09:01 PM Message

  • I just want to unregister my Iphone how do I do that online

    I have called the number provided but they are not working right now so I have to wait for their business hours. Meanwhile my phone is not receiving texts. I have never liked Iphone and only got it because it was free with my upgrade. I just want to