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

Similar Messages

  • Trouble send PDF file by email

    Hi I down loaded the new ios7 app and since then I have had trouble sending PDF files via email can any 1put any light in it?

    Just like any other file...
    On Sat, Mar 7, 2015 at 12:16 AM, larrys19338374 <[email protected]>

  • How to send .CSV file via email in Oracle10g/11g PL/SQL

    Hi Guys,
    Can any one let me know or suggest me how to send .csv file via email attachment using Oracle PL/SQL.
    Thanks in advance!
    Regards,
    LRK

    A FAQ. Use UTL_MAIL (if attachment is 32KB less). Else use UTL_SMTP. Search this forum. Search using google.

  • Send spool list ceated by Job (SM36) as pdf-file via email

    We are running the report RM06EFLB (Transaktion ME84 - "Create Releases") in the background.
    The Job is creating a spool list with 17 pages.
    I want to send this 17 pages (in a readable form) to a number of persons.
    This did I try so far:
    - Distribution list with Recipient type "via Internet" as Spool list recipients in the Job. (Tried different formats for ABAP List in Transaction SCOT)
    => Email is send to recipients, attachment is readable depending on format.
         Problem: attachment is not complete, it contains only about 15 pages (985 rows).
    - Distribution list with Recipient type "Internal User - SAP-Office" as Spool list recipients in the Job.
    => Document is sent to Business Workplace
         Problem:  attachment is not complete, it contains only about 15 pages
    Any ideas how to get the complete spool list?
    Is there mayby a report around  that is sending a spool list as pdf-file via email to a number of recipients?
    (Would like to maintain this Report as an additional step in the job. The spool-number should be selected from the previous step.)
    Thank you for your help.
    Jens

    Oh sorry - here is the coding which is used in that program:
    First use function module  'CONVERT_ABAPSPOOLJOB_2_PDF' to convert the spool entry into pdf.
    Loop at output table PDF and concatenate all lines into a string. Convert string to xstring.
    Then call mail class:
    DATA: lv_pdf_x TYPE xstring,
            lv_subject TYPE string,
            lv_doc_desc TYPE so_obj_des,
            lv_mail_body TYPE soli_tab.
      DATA: ls_atta TYPE rcf_s_att4mail_hex,
            lt_atta TYPE rcf_t_att4mail_hex.
    * -- Fill parameter
      lv_subject = 'Requested Report'."#EC NOTEXT
      lv_doc_desc = 'Report XXL'."#EC NOTEXT
    *  lv_mail_body = ?
      ls_atta-name = lv_doc_desc.
      ls_atta-extension = 'PDF'.
      ls_atta-content = p_pdf_x. <- This is your xstring
      APPEND ls_atta TO lt_atta.
      TRY.
          CALL METHOD cl_hrrcf_services_mail=>send_web_mail
            EXPORTING
              p_subject              = lv_subject
              p_receiver             = p_receiver->email_address
              pt_atta_hex            = lt_atta
              p_sender               = p_sender->email_address
              p_body_c               = lv_mail_body.
        CATCH cx_hrrcf.
      ENDTRY.
    I hope that you have the above mentioned class in your system but it should work with other email functions as well.
    Regards
    Nicola

  • How Can I Disallow Sending a PDF Document via Email?

    http://www.tek-tips.com/viewthread.cfm?qid=1528701&page=1
    nha khoa.com/showthread.php?t=145
    I'm using Adobe Acrobat 8 Standard.
    I've gotten the test document setup in such a way that at least the typical person could not print it, send it as an email attachment, nor save the file within Adobe Reader 8.
    However, if that same person were to open the file with Foxit PDF reader, they could email it as an attachment (though they can't do the others).
    What I want to know is if there is a way to specifically disallow a pdf file from being sent as an attachment from within the pdf application? For Adobe, I just had to check the box next to "hide menu bar" and "hide tool bars", but leave "hide window controls" unchecked.
    But of course, Foxit reader, and I'd imagine others, don't recognize the code for the display defaults. So for those, I'd need something else. I did not see an option under security for disabling email. Is there any way to do so?
    The PDF files will be shared via a SharePoint site. So if there is some other better way of locking them down via SharePoint, that'd be fine as well.
    I'll post more detail if need be. Thanks for any suggestions.
    "If to err is human, then I must be some kind of human!" -Me

    There's no way to prevent someone attaching a PDF to an email (or any other file-level operation on it) - to view a PDF it MUST be downloaded to the client's computer, and once there it's a regular file just like any other. There is no "streaming" concept within PDF.
    You can secure the PDF so only certain people can open it (for example using certificate policies or even DRM) but they can still move the file about - it's only at the stage of opening it where the security control starts.
    And you're correct - non-DRM 'permissions' security on a PDF is largely just smoke and mirrors for anyone who can open the file, as removing your print/edit/display preferences is a 10-second job. The only real case of a PDF being "uncrackable" is if the document has a very long OPEN password and the user doesn't know what it is. If they can get as far as seeing the pages on their screen, they can do pretty much anything with it.

  • TS3276 I need to send a photo via email as an attachment and not it shown in the body of the email?

    I need to send a photo via email as an attachment and NOT have it shown in the body of the email?  Please help.

    To make attachments not appear in the body of the e-mail as a default, try using the Applications/Utilities/Terminal command below. I suggest copy and paste.
    defaults write com.apple.mail DisableInlineAttachmentViewing -bool YES

  • Starting yesterday I can scan a pdf file in from the scanner and can not send a pdf in an email attachment

    Starting yesterday I can scan a pdf file in from the scanner and can not send a pdf in an email attachment.  What happened?  Windows 8

    Adobe Reader can't scan documents. What software do you use?

  • 'send to' widget? I need to send pdf without downloading and attaching to an email (one click send function)

    Is there a 'send to' widget I can attach to a pdf document or form to send pdf without downloading and attaching to an email (one click send function)

    From this conversation's thread it appears that Acrobat is not the application / service at issue.
    As this user forum has as its focus "Acrobat" it seems that the OP is in the wrong place.
    Acrobat's one click send feature provides the user a "draft" email. The user still has to process ("click") through steps with the email client/service to actually get the email out and on its way.
    I'm sure that "one click" does everything is available somewhere. Considering all it'd have to do and do right it'd be rather expensive.
    Be well...

  • Producing a narrated slideshow, save and send via email attachment?

    I'm wondering if one can produce a slides show in keynote, add narrative to it, save it in a iMovie or some other format, and be able to send it as a stand alone presentation to someone via email attachment or clickthrough on a website.
    Is it possible to do with within the Apple family of products? If so, how do you add the narrative and in what format should it be saved?
    I need to be able to give clients a sample of a live presentation. Not the talking head, but the slide content with voice over.
    Any suggestions or experience would be greatly appreciated.

    Garageband, iMovie, iPhoto and QuickTime Pro can make your file and save (export) to a QuickTime file format. Keynote could "make" the video portion (export to QuickTime formats). QuickTime Pro can "record" audio (supported device required). A "mix and match" use of these apps could help reduce the file size.
    Things to consider:
    Email has file size limits on attachments and even a very short file would probably exceed them. You could post your file on any "server" and just send a link to the file in your email.

  • How do I send a page via email in the body of the mail and not as an attachment?

    I wish to send a page via email in the body of the mail. The only option to send a page appears to be to save it first and then attatch to the mail.

    When you are in the Plan View, right click on the icon for the page that you want to omit from the menu. Near the bottom, you'll see Menu Options, click on that and you'll have the choice to Exclude Page from Menus.

  • Sending 'Dunning Letters' via Email ? - -has anyone succeeded ??

    Hi
    Has anyone had any joy with sending Dunning letters via email at all
    We can get it to work via FAX , but get the following error when trying to send via email
    'connection error on node'
    even tho, there is nothing wrong with the node at all
    via SCOT , we have the default conversion as 'raw text to txt'   which works with everthing else
    If we change to 'raw text' to 'pdf'  we actually get two PDF's - one is blank however
    When viewed via SOST, you cannot open it straight up, you have to open an attachment
    when we queried this with SAP, they say that dunning letters are set up to open as attachments
    The function module is almost identical to that used by statements and remiitances, which works absolutely fine
    I have posted this on a more technical forum as it is not an FI issue, it is a technical problem, which i hope someone has come across and able to resolve for us
    Many thanks
    Tony

    Hi
    Have you see SAP Note 1042992 - Dunning by mail w/ SAPscript: Introductory text w/ attachmnt? Please, check the steps that this note suggests. At a release 46B I did with the enhancement F150D001 (at ECC 5.0 it is too), and you have a demo coding in include LX150F01.
    I hope this helps you
    Regards
    Eduardo
    PD: I forgot, according your coding check what is the email address for the customer, if the customer doesn't have email, then the letter goes to the SPOOL order. Check it in the include ZX* or in the BTE.
    Edited by: E_Hinojosa on Mar 1, 2012 5:22 PM

  • 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.

  • Can't send PDF as a mail attachment from iPad to a Lotus Notes account

    Hello, I have some problems sending PDF documents as email attachments from my iPad. Using the adobe reader app for iOS, I create an email with the file attached. Sending this to e.g. a hotmail account works fine. However, if I send it to any address at my company, where Lotus Notes is the standard, the attachment seems to be converted into a text file. Is this a known issue with the reader for iPad, or should I rather be looking to IT support at my company for help?

    Download QuickOffice, which Google is now making available for free:
    https://itunes.apple.com/us/artist/quickoffice-inc./id294258240?mt=8
    You can open the XLS attachment in that app, then transfer the document to your Mac via the USB cable. You can then print from the Mac.
    Printing from your iPad doesn't work via Bluetooth either, by the way.
    Regards.

  • Need to send Smart form via email through Driver program

    Hi All,
    We need to send smart form via email through a new driver program (z program). Can you please guide me on this.
    I have used the following code to achieve this. We are getting message saying 'Mail request has created' when executed, but the mail is not sent.
    lvs_comm_type = 'INT'.
    lvs_comm_values-adsmtp-SMTP_ADDR = e_mail.
    lvs_comm_values-adsmtp-R3_USER = 'X'.
    lvs_comm_values-adsmtp-ENCODE = '0'.
    call function 'CONVERT_COMM_TYPE_DATA'
    exporting
    pi_comm_type = lvs_comm_type
    pi_comm_values = lvs_comm_values
    pi_screen = ' '
    pi_newid = 'X'
    importing
    pe_itcpo = lvs_itcpo
    pe_device = lvf_device
    pe_mail_recipient = p_mail_recipient
    pe_mail_sender = p_mail_sender
    exceptions
    comm_type_not_supported = 1
    recipient_creation_failed = 2
    sender_creation_failed = 3
    others = 4.
    if sy-subrc ne 0.
    raise COMMUNICATION_ERROR.
    endif.
    control_parameters-device = 'MAIL'.
    output_options-TDIMMED = 'X'.
    output_options-TDDELETE = 'X'.
    CALL FUNCTION fm_name
    exporting
    CONTROL_PARAMETERS = control_parameters
    MAIL_RECIPIENT = mail_recipient
    MAIL_SENDER = mail_sender
    OUTPUT_OPTIONS = output_options
    USER_SETTINGS = space
    EXCEPTIONS
    FORMATTING_ERROR = 1
    INTERNAL_ERROR = 2
    SEND_ERROR = 3
    USER_CANCELED = 4
    OTHERS = 5.
    Thank you

    Hi,
    For sending smartform output into mail you first have to generate spool request and convert it into PDF and then
    only it can be sended into mail, please find the sample code in the mail below:
    http://wiki.sdn.sap.com/wiki/display/sandbox/ConversionofSpoolRequestDataintoPDFandExcelFormatandSenditintoMail
    Mansi
    Edited by: Matt on Jan 29, 2010 8:25 AM - removed code, instead point to wiki that Mansi authored.

  • PDF FILE AS EMAIL ATTACHMENT

    Dear Experts,
                              How to send pdf file as email atachment, can some one give me some codings or links.
    Thanks and REgards,
    Thirukumaran. R

    Mailing is possible when i open the pdf file it's giving the  decoding  error
    i here with attached the codings for ur ref.
    FUNCTION Z_HRFM_SEND_OFFERLETTER_MAIL.
    *"*"Local Interface:
    *"  IMPORTING
    *"     VALUE(IV_APPLID) TYPE  PERSNO
    *"     VALUE(IV_REPMGR) TYPE  PERSNO
    *"     VALUE(IV_CONTROLMGR) TYPE  PERSNO
    *"     VALUE(IV_REPFMGR) TYPE  PERSNO
    *"     VALUE(IV_ACTION) TYPE  MASSN
    *"     VALUE(JOIN_1000) TYPE  DATS
    *"     VALUE(POSITION_1000) TYPE  STEXT
    *"     VALUE(PLACE_1000) TYPE  ORT01
    *"     VALUE(LOC_1000) TYPE  ORT01
    *"     VALUE(GROSS_1000) TYPE  NUMC7
    *"     VALUE(BASIC_1000) TYPE  NUMC5
    *"     VALUE(CONV_1000) TYPE  NUMC5
    *"     VALUE(FOOD_1000) TYPE  NUMC5
    *"     VALUE(VAR_1000) TYPE  NUMC5
    *"     VALUE(PERNR1_1000) TYPE  PERSNO
    *"     VALUE(COMP_ADD) TYPE  CHAR200
    *"  EXCEPTIONS
    *"      APPLICANT_NOT_FOUND
    *"      REPFORM_MGR_NOT_FOUND
    *"      REPMGR_NOT_FOUND
    *"      CONTROLMGR_NOT_FOUND
    *"      NO_EMAILID_FOUND
    *"      SENT
    *"      NOT_SENT
    *&   CREATION INFORMATION                                                                       *
    *&   AUTHOR           : thiruKumaran
    *&   CREATION DATE    : 29.07.2009                                                            *
    *&   TRANSPORT REQUEST:                                                              *
    *&   FUNCTIONAL SPEC# :                                                                         *
    *&   TECHNICAL SPEC#  :                                                                         *
    *&   PURPOSE          :
    * Local Variable Declaration
    data : EV_APPLNAME  TYPE  EMNAM,
    EV_REPMGR_NAME  TYPE  EMNAM,
    EV_CONTROLMGR_NAME  TYPE  EMNAM,
    EV_CONTROLMGR_GEN TYPE  CHAR2,
    EV_REPMGR_GEN TYPE  CHAR2,
    EV_APPL_GEN TYPE  CHAR2,
    EV_REPFORM_GEN  TYPE  CHAR2,
    EV_REPFORM_NAME TYPE  EMNAM,
    EV_STRAS  TYPE  STRAS,
    EV_ORT01  TYPE  ORT01,
    EV_ORT02  TYPE  ORT02.
      DATA : l_APPname         TYPE  emnam,
             l_evaluation_date TYPE begda,
             l_extension_date  TYPE begda,
             l_emailid         TYPE comm_id_long,
             tab_lines         TYPE sy-tabix,
             fm_name           TYPE rs38l_fnam.
    data:/1BCDWB/FORMOUTPUT type  FPFORMOUTPUT ,
         /1BCDWB/DOCPARAMS  type SFPDOCPARAMS ,
         ie_outputparams   type SFPOUTPUTPARAMS .
    DATA : CONTENTS_HEX TYPE  SOLIX.
    * Structure Declaration
      DATA : s_job_info       TYPE ssfcrescl,
             s_control_param  TYPE ssfctrlop,
             s_composer_param TYPE ssfcompop,
             s_doc_data       TYPE sodocchgi1.
    * Internal Table Declaration
      DATA : i_otfdata      TYPE TABLE OF itcoo,
             i_pdf          TYPE TABLE OF solisti1,
             i_pdfdata      TYPE TABLE OF tline,
             i_receivers    TYPE TABLE OF somlreci1,
             i_packing_list TYPE TABLE OF sopcklsti1,
             i_message      TYPE TABLE OF  solisti1.
    *& Work area declaration.
      DATA : w_receivers    LIKE LINE OF i_receivers,
             w_packing_list LIKE LINE OF i_packing_list,
             w_message      LIKE LINE OF i_message.
      CALL FUNCTION 'Z_HRFM_GET_OFFERED_DATA'
        EXPORTING
          IV_APPLID                   = IV_APPLID
          IV_REPMGR                   = IV_REPMGR
          IV_CONTROLMGR               =  IV_CONTROLMGR
          IV_REPFMGR                  = IV_REPFMGR
          IV_ACTION                   = IV_ACTION
       IMPORTING
         EV_APPLNAME                 = EV_APPLNAME
         EV_REPMGR_NAME              = EV_REPMGR_NAME
         EV_CONTROLMGR_NAME          = EV_CONTROLMGR_NAME
         EV_CONTROLMGR_GEN           = EV_CONTROLMGR_GEN
         EV_REPMGR_GEN               = EV_REPMGR_GEN
         EV_APPL_GEN                 = EV_APPL_GEN
         EV_REPFORM_GEN              = EV_REPFORM_GEN
         EV_REPFORM_NAME             = EV_REPFORM_NAME
         EV_STRAS                    = EV_STRAS
         EV_ORT01                    = EV_ORT01
         EV_ORT02                    = EV_ORT02
       EXCEPTIONS
         APPLICANT_NOT_FOUND         = 1
         REPFORM_MGR_NOT_FOUND       = 2
         REPMGR_NOT_FOUND            = 3
         CONTROLMGR_NOT_FOUND        = 4
         OTHERS                      = 5.
      IF sy-subrc  = 1.
        RAISE applicant_not_found.
      ELSEIF sy-subrc  = 2.
        RAISE repform_mgr_not_found.
      ELSEIF sy-subrc = 3.
        raise    REPMGR_NOT_FOUND.
        ELSEIF sy-subrc = 4.
          raise CONTROLMGR_NOT_FOUND .
      ENDIF.
    *finding email id of applicant
      SELECT SINGLE usrid_long INTO l_emailid FROM pb0105
        WHERE pernr = IV_APPLID AND subty = '0010' AND endda = '99991231'."#EC *
      IF sy-subrc <> 0.
        RAISE no_emailid_found.
      ENDIF.
    *  s_control_param-no_dialog = 'X'.
    *  s_control_param-getotf    = 'X'.
    *  s_composer_param-tddest   = 'LP01'.
    *  s_composer_param-tdnoprev = 'X'.
    * Sending PDF by mail
    CALL FUNCTION  '/1BCDWB/SM00000046'    "'ZHR_OFFER_FORM'
    *"'/1BCDWB/SM00000046'
      EXPORTING
       /1BCDWB/DOCPARAMS        = /1BCDWB/DOCPARAMS
        APPLICANT_NAME           = EV_APPLNAME
        POSITION                 = POSITION_1000
        JOINING_DATE             = join_1000
        REPFORM                  = EV_REPFORM_NAME
        REPMGR                   = EV_REPMGR_NAME
        CONTROLMGR               = EV_CONTROLMGR_NAME
        PLACE                    = PLACE_1000
        APPLICANT_GENDER         = EV_APPL_GEN
        BASE_PLACE               = loc_1000
        REPMGR_GENDER            = EV_REPMGR_GEN
        REPFORM_GENDER           = EV_REPFORM_GEN
        CONTROLMGR_GENDER        = EV_CONTROLMGR_GEN
        GROSSS                   = gross_1000
        BASIC                    = basic_1000
        CONVEYANCE               = conv_1000
        FOOD                     = food_1000
        VARIABLE                 =  var_1000
        CITY                     = ev_ORT01
        DISTRICT                 = ev_ORT02
        ADDRESS                  = ev_stras
        C_DATE                   = sy-datum
        APPLICANTID              = pernr1_1000
        comp_address             = comp_add
    IMPORTING
       /1BCDWB/FORMOUTPUT       = /1BCDWB/FORMOUTPUT
    EXCEPTIONS
       USAGE_ERROR              = 1
       SYSTEM_ERROR             = 2
       INTERNAL_ERROR           = 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.
    *data : binary_tab.
    call function 'SCMS_XSTRING_TO_BINARY'
      exporting
        buffer                = /1BCDWB/FORMOUTPUT-PDF
      tables
        binary_tab            = I_PDFDATA.
    REFRESH i_pdf[].
      CALL FUNCTION 'SX_TABLE_LINE_WIDTH_CHANGE'
          EXPORTING
            line_width_dst = '255'
          TABLES
            content_in     = i_pdfdata
            content_out    = i_pdf.
        DESCRIBE TABLE i_pdf LINES tab_lines.
    ****for mailing********
        w_receivers-receiver = l_emailid.
        w_receivers-rec_type = 'U'.
        w_receivers-com_type = 'INT'.
        APPEND w_receivers TO i_receivers .
        s_doc_data-obj_name =  text-001.
        s_doc_data-obj_descr = text-001.
        CLEAR w_packing_list-transf_bin.
        w_packing_list-head_start = 1.
        w_packing_list-head_num   = 0.
        w_packing_list-body_start = 1.
        w_packing_list-doc_type   = 'RAW'.
        w_packing_list-body_num   = tab_lines.
        APPEND  w_packing_list TO i_packing_list.
        CLEAR w_packing_list.
        w_packing_list-transf_bin = 'X'.
        w_packing_list-head_start = 1.
        w_packing_list-head_num   = 1.
        w_packing_list-body_start = 1.
        w_packing_list-doc_type   = 'PDF'.
        w_packing_list-body_num   = tab_lines.
        w_packing_list-doc_size   = tab_lines * 255.
        w_packing_list-obj_descr  = text-001.
        w_packing_list-obj_name   = text-001.
        APPEND  w_packing_list TO i_packing_list.
    *& Writing mail message
      concatenate  'Hi' EV_APPLNAME into l_APPname separated by space.
      w_message = L_APPNAME.
      APPEND w_message TO i_message.
      w_message = text-009.
      APPEND w_message TO i_message.
      w_message = text-002.
        APPEND w_message TO i_message.
      w_message = text-990.
      APPEND w_message TO i_message.
      w_message = text-003.
        APPEND w_message TO i_message.
      w_message = text-990.
      APPEND w_message TO i_message.
      w_message = text-004.
      APPEND w_message TO i_message.
      w_message = text-005.
      APPEND w_message TO i_message.
        "Call the FM to post the message to SAPMAIL
        CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
          EXPORTING
            document_data              = s_doc_data
            put_in_outbox              = 'X'
            commit_work                = 'X'
          TABLES
            packing_list               = i_packing_list
            contents_txt               = i_message
    *        contents_bin               = i_pdf
            CONTENTS_HEX               = I_PDF
            receivers                  = i_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.
      raise sent.
      else.
        raise not_sent.
      endif.
    * To send mail immediatly
        IF sy-subrc = 0.
          WAIT UP TO 2 SECONDS.
          SUBMIT rsconn01 WITH mode = 'INT'
                               AND RETURN.
        ENDIF.
    ENDFUNCTION.
    can u give some suggestions,
    Thanks and REgards,
    Thirukumaran. R

Maybe you are looking for

  • Error during MR11 - Maintain GRIR Clearing Account

    Dear Forum, The users are trying to do the clearing of the unmacthed items of GRIR  thru MR11. However, the system gives the error message - Msg Type 'E' Msg No. 013 - Error during reading of the material XXXXX  or material locked. Could you please h

  • How to Create a Workflow Criteria

    Hi, I am planing to create a workflow to assign some tickets to particular analyst.My requirement is more than one items in description should pass the criteria. Ex: Priority 3 Ungency : Low Category : XYZ Sender :[email protected] All given examples

  • Two SubForms with one having dynamic table

    Hello, I am having a problem regarding subforms and dynamic tables.  Here is the situation: 1.  I have one main form where the content is "Flowed" 2.  I have two subforms, both have the content of "Positioned" 3.  The first subform has a dynamic tabl

  • Does Adobe Media Encoder save/export in swf format?

    Does Adobe Media Encoder save/export in swf format? If yes how? Thanks

  • Spool Retention for 1 month

    Hi All, I want to retain spool for 1 month.By default spool deletion date is set to sy-datum. I am using FM PRINT_OTF.In this FM there is one parameter which allows me to retain spool atmax for 8 days. Is there any other way or FM which will generate