Sending an attachment with an e-mail

Does anyone know how to send an attachment with an e-mail
using a
form page that is on our web site? I am using the TYPE
attribute of
the form tag as "File" to get the file I want to attach to
the e-
mail. Below is the code I have. The first page is where the
user can
click the browse button to search for a file to attach. The
second
page is where the e-mail should be sent to. Thanks for your
help.
Andy

Ian,
Do we have to set a folder up on our cold fusion server or do
we just
make a folder under our web site so when a user clicks on the
browse
menu, the file they attach has to be saved to our server
first and then
I can attach the saved file to an e-mail? How do we create
this folder?
Does it have to be an FTP site or just a folder on our web
site? How do
we make the permissions work correctly since a folder under
our web site
is not writable to except by the web editors that work here?
Please let
me know what I can do to get this to work. Thanks.
Andy
You can use any folder on the CF server or any system to
which it has
access. By default the CF service runs as a localsystem user,
so would
generally only have access to the local server file system.
This is
determined in the Services panel on window systems, I'm not
sure how it
works for other OS's.
If you are talking about the "Browse" button that is
displayed in the
web page for the <input type="file" ..> that does not
browse the server,
it browses the local user's system. You do not and can not
influence
this in any way. When a user selects a file from their system
and
submits the form, the file is uploaded to the webserver
through the HTTP
response header or URL query string, depending on whether the
form is a
post or get form.
You then use the <cffile action="upload" ...> tag on
the form's action
page to get the file from the web server and write it to a
location you
define the "file" parameter of the flag. This file system
access is
done under the permissions of the ColdFusion server, again
'LocalSystem'
by default.
You can then use this newly saved file in you <cfmailparam
...> tag to
attach it to an email. After this if you like you can use a
<cffile
action="delete" ...> to remove the file.

Similar Messages

  • When I send or receive e-mails, the icon showing that there is an attachment with the e-mail may or may not appear. I have spoken to Apple and they cannot fix.

    When I send or receive e-mails, the icon showing that there is an attachment with the e-mail may or may not appear. I have contacted Apple and they do not have a solution for this issue. This is a huge problem for me.

    No, the senders are in most case sending from corporate servers which are almost certainly not Mac based. Also, remember this happens when I send or receive. So if I send something with an attachment, the attachment will go through, but the sent box will not show the paper clip icon so that I can distinguish the emails sent with attachments versus the emails sent without attachments. I receive the attachments as well, but again the paper clip icon does not show up so that I can distinguish the emails that I have received that contain attachments. Recipients of my e-mails have complianed that when they receive an attachment from me they do not see the paper clip icon which alerts them to the fact that the email contains an attachment.

  • I have  Mac os x 106. When I try to send an attachment with email it won't send.  Please could someone help? Thank you.

    I have a Mac OS X 10.6 When I try to send an attachment with email it won't send - keeps saying 'fail'.  Please could someone help? Thank you.

    Hi lllaass! I replied to your post with the information you required but haven't heard from you since. If you don't, or can't help any further please would you let me know. Thanks.

  • Complete code to send an attachment with a text message using java mailapi

    complete code to send an attachment with a text message using java mailapi
    code should be free from error

    http://java.sun.com/products/javamail/FAQ.html#examples
    Was this code too hard to find?
    Was the FAQ too hard to find?

  • Need to send an attachment with the mail to the distribution list

    Hi all,
    How do I send an <b>attachment</b> with the e-mail to a distribution list?
    I am using the FMs <b>SO_DLI_EXPAND</b> and <b>SO_OBJECT_SEND</b> to expand the distribution list and send mail to the distribution list respectively.I am getting the contents of the file in the email that is being sent. The file is being extracted from UNIX.
    However, the contents of the file has to go as an attachment.
    Please assist.
    Thanks and regards,
    Anishur

    Hello,
    You can do it like this...using SapScript:
    REPORT YMAIL.
    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, would you check it?'.
    APPEND MAILTXT.
    Prepare Packing List
    PERFORM PREPARE_PACKING_LIST.
    BREAK gpulido.
    Set recipient - email address here!!!
    <b>*MAILREC-RECEIVER = '[email protected]'.
    MAILREC-RECEIVER = '[email protected]'.
    MAILREC-REC_TYPE = 'U'.</b>
    APPEND MAILREC.
    Set recipient - email address here!!!
    *MAILREC-RECEIVER = 'BGIRALDO'.
    *MAILREC-REC_TYPE = 'B'.
    *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.
    submit rsconn01 with mode = 'INT' and return.
    CASE SY-SUBRC.
    WHEN 0.
    WRITE: / 'Result of the send process:'.
    LOOP AT MAILREC.
    WRITE: / mailrec-RECEIVER(48), ':'.
    IF mailrec-RETRN_CODE = 0.
    WRITE 'sent successfully'.
    ELSE.
    WRITE 'not sent'.
    ENDIF.
    ENDLOOP.
    WHEN 1.
    WRITE: / 'no authorization to send to the specified number of'
    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
    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 = 'YSEND_MAIL'
    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.
    Reward points if helpful.
    Thanks
    Message was edited by:
            Pattan Naveen

  • Anyone knows how to send a attach with more than 255 characters in 4.6c ?

    Hi everyone,
    i´m tring to send a email with attach , my problem is that i have a itab with 2500 characters per line,
    and the FM 'SO_NEW_DOCUMENT_ATT_SEND_API1'  have the structure SOLISTI1 thats supports only 255 char. i tried to converto to PDF and XLS ,but when i open the attach only appers the first 255 char in each line only. any ideia for that issue?
    Thanks,
    Shimada
    Edited by: Fernando Shimada on May 5, 2009 8:28 PM

    here is part of my code that i tried:
    first: i write the lines of my itab and after did that
      CALL FUNCTION 'SAVE_LIST'
           EXPORTING
                list_index = '0'
           TABLES
                listobject = list_object.
      CALL FUNCTION 'LIST_TO_ASCI'
           TABLES
                listasci           = list_asci
                listobject         = list_object
           EXCEPTIONS
                empty_list         = 1
                list_index_invalid = 2
                OTHERS             = 3.
      APPEND LINES OF t_saida TO t_objbin.
      DESCRIBE TABLE t_objbin LINES v_lines_ane.
    second: do a alv report and tried to convert to pdf ,but the pdf have the same problem
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
           EXPORTING
                i_callback_program = sy-cprog
                it_fieldcat        = t_fieldcat[]
                is_layout          = w_layout
                is_print           = wa_pr
           TABLES
                t_outtab           = t_alv
           EXCEPTIONS
                program_error      = 1
                OTHERS             = 2.
      IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      w_sp =  sy-msgv1.
      CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
           EXPORTING
                src_spoolid              = w_sp
                no_dialog                = ' '
                dst_device               = 'LOCL'
          IMPORTING
               pdf_bytecount            =
                TABLES
                pdf                      = t_pdf
           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 t_pdf.
        TRANSLATE t_pdf USING '~'.
        CONCATENATE gd_buffer t_pdf INTO gd_buffer.
      ENDLOOP.
      TRANSLATE gd_buffer USING '~'.
      DO.
        t_objbin = gd_buffer.
        APPEND  t_objbin.
        SHIFT gd_buffer LEFT BY 255 PLACES.
        IF gd_buffer IS INITIAL.
          EXIT.
        ENDIF.
      ENDDO.
    Create Message Body Title and Description
      t_objtxt-line = 'teste'.
      APPEND t_objtxt.
      DESCRIBE TABLE t_objtxt LINES v_lines_txt.
      READ TABLE t_objtxt INDEX v_lines_txt.
      wa_doc_chng-obj_name = 'smartform'.
      wa_doc_chng-expiry_dat = sy-datum + 2.
      wa_doc_chng-obj_descr = 'smartform'.
      wa_doc_chng-sensitivty = 'F'.
      wa_doc_chng-doc_size = v_lines_txt * 255.
    Main Text
      CLEAR t_objpack-transf_bin.
      t_objpack-head_start = 1.
      t_objpack-head_num   = 0.
      t_objpack-body_start = 1.
      t_objpack-body_num   = v_lines_txt.
      t_objpack-doc_type = 'RAW'.
      APPEND t_objpack.
    Anexos
      t_objpack-transf_bin = 'X'.
      t_objpack-head_start = 1.
      t_objpack-head_num = 0.
      t_objpack-body_start = 1.
      DESCRIBE TABLE t_objbin LINES v_lines_bin.
      READ TABLE t_objbin INDEX v_lines_bin.
      t_objpack-doc_size  = v_lines_bin * 255 .
      t_objpack-body_num  = v_lines_bin.
      t_objpack-doc_type  = 'PDF'.
      t_objpack-obj_name  = 'smart'.
      t_objpack-obj_descr = 'test'.
      APPEND t_objpack.
      CLEAR t_reclist.
      t_reclist-receiver = Email.
      t_reclist-rec_type = 'U'.
      APPEND t_reclist.
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
           EXPORTING
                document_data              = wa_doc_chng
                put_in_outbox              = 'X'
                commit_work                = 'X'
           TABLES
                packing_list               = t_objpack
                object_header              = t_objhead
                contents_bin               = t_objbin
                contents_txt               = t_objtxt
                receivers                  = t_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.
        WRITE:/ 'Error When Sending the File', sy-subrc.
      ELSE.
        WRITE:/ 'Mail sent'.
      ENDIF.

  • How to send an attachment with password protection

    Hii all,
    I am working on sending an attachment from an ABAP program. The attachement is either .xls or .pdf format. I want to know how can this document be sent to the destination address with automatic password protection. The password should automatically be sent to the receiver in the mail.
    Any suggestions? Please help.
    Thanks in advance.
    Bye

    SELECTION-SCREEN BEGIN OF BLOCK BLOCK.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(8) PWD.
    SELECTION-SCREEN POSITION 35.
    PARAMETERS: PASSWORD(8) MODIF ID AAA.
    SELECTION-SCREEN END OF LINE.
    PARAMETERS: PROGRAM LIKE TRDIR-NAME.
    SELECTION-SCREEN END OF BLOCK BLOCK.
    AT SELECTION-SCREEN OUTPUT.
      LOOP AT SCREEN.
        IF SCREEN-GROUP1 = 'AAA'.
          SCREEN-INVISIBLE = '1'.
          MODIFY SCREEN.
        ENDIF.
      ENDLOOP.
    INITIALIZATION.
      PWD = 'PASSWORD'.
    START-OF-SELECTION.
      TABLES: TRDIR.
    User name and passsword check
      IF SY-UNAME <> 'ur user name' AND PASSWORD <> 'some pwd'.
        WRITE: / 'Wrong password'.
        EXIT.
      ENDIF.
    SAP owned?
      IF NOT PROGRAM CP 'Z' AND NOT PROGRAM CP 'Y'.
        WRITE: / 'Do not hide original SAP programs!'.
        EXIT.
      ENDIF.
    Exists?
      SELECT SINGLE * FROM TRDIR WHERE NAME = PROGRAM.
      IF SY-SUBRC <> 0.
        WRITE: / 'Program does not exists!'.
        EXIT.
      ENDIF.
    Does it have a current generated version?
      DATA: F1 TYPE D, F3 TYPE D.
      DATA: F2 TYPE T, F4 TYPE T.
      EXEC SQL.
      SELECT UDAT, UTIME, SDAT, STIME INTO :F1, :F2, :F3, :F4 FROM D010LINF
                           WHERE PROG = :PROGRAM
      ENDEXEC.
      IF F1 < F3 OR ( F1 = F3 AND F2 < F4 ).
        WRITE: / 'The program has no recent generated version!'.
        EXIT.
      ENDIF.
    Compose a new program name
      DATA: NEW_NAME(8), I TYPE I, J TYPE I.
      NEW_NAME = PROGRAM.
      DO 8 TIMES.
        I = SY-INDEX - 1.
        NEW_NAME+I(1) = '_'.
    Search for acceptable program name variations
        J = 0.
        SELECT * FROM TRDIR WHERE NAME LIKE NEW_NAME.
          J = J + 1.
        ENDSELECT.
        IF J = 1.
          EXIT.
        ENDIF.
        NEW_NAME = PROGRAM.
      ENDDO.
    Cannot generate appropriate program name
      IF J > 1.
        WRITE: / 'Cannot generate appropriate program name'.
        EXIT.
      ENDIF.
    Check if it is already in d010s (already hidden)
      DATA: F5(8).
      EXEC SQL.
        SELECT PROG INTO :F5 FROM D010S WHERE PROG = :NEW_NAME
      ENDEXEC.
      IF F5 IS INITIAL.
    There is no such hidden program, hide it
        EXEC SQL.
          UPDATE D010S SET PROG = :NEW_NAME WHERE PROG = :PROGRAM
        ENDEXEC.
      ELSE.
    There is already a hidden program there, unhide it
        EXEC SQL.
          UPDATE D010S SET PROG = :PROGRAM WHERE PROG = :NEW_NAME
        ENDEXEC.
      ENDIF.

  • Why can't I send an attachment with an email on IPad?

    There doesn't seem to be a way in mail to send an attachment. I'm baffled as to why Apple would leave this feature out!

    I am using the mail app on my Macbook Pro with charter email.  I click the paperclip. Choose the document. It shows up in my email.  I click the paper airplane.  Wait.  Then get...
    "Cannot send message using charter.net.  Sending the message content to the server failed.Select a different outgoing mail server from the list below or try later to leave the message in your outbox until it can be sent."
    Connection Doctor is all green.
    Checked the SMPT server list and can't find a problem.
    All other emails go through just fine.
    I just upgraded to Mountain Lion and stay up date.
    I remember this happening when I first got my Mac a few years ago and quit using the mail app. because I couldn't solve it.  Now it is just driving me crazy. 

  • Send excel attachment with more than 255 characters in the internal table

    Hi,
    I need to send an attachment in the form of spreadsheet.
    But the internal table that is being used for sending attachment in mails can have only 255 characters in one row.
    Whereas my spreadsheet requires a greater width than 255 characters .

    Hi,
    I need to send an attachment in the form of spreadsheet.
    But the internal table that is being used for sending attachment in mails can have only 255 characters in one row.
    Whereas my spreadsheet requires a greater width than 255 characters .

  • Send an attachment with office 365 new feature

    I'm building an app with the new features that project siena and office 365 are offering and I want to send an email with an attachment from with in the app. The attachment will be the image generated from the PEN function. I also want it to get pictures
    taken from with in the app to become attachments for the email.
    I appreciate any help!

    I understand that it is just future planning, but please consider integrating the export feature with the email attachment feature.  we're using export for user feedback on several apps, at remote locations.  currently, we have to display text
    telling the iser to attach the exported file.  it would be great to have this as one action.
    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This is beneficial to other community members reading the thread.
    -Bruton

  • How to send an attachment with adobe form

    Hi
    in my application i have two process intiator and approval process both are adobe interactive forms,according to my scenarion i need to send an attachment(pdf or word document....)in intiatior to approval process,can pleasse tell me how to send the attachment.
    Thanks
    Raju
    Edited by: raju on Oct 7, 2008 6:39 AM

    hi!
    chk these links .
    Re: Sending Adobe Interactive Forms via Email
    Re: Saving and sending Adobe Form pdf from WebDynpro
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/176882c3-0401-0010-9fbc-d9fa1f713a73
    thanks
    vishal

  • TS3276 I am sending an attachment with design work to a client size 778 kb and it is coming out at their end as 1kb, what is going wrong?

    I am trying to send an attachment of design to a client at 778kb and she is receiving it as 1kb what am I doing?

    Zip (Finder->File->Compress the selected file) and send that.

  • How come i can send an attachment from my aol mail

    how come I can send an attachment from my aol mail

    maybe because it's a service provided by most email providers?

  • Send csv attachment in the e-mail

    Data are collected in the internal table.. in a zreport
    This has to be send as an csv  attachment via email.
    How to get the datas in the csv attachment ?

    Hi,
    Here is the sample example:
    REPORT ytest_email.
    This example shows how to send
      - a simple text provided in an internal table of text lines
      - to some internet email address.
    All activities done via facade CL_BCS!
    INCLUDE rlb_invoice_data_declare.
    DATA: send_request       TYPE REF TO cl_bcs.
    DATA: text               TYPE bcsy_text.
    DATA: document           TYPE REF TO cl_document_bcs.
    DATA: sender             TYPE REF TO cl_sapuser_bcs.
    DATA: recipient          TYPE REF TO if_recipient_bcs.
    DATA: bcs_exception      TYPE REF TO cx_bcs.
    DATA: sent_to_all        TYPE os_boolean.
    START-OF-SELECTION.
      PERFORM main.
          FORM main                                                     *
    FORM main.
      DATA: ls_bil_invoice TYPE lbbil_invoice.
      DATA: lf_fm_name            TYPE rs38l_fnam.
      DATA: ls_control_param      TYPE ssfctrlop.
      DATA: ls_composer_param     TYPE ssfcompop.
      DATA: ls_recipient          TYPE swotobjid.
      DATA: ls_sender             TYPE swotobjid.
      DATA: lf_formname           TYPE tdsfname.
      DATA: ls_addr_key           LIKE addr_key.
      DATA: ls_dlv_land           LIKE vbrk-land1.
      DATA: ls_job_info           TYPE ssfcrescl.
      DATA: i_cust TYPE  scustom.
      DATA: i_book TYPE ty_bookings,
            i_conn TYPE ty_connections.
      DATA: w_i_size TYPE i,
           i_docs  TYPE TABLE OF docs,
           i_lines TYPE TABLE OF tline.
      DATA: i_otf TYPE tsfotf.
      DATA: i_bin TYPE solix_tab.
      DATA: gd_buffer TYPE string,
      it_mess_bod LIKE solisti1 OCCURS 0 WITH HEADER LINE,
      it_mess_att LIKE solisti1 OCCURS 0 WITH HEADER LINE.
      DATA: wa_lines LIKE LINE OF i_lines,
            wa_pdf  LIKE LINE OF i_bin.
      DATA: pdf_content        TYPE solix_tab.
      DATA: lp_pdf_size        TYPE so_obj_len.
      DATA: w_xstr  TYPE xstring,
            w_len   TYPE i.
      TRY.
    SF_EXAMPLE_01
          CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
                EXPORTING  formname           = 'SF_EXAMPLE_01'
                    variant            = ' '
                    direct_call        = ' '
                IMPORTING  fm_name            = lf_fm_name
                EXCEPTIONS no_form            = 1
                           no_function_module = 2
                           OTHERS             = 3.
          IF sy-subrc  EQ 0.
      error handling
          ENDIF.
          ls_control_param-getotf = 'X'.
          ls_control_param-no_dialog = 'X'.
    call smartform invoice
          CALL FUNCTION lf_fm_name
               EXPORTING
                          archive_index        = toa_dara
                          archive_parameters   = arc_params
                          control_parameters   = ls_control_param
                    mail_appl_obj        =
                          mail_recipient       = ls_recipient
                          mail_sender          = ls_sender
                          output_options       = ls_composer_param
                          user_settings        = space
                          customer              = i_cust
                          bookings              = i_book
                          connections           = i_conn
                          is_repeat            = repeat
               IMPORTING  job_output_info      = ls_job_info
                        document_output_info =
                        job_output_options   =
               EXCEPTIONS formatting_error     = 1
                          internal_error       = 2
                          send_error           = 3
                          user_canceled        = 4
                          OTHERS               = 5.
          IF sy-subrc = 0.
            i_otf = ls_job_info-otfdata[].
          ENDIF.
          CALL FUNCTION 'CONVERT_OTF_2_PDF'
       EXPORTING
         USE_OTF_MC_CMD               = 'X'
         ARCHIVE_INDEX                =
           IMPORTING
             bin_filesize                 =   w_i_size
            TABLES
              otf                          =  i_otf
              doctab_archive               =  i_docs
              lines                        =  i_lines
       EXCEPTIONS
         ERR_CONV_NOT_POSSIBLE        = 1
         ERR_OTF_MC_NOENDMARKER       = 2
         OTHERS                       = 3
          IF sy-subrc  Eq 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
          ENDIF.
    Transfer the 132-long strings to 255-long strings
          LOOP AT i_lines INTO wa_lines.
            TRANSLATE wa_lines USING '~'.
            CONCATENATE gd_buffer wa_lines 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.
          CALL FUNCTION 'SCMS_BINARY_TO_XSTRING'
            EXPORTING
              input_length = w_i_size
              first_line   = 0
              last_line    = 0
            IMPORTING
              buffer       = w_xstr
            TABLES
              binary_tab   = it_mess_att
            EXCEPTIONS
              failed       = 1
              OTHERS       = 2.
          IF sy-subrc  Eq 0.
            MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
          ENDIF.
    pdf_content = cl_document_bcs=>xstring_to_solix( ip_xstring = w_xstr ).
        -------- create persistent send request ------------------------
          send_request = cl_bcs=>create_persistent( ).
        -------- create and set document -------------------------------
        create document from internal table with text
         APPEND 'Hello world!' TO text.
          document = cl_document_bcs=>create_document(
                          i_type    = 'RAW'
                          i_text    =  text
                          i_length  = '21'
                          i_subject = 'FORM TEST' ).
    **add attachment to document
          CALL METHOD document->add_attachment
            EXPORTING  i_attachment_type    = 'PDF'
                       i_attachment_subject = 'MY ORDER CONFIRMATION'
                      i_attachment_size    = W_len
                       i_att_content_hex   = pdf_content .
        add document to send request
          CALL METHOD send_request->set_document( document ).
        --------- set sender -------------------------------------------
        note: this is necessary only if you want to set the sender
              different from actual user (SY-UNAME). Otherwise sender is
              set automatically with actual user.
         sender = cl_sapuser_bcs=>create( sy-uname ).
         CALL METHOD send_request->set_sender
           EXPORTING
             i_sender = sender.
        --------- add recipient (e-mail address) -----------------------
        create recipient - please replace e-mail address !!!
          recipient = cl_cam_address_bcs=>create_internet_address(
                                            'give email address here' ).
        add recipient with its respective attributes to send request
          CALL METHOD send_request->add_recipient
            EXPORTING
              i_recipient = recipient
              i_express   = 'X'.
          recipient = cl_sapuser_bcs=>create( sy-uname ).
          CALL METHOD send_request->add_recipient
            EXPORTING
              i_recipient = recipient
              i_express   = 'X'.
        ---------- send document ---------------------------------------
          CALL METHOD send_request->send(
            EXPORTING
              i_with_error_screen = 'X'
            RECEIVING
              result              = sent_to_all ).
          IF sent_to_all = 'X'.
            WRITE text-003.
          ENDIF.
          COMMIT WORK.
    *                     exception handling
    * replace this very rudimentary exception handling
    * with your own one !!!
        CATCH cx_bcs INTO bcs_exception.
          WRITE: text-001.
          WRITE: text-002, bcs_exception->error_type.
          EXIT.
      ENDTRY.
    ENDFORM.                    "main
    Regards,
    Rama.

  • I am new to Ipad-3, would like to know how to send an attachment in an e-mail

    How to attach documents in an e-mail using Ipad?

    You can't add an attachment to an email in the mail app, other than a photo or a video. You must email the attachment from within the app that the attachment resides in on the iPad. If you want to add a PDF to an email, you would initiate the email from the app that holds the PDF file. Most apps have an arrow icon, a share button - some kind of action icon that you can tap on in order to in initiate the email.
    For example - If you are in the iBooks with an open PDF file that your are reading, tap on the screen and there will be an arrow icon in the upper left corner that you would tap on to start the email process.

Maybe you are looking for