Sending Cheque as PDF attachment in Mail using F110.

Hi all,
We have a requirement to send the cheque as as PDF attachment in Mail while printing it through transaction F110.Mail has to be triggered when the payment run is done through F110.Is there any config setting to do this without doing any changes to Print program RFFOUS_C.
Thanks and Regards
Kiran

Hi,
check below link
https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/email%2bfrom%2bsap 
Regards,
Madhu

Similar Messages

  • How to send pdf attachment through mail using Webdynpro-Java

    How can i send the Adobe Interactive Form with data involved as a PDF attachment to mail? using Webdynpro-Java.
    Is there any Adobe API or jar file for generating pdf?
    Helpful answer is highly appreciable and rewarded with points.!

    Hi Sankar,
    try [Offline Interactive PDF Form Using E-Mail|/docs/DOC-8061#49]
    Michal

  • Sending smartform as pdf attachment through mail

    Dear All,
    Can anyone suggest me sample code of how an sap smartform output is sent as pdf attachment to a receipients email address?
    Thanks
    M A

    hi,
    chk this sample code.
    * Internal Table declarations
    DATA: i_otf TYPE itcoo OCCURS 0 WITH HEADER LINE,
          i_tline TYPE TABLE OF tline WITH HEADER LINE,
          i_receivers TYPE TABLE OF somlreci1 WITH HEADER LINE,
          i_record LIKE solisti1 OCCURS 0 WITH HEADER LINE,
    * Objects to send mail.
          i_objpack LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
          i_objtxt LIKE solisti1 OCCURS 0 WITH HEADER LINE,
          i_objbin LIKE solisti1 OCCURS 0 WITH HEADER LINE,
          i_reclist LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
    * Work Area declarations
          wa_objhead TYPE soli_tab,
          w_ctrlop TYPE ssfctrlop,
          w_compop TYPE ssfcompop,
          w_return TYPE ssfcrescl,
          wa_doc_chng typE sodocchgi1,
          w_data TYPE sodocchgi1,
          wa_buffer TYPE string,"To convert from 132 to 255
    * Variables declarations
          v_form_name TYPE rs38l_fnam,
          v_len_in LIKE sood-objlen,
          v_len_out LIKE sood-objlen,
          v_len_outn TYPE i,
          v_lines_txt TYPE i,
          v_lines_bin TYPE i.
    call function 'SSF_FUNCTION_MODULE_NAME'
         exporting
              formname           = 'ZZZ_TEST1'
         importing
              fm_name            = v_form_name
         exceptions
              no_form            = 1
              no_function_module = 2
              others             = 3.
    IF sy-subrc <> 0.
      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
              WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    w_ctrlop-getotf = 'X'.
    w_ctrlop-no_dialog = 'X'.
    w_compop-tdnoprev = 'X'.
    CALL FUNCTION v_form_name
         EXPORTING
              control_parameters = w_ctrlop
              output_options     = w_compop
              user_settings      = 'X'
         IMPORTING
              job_output_info    = w_return
         EXCEPTIONS
              formatting_error   = 1
              internal_error     = 2
              send_error         = 3
              user_canceled      = 4
              OTHERS             = 5.
    IF sy-subrc <> 0.
      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
      WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    i_otf[] = w_return-otfdata[].
    call function 'CONVERT_OTF'
           EXPORTING
                format                = 'PDF'
                max_linewidth         = 132
           IMPORTING
                bin_filesize          = v_len_in
           TABLES
                otf                   = i_otf
                lines                 = i_tline
           EXCEPTIONS
                err_max_linewidth     = 1
                err_format            = 2
                err_conv_not_possible = 3
                others                = 4.
    *   Fehlerhandling
      if sy-subrc <> 0.
      endif.
      loop at i_tline.
        translate i_tline using '~'.
        concatenate wa_buffer i_tline into wa_buffer.
      endloop.
      translate wa_buffer using '~'.
      do.
        i_record = wa_buffer.
        append i_record.
        shift wa_buffer left by 255 places.
        if wa_buffer is initial.
          exit.
        endif.
      enddo.
    * Attachment
      refresh:
        i_reclist,
        i_objtxt,
        i_objbin,
        i_objpack.
      clear wa_objhead.
      i_objbin[] = i_record[].
    ******* Create Message Body
    **** Title and Description
      i_objtxt = 'test with pdf-Attachment!'.
      append i_objtxt.
      describe table i_objtxt lines v_lines_txt.
      read table i_objtxt index v_lines_txt.
      wa_doc_chng-obj_name = 'smartform'.
      wa_doc_chng-expiry_dat = sy-datum + 10.
      wa_doc_chng-obj_descr = 'smartform'.
      wa_doc_chng-sensitivty = 'F'.
      wa_doc_chng-doc_size = v_lines_txt * 255.
    **** Main Text
    *  wa_doc_chng-doc_size = ( v_lines_txt - 1 ) * 255 + strlen( i_objtxt )
      clear i_objpack-transf_bin.
      i_objpack-head_start = 1.
      i_objpack-head_num = 0.
      i_objpack-body_start = 1.
      i_objpack-body_num = v_lines_txt.
      i_objpack-doc_type = 'RAW'.
      append i_objpack.
    **** Attachment
    * (pdf-Attachment)
      i_objpack-transf_bin = 'X'.
      i_objpack-head_start = 1.
      i_objpack-head_num = 0.
      i_objpack-body_start = 1.
    * Länge des Attachment ermitteln
      describe table i_objbin lines v_lines_bin.
      read table i_objbin index v_lines_bin.
      i_objpack-doc_size =  v_lines_bin * 255 .
      i_objpack-body_num = v_lines_bin.
      i_objpack-doc_type = 'PDF'.
      i_objpack-obj_name = 'smart'.
      i_objpack-obj_descr = 'test'.
      append i_objpack.
      clear i_reclist.
      i_reclist-receiver = '[email protected]'.
      i_reclist-rec_type = 'U'.
      append i_reclist.
        call function 'SO_NEW_DOCUMENT_ATT_SEND_API1'
             EXPORTING
                  document_data              = wa_doc_chng
                  put_in_outbox              = 'X'
             TABLES
                  packing_list               = i_objpack
                  object_header              = wa_objhead
                  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.
    Regards
    Anver

  • Sending SAP Script output as a PDF attachment through mail

    Dear Guru,
    I am using SAP 4.0B version, DATABASE Oracle 8i, OS is sun solaris 7.5.
    I want to send SAP script output as a
    PDF attachement through mail.Please suggest a solution.
    Regards,
    Rajesh

    Hi Rajesh,
    In your print program, while calling OPEN_FORM, pass options-TDGETOTF = 'X'. This is used for returning print output in OTF format.
    Then in CLOSE_FORM, get the table OTFDATA returned from the function module. for example
    DATA: OTF_DATA LIKE ITCOO OCCURS 0 WITH HEADER LINE.
        CALL FUNCTION 'CLOSE_FORM'
          IMPORTING
            RESULT  = RESULT
          TABLES
            OTFDATA = OTF_DATA.
    now you can convert this OTF data to PDF using function module CONVERT_OTF
    Then send this data as attachment to a mail using function module SO_NEW_DOCUMENT_ATT_SEND_API1
    Regards,
    Komal.

  • Need to sent alv output as html or as pdf attachment in mail

    +Hello
    I want to send an ALV output as attachement in html or as pdf format. how to do that? line size is greater than 600(nearly 40 fields).
    +please help me in this query.
    Regards
    Guruvayurappan
    Moderator Message: Please search before posting your question. Thread locked.
    Edited by: Suhas Saha on Dec 29, 2011 4:57 PM

    Hi,
    For sending the ALV output as PDF attachment, you can create a spool (proper page size in print parameters) and convert the spool to PDF using the FM CONVERT_ABAPSPOOLJOB_2_PDF and then send the same as attachment in mail.
    For send the data as HTML attachment, try the below FMs
    WWW_ITAB_TO_HTML_HEADERS & WWW_ITAB_TO_HTML_LAYOUT to create the HTML layout
    WWW_ITAB_TO_HTML to create the HTML for the actual data.
    Hope this helps you.
    Regards,
    Sachinkumar Mehta

  • Problem in Sending  .txt as an attachment to mail

    Dear Experts,
         I am working on a file to mail scenario. I have searched a lot in sdn, but could not locate the exact answer for the same.
    I am using file adapter to pick up a txt file from a location and supposed to send this as an attachment to mail(in box).
    My scenario is ready, have configured the IR and ID. there are only 5 fields at the sender side, have done one to one mapping at the receiver side.
    question is
    1)  Do I have to use content conversion at the sender side in order to read the file in XI or....
    2)  Can i send the payload of the message as an attachment? Do i have to configure anything else for the same for eg
    3) where i have to configure my sender and receiver, has to be in mail adapter or in xml payload?
    Kindly provide your valuable suggestions or  idea to proceed , as i am confused how to proceed wz the same.
    Thanks
    Virendra

    Hi,
    1) Do I have to use content conversion at the sender side in order to read the file in XI or....
    Since ur source is a .txt file... to convert it to a xml format u need to use the FCC in file adapter.
    2) Can i send the payload of the message as an attachment? Do i have to configure anything else for the same for eg
    You can send the payload of a message as a attachment.
    I hope u dont want to send the XML structure as a attachment... In receiver...first u have to convert the XML to a .txt file and then
    u need to send this .txt as a attachment..
    If this is ur requirement u can do it by using the inbuilt EJB's and  a Mail adapter in receiver.
    The inbuilt bean is MessageTransformationBean... which can convert a XML structure a Text file.
    and then u have to pass it to Mail adapter... Please keep in mind the sequence of processing.
    If clarification needed u can put a post again
    3) where i have to configure my sender and receiver, has to be in mail adapter or in xml payload?
    U need to configure both sender and receiver. Sender is a file adapter and receiver is a Mail adapter.
    Decide first u want to use mail package or not..
    For ur scenario u can do both ways using Payload or XIALL..
    Babu

  • I am unable to open my PDF attachment in mail.

    I cannot open my PDF attachment in mail. I am able to on all of my other apple products but not my air. Is there a setting that i might have wrong?

    If it is your own pdf and you are unsure of your password, you are out of luck. You will need to create a new file from the original documents. I suggest using password managers, if you need to create many different documents with different passwords.

  • Send Invoice as PDF Attachment with variable Filename

    Hello!
    We got a requirement from one customer. We should send our invoices as PDF-Attachment via E-Mail but the attachment must have a variable filename. At the Moment we can send invoice as PDF-Attachment but only with a fix filename.
    How can we change the filename in our Adobe Forms?
    Best Regards
    Markus

    Hi Florian!
    Answer 1:
        The original Name is Druckdaten.pdf
    Answer 2:
         Our entry in NAST-NACHA = 1
    Answer 3:
         I can implement some ABAP-Code
    Here some Screenshots:
    Configuration  of printer E-MAIL:
    Best regards
    Markus

  • Pdf attachment from mail to ibooks?

    hmm, how do you 'import' pdf attachment from mail into ibooks 1.1? i hit downloaded on iphone mail, it loaded with img, not even a pdf. flip back to ibooks, hit pdf tab, its not there. am i missing something here?
    thanks guys
    Message was edited by: Tran Hoang Long

    I have the latest version of iTunes with iBooks, and it doesn't have anywhere to drag PDF files into iTunes. Where are you seeing this? I tried every imaginable PDF, include a text document, I printed to PDF from textedit, then dragging it into the pane of grayed out books in iTunes.
    What gives?
    Here's a screenshot:
    http://drp.ly/1eMh5M

  • Want to Send smartform as pdf attachment with a Email to some mail id

    Hi ,
    I want to send a smartform as a PDF attachment with a mail to a mail id. And I can send a mail with the PDF attachment.
    But I am not able to open the PDF. It is throwing some error (Adobe reader could not open u2018fileu2019 because it is either not a supported file type or because the file has been damaged (for example , it was sent as an email attachment and was not correctly decoded)).
    By debugging I come to know that the file which is generating is in some encoding format.
    Please help me regard this. This is very urgent.
    here is the code,
    Main Program :
    REPORT Ztest_report.
    *--Top Include for Global Data Declarations.
    INCLUDE ztest_report_top.
    *--Form Include for Form Routines.
    INCLUDE ztest_report_form.
    START-OF-SELECTION.
    START-OF-SELECTION.
    *--Display data
      Perform display_data.
    END-OF-SELECTION.
    Top declaration :
    Internal table
    DATA :  i_otfdata TYPE tsfotf,          " Smart Forms: Table OTF
            i_tline TYPE TABLE OF tline WITH HEADER LINE,
            i_receivers TYPE TABLE OF somlreci1 WITH HEADER LINE,
            i_record LIKE solisti1 OCCURS 0 WITH HEADER LINE,
    Objects to send mail.
            i_objpack LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
            i_objtxt LIKE solisti1 OCCURS 0 WITH HEADER LINE,
            i_objbin LIKE solisti1 OCCURS 0 WITH HEADER LINE,
            i_reclist LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
    Work Area declarations
            w_mailaddr TYPE ppfdmailad,
            w_mailtype TYPE so_escape,
            w_mailrecipient TYPE swotobjid,
            w_control TYPE ssfctrlop,
            w_compop TYPE ssfcompop,
            w_return TYPE ssfcrescl,
            wa_doc_chng TYPE sodocchgi1,
            w_data TYPE sodocchgi1,
            wa_buffer TYPE string, "To convert from 132 to 255
            wa_objhead TYPE soli_tab,
    Variables declarations
            v_form_name TYPE rs38l_fnam,
            v_len_in LIKE sood-objlen,
            v_len_out LIKE sood-objlen,
            v_len_outn TYPE i,
            v_lines_txt TYPE i,
            v_lines_bin TYPE i.
    Selection Screen
    SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-009.
    PARAMETER:      p_bukrs TYPE bukrs OBLIGATORY,            "Company Code
                    p_belnr TYPE belnr_d OBLIGATORY,          "Document No
                    p_gjahr TYPE gjahr OBLIGATORY,            "document type
                    p_mailid(50) TYPE c OBLIGATORY.
    "Mail Id
    SELECTION-SCREEN END OF BLOCK blk1.
    Form Logic :
    FORM display_data.
    *Local Variable declaration
      DATA: lc_fm TYPE rs38l_fnam,       "local variable to store the
            l_i_document_output_info TYPE ssfcrespd,
            l_i_struc_job_output_info TYPE ssfcrescl,
            l_i_struc_job_output_options TYPE ssfcrescl,
            i_lines TYPE TABLE OF tline WITH HEADER LINE,
            lv_job_output_info      TYPE ssfcrescl,
            lv_document_output_info TYPE ssfcrespd,
            lv_job_output_options   TYPE ssfcresop,
            lv_bin_filesize         LIKE sood-objlen.
    Determine the smartform name
      CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
           EXPORTING
                formname           = 'ZTEST_SMARTFORM'
           IMPORTING
                fm_name            = lc_fm
           EXCEPTIONS
                no_form            = 1
                no_function_module = 2
                OTHERS             = 3.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
      w_control-getotf = 'X'.
      w_control-no_dialog = 'X'.
      w_control-preview = space.
    w_control-device = 'MAIL'.
    Call the smartform and pass the selection screen parameter
      CALL FUNCTION lc_fm
           EXPORTING
                control_parameters = w_control
                output_options     = w_compop
                user_settings      = 'X'
                t_bukrs            = p_bukrs
                t_belnr            = p_belnr
                t_gjahr            = p_gjahr
           IMPORTING
                job_output_info    = l_i_struc_job_output_info
           EXCEPTIONS
                formatting_error   = 1
                internal_error     = 2
                send_error         = 3
                user_canceled      = 4
                OTHERS             = 5.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
        WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    Moving the Smart Forms: Table OTF into an internal table
      i_otfdata[] = l_i_struc_job_output_info-otfdata[].
    CONVERT TO OTF TO PDF.
      CALL FUNCTION 'CONVERT_OTF'
           EXPORTING
                format                = 'PDF'
                max_linewidth         = 132
           IMPORTING
                bin_filesize          = lv_bin_filesize
           TABLES
                otf                   = i_otfdata
                lines                 = i_lines
           EXCEPTIONS
                err_max_linewidth     = 1
                err_format            = 2
                err_conv_not_possible = 3
                err_bad_otf           = 4
                OTHERS                = 5.
    IF sy-batch EQ l_c_no.
    To directly view the print-preview in PDF format
      CALL FUNCTION 'SSFCOMP_PDF_PREVIEW'
           EXPORTING
                i_otf                    = i_otfdata
           EXCEPTIONS
                convert_otf_to_pdf_error = 1
                cntl_error               = 2
                OTHERS                   = 3.
    For Sending the PDF file to a Mail ID.
    LOOP AT i_lines.
       TRANSLATE i_lines USING '~'.
       CONCATENATE wa_buffer i_lines INTO wa_buffer.
    ENDLOOP.
    TRANSLATE wa_buffer USING '~'.
    DO.
       i_record = wa_buffer.
       APPEND i_record.
       SHIFT wa_buffer LEFT BY 255 PLACES.
       IF wa_buffer IS INITIAL.
         EXIT.
       ENDIF.
    ENDDO.
      DATA: BEGIN OF zlines OCCURS 0,
      tline TYPE char255,
      END OF zlines.
    *Change the PDF format from 132 to 255.
      CALL FUNCTION 'SX_TABLE_LINE_WIDTH_CHANGE'
           EXPORTING
                transfer_bin                = 'X'
           TABLES
                content_in                  = i_lines
                content_out                 = zlines
           EXCEPTIONS
                err_line_width_src_too_long = 1
                err_line_width_dst_too_long = 2
                err_conv_failed             = 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.
    Attachment
      REFRESH: i_reclist,
      i_objtxt,
      i_objbin,
      i_objpack.
      CLEAR wa_objhead.
      i_objbin[] = zlines[].
    Create Message Body Title and Description
      i_objtxt = 'test with pdf-Attachment!'.
      APPEND i_objtxt.
      DESCRIBE TABLE i_objtxt LINES v_lines_txt.
      READ TABLE i_objtxt INDEX v_lines_txt.
      wa_doc_chng-obj_name = 'smartform'.
      wa_doc_chng-expiry_dat = sy-datum + 10.
      wa_doc_chng-obj_descr = 'smartform'.
      wa_doc_chng-sensitivty = 'F'.
      wa_doc_chng-doc_size = v_lines_txt * 255.
    Main Text
      CLEAR i_objpack-transf_bin.
      i_objpack-head_start = 1.
      i_objpack-head_num = 1.
      i_objpack-body_start = 2.
      i_objpack-body_num = v_lines_txt.
      i_objpack-doc_type = 'RAW'.
      APPEND i_objpack.
    Attachment (pdf-Attachment)
      i_objpack-transf_bin = 'X'.
      i_objpack-head_start = 1.
      i_objpack-head_num = 1.
      i_objpack-body_start = 2.
    I_OBJPACK-DOC_TYPE = 'RAW'.
      DESCRIBE TABLE i_objbin LINES v_lines_bin.
      READ TABLE i_objbin INDEX v_lines_bin.
      i_objpack-doc_size = v_lines_bin * 255 .
      i_objpack-body_num = v_lines_bin.
      i_objpack-doc_type = 'PDF'.
      i_objpack-obj_name = 'smart'.
      i_objpack-obj_descr = 'test'.
      APPEND i_objpack.
      CLEAR i_reclist.
      i_reclist-receiver = p_mailid.
      i_reclist-rec_type = 'U'.
      APPEND i_reclist.
    Send new document with attachments via RFC
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
           EXPORTING
                document_data              = wa_doc_chng
                put_in_outbox              = 'X'
                commit_work                = 'X'
           TABLES
                packing_list               = i_objpack
                object_header              = wa_objhead
                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.
        WRITE:/ 'Error When Sending the File', sy-subrc.
      ELSE.
        WRITE:/ 'Mail sent'.
      ENDIF.
    ENDFORM.                    " display_data

    hi,
    i wrote a programm.for me it is working.i think it will help for u.
    DATA: t_otfdata TYPE ssfcrescl,
          t_lines LIKE tline OCCURS 0 WITH HEADER LINE,
          t_otf TYPE itcoo OCCURS 0 WITH HEADER LINE,
          t_RECORD LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE.
    Objects to send mail.
    DATA:T_OBJPACK LIKE SOPCKLSTI1 OCCURS 0 WITH HEADER LINE,
         T_OBJTXT LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
         T_OBJBIN LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
         T_RECLIST LIKE SOMLRECI1 OCCURS 0 WITH HEADER LINE.
    DATA: w_filesize TYPE i,
          w_bin_filesize TYPE i,
          wa_ctrlop TYPE ssfctrlop,
          wa_outopt TYPE ssfcompop,
          WA_BUFFER TYPE STRING,          "To convert from 132 to 255
          WA_OBJHEAD TYPE SOLI_TAB,
          WA_DOC_CHNG TYPE SODOCCHGI1,
          W_DATA TYPE SODOCCHGI1.
    DATA: form_name TYPE rs38l_fnam,
          V_LINES_TXT TYPE I,
          V_LINES_BIN TYPE I,
          nast-spras type sy-langu value 'DE'.
    CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
      EXPORTING
        FORMNAME                 = 'ZSR_DEMO1'
      VARIANT                  = ' '
      DIRECT_CALL              = ' '
    IMPORTING
       FM_NAME                  = form_name
    EXCEPTIONS
       NO_FORM                  = 1
       NO_FUNCTION_MODULE       = 2
       OTHERS                   = 3
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    wa_ctrlop-LANGU = nast-spras.
    wa_ctrlop-getotf = 'X'.
    wa_ctrlop-no_dialog = 'X'.
    wa_outopt-tdnoprev = 'X'.
    CALL FUNCTION form_name
      EXPORTING
      ARCHIVE_INDEX              =
      ARCHIVE_INDEX_TAB          =
      ARCHIVE_PARAMETERS         =
       CONTROL_PARAMETERS         = wa_ctrlop
      MAIL_APPL_OBJ              =
      MAIL_RECIPIENT             =
      MAIL_SENDER                =
       OUTPUT_OPTIONS             = wa_outopt
       USER_SETTINGS              = 'X'
    IMPORTING
      DOCUMENT_OUTPUT_INFO       =
       JOB_OUTPUT_INFO            = t_otfdata
      JOB_OUTPUT_OPTIONS         =
    EXCEPTIONS
       FORMATTING_ERROR           = 1
       INTERNAL_ERROR             = 2
       SEND_ERROR                 = 3
       USER_CANCELED              = 4
       OTHERS                     = 5
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    t_otf[] = t_otfdata-otfdata[].
    CALL FUNCTION 'CONVERT_OTF'
    EXPORTING
       FORMAT                      = 'PDF'
       MAX_LINEWIDTH               = 132
      ARCHIVE_INDEX               = ' '
      COPYNUMBER                  = 0
      ASCII_BIDI_VIS2LOG          = ' '
      PDF_DELETE_OTFTAB           = ' '
    IMPORTING
       BIN_FILESIZE                = w_bin_filesize
      BIN_FILE                    =
      TABLES
        OTF                         = t_otf
        LINES                       = t_lines
    EXCEPTIONS
       ERR_MAX_LINEWIDTH           = 1
       ERR_FORMAT                  = 2
       ERR_CONV_NOT_POSSIBLE       = 3
       ERR_BAD_OTF                 = 4
       OTHERS                      = 5
    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 t_lines.
    TRANSLATE t_lines USING '~'.
      CONCATENATE WA_BUFFER T_LINES INTO WA_BUFFER.
    ENDLOOP.
    TRANSLATE WA_BUFFER USING '~'.
    DO.
      t_RECORD = WA_BUFFER.
      APPEND t_RECORD.
      SHIFT WA_BUFFER LEFT BY 255 PLACES.
      IF WA_BUFFER IS INITIAL.
        EXIT.
      ENDIF.
    ENDDO.
    Attachment
    REFRESH: T_RECLIST,
    T_OBJTXT,
    T_OBJBIN,
    T_OBJPACK.
    CLEAR WA_OBJHEAD.
    T_OBJBIN[] = T_RECORD[].
    Create Message Body Title and Description
    T_OBJTXT = 'test with pdf-Attachment!'.
    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 + 10.
    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.
    Attachment (pdf-Attachment)
    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 = 'mail id'.
    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              = WA_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.
    please reward me if helpful.

  • To send the Payload as PDF Attachment in mail in PI 7.1

    Hi All,
    I have to send a file as PDF attachment using a mail adapter. I gave the Content_Type as 'application.pdf'. I am receiving the mail, but I am unable to open the PDF. It says 'Could not open because the type is not supported or unable to decode'. How do I resolve this?
    Thanks,
    Geetha

    Hi,
    You need to perform the conversion usign the PayloadSwapBean in the  Module tab.
    Please refer to the following link
    /people/sravya.talanki2/blog/2006/11/28/e-mail-xml-messages-in-pdf-format-from-sap-xi
    http://help.sap.com/saphelp_nw04/helpdata/en/2e/bf37423cf7ab04e10000000a1550b0/frameset.htm
    http://help.sap.com/saphelp_nw70ehp1/helpdata/en/cd/5af7c0c994e24fb0d0088443513de2/content.htm
    http://help.sap.com/saphelp_nw70ehp1/helpdata/en/57/0b2c4142aef623e10000000a155106/frameset.htm
    hope this helps,
    Regards,
    Bhanu
    Edited by: nanduri bhanu on May 21, 2009 5:21 AM

  • Sending PDF attachment in mail

    My requirement is to send PDF as attachment in mail. Also require to password protect it. I've searced a lot in the forums and found many threads, but no solid solution... Has anyone worked on it lately, and found any solution? Thanks in advance.

    Hi,
    use this FM 'SO_NEW_DOCUMENT_ATT_SEND_API1'. and pass the required values.
    z_send_email_fax_global
    FUNCTION-POOL z_gfaian_mail_fax. "MESSAGE-ID ..
    WORK TABLE AREAS
    TABLES: tsp01.
    INTERNAL TABLES
    DATA: lt_rec_tab LIKE STANDARD TABLE OF soos1 WITH HEADER LINE,
    lt_note_text LIKE STANDARD TABLE OF soli WITH HEADER LINE,
    lt_attachments LIKE STANDARD TABLE OF sood5 WITH HEADER LINE.
    DATA: lt_objcont LIKE STANDARD TABLE OF soli WITH HEADER LINE,
    lt_objhead LIKE STANDARD TABLE OF soli WITH HEADER LINE.
    DATA: pdf_format LIKE STANDARD TABLE OF tline WITH HEADER LINE.
    TYPES: BEGIN OF y_files,
    file(60) TYPE c,
    END OF y_files.
    DATA: lt_files TYPE STANDARD TABLE OF y_files WITH HEADER LINE.
    DATA: l_objcont LIKE soli OCCURS 0 WITH HEADER LINE.
    DATA: l_objhead LIKE soli OCCURS 0 WITH HEADER LINE.
    STRUCTURES
    DATA: folder_id LIKE soodk,
    object_id LIKE soodk,
    link_folder_id LIKE soodk,
    g_document LIKE sood4,
    g_header_data LIKE sood2,
    g_folmem_data LIKE sofm2,
    g_header_data LIKE sood2,
    g_receive_data LIKE soos6,
    g_ref_document LIKE sood4,
    g_new_parent LIKE soodk,
    l_folder_id LIKE sofdk,
    v_email(50).
    DATA: hd_dat like sood1.
    VARIABLES
    DATA: client LIKE tst01-dclient,
    name LIKE tst01-dname,
    objtype LIKE rststype-type,
    type LIKE rststype-type.
    DATA: numbytes TYPE i,
    arc_idx LIKE toa_dara,
    pdfspoolid LIKE tsp01-rqident,
    jobname LIKE tbtcjob-jobname,
    jobcount LIKE tbtcjob-jobcount,
    is_otf.
    DATA: outbox_flag LIKE sonv-flag VALUE 'X',
    store_flag LIKE sonv-flag,
    delete_flag LIKE sonv-flag,
    owner LIKE soud-usrnam,
    on LIKE sonv-flag VALUE 'X',
    sent_to_all LIKE sonv-flag,
    g_authority LIKE sofa-usracc,
    w_objdes LIKE sood4-objdes.
    DATA: c_file LIKE rlgrap-filename,
    n_spool(6) TYPE n.
    DATA: cancel.
    DATA: desired_type LIKE sood-objtp,
    real_type LIKE sood-objtp,
    attach_type LIKE sood-objtp,
    otf LIKE sood-objtp VALUE 'OTF', " SAPscript Ausgabeformat
    ali LIKE sood-objtp VALUE 'ALI'. " ABAP lists
    CONSTANTS
    CONSTANTS: ou_fol LIKE sofh-folrg VALUE 'O',
    c_objtp LIKE g_document-objtp VALUE 'RAW',
    c_file_ext LIKE g_document-file_ext VALUE 'TXT'.
    =================================================================================
    z_send_email_fax2
    FUNCTION z_faian_mail_fax2.
    ""Interface local:
    *" IMPORTING
    *" REFERENCE(SRC_SPOOLID) LIKE TSP01-RQIDENT
    *" REFERENCE(FAX_MAIL_NUMBER) TYPE SO_NAME
    *" REFERENCE(HEADER_MAIL) TYPE SO_OBJ_DES
    *" REFERENCE(OBJECT_TYPE) TYPE SO_ESCAPE
    *" TABLES
    *" LT_BODY_EMAIL STRUCTURE SOLI
    *" EXCEPTIONS
    *" ERR_NO_ABAP_SPOOLJOB
    Fist part: Verify if the spool really exists
    SELECT SINGLE * FROM tsp01 WHERE rqident = src_spoolid.
    IF sy-subrc NE 0.
    RAISE err_no_abap_spooljob. "doesn't exist
    ELSE.
    client = tsp01-rqclient.
    name = tsp01-rqo1name.
    CALL FUNCTION 'RSTS_GET_ATTRIBUTES'
    EXPORTING
    authority = 'SP01'
    client = client
    name = name
    part = 1
    IMPORTING
    type = type
    objtype = objtype
    EXCEPTIONS
    fb_error = 1
    fb_rsts_other = 2
    no_object = 3
    no_permission = 4
    OTHERS = 5.
    IF objtype(3) = 'OTF'.
    desired_type = otf.
    ELSE.
    desired_type = ali.
    ENDIF.
    CALL FUNCTION 'RSPO_RETURN_SPOOLJOB'
    EXPORTING
    rqident = src_spoolid
    desired_type = desired_type
    IMPORTING
    real_type = real_type
    TABLES
    buffer = l_objcont
    EXCEPTIONS
    no_such_job = 14
    type_no_match = 94
    job_contains_no_data = 54
    no_permission = 21
    can_not_access = 21
    read_error = 54.
    IF sy-subrc EQ 0.
    attach_type = real_type.
    ENDIF.
    CALL FUNCTION 'SO_FOLDER_ROOT_ID_GET'
    EXPORTING
    owner = sy-uname
    region = ou_fol
    IMPORTING
    folder_id = l_folder_id
    EXCEPTIONS
    OTHERS = 5.
    fill out informations about the header of the email
    CLEAR: g_document.
    g_document-foltp = l_folder_id-foltp.
    g_document-folyr = l_folder_id-folyr.
    g_document-folno = l_folder_id-folno.
    g_document-objtp = c_objtp.
    g_document-objdes = header_mail.
    g_document-file_ext = c_file_ext.
    g_header_data-objdes = header_mail.
    CALL FUNCTION 'SO_DOCUMENT_REPOSITORY_MANAGER'
    EXPORTING
    method = 'SAVE'
    office_user = sy-uname
    IMPORTING
    authority = g_authority
    TABLES
    objcont = lt_body_email
    attachments = lt_attachments
    CHANGING
    document = g_document
    header_data = g_header_data
    EXCEPTIONS
    OTHERS = 1.
    folder_id-objtp = l_folder_id-foltp.
    folder_id-objyr = l_folder_id-folyr.
    folder_id-objno = l_folder_id-folno.
    object_id-objtp = c_objtp.
    object_id-objyr = g_document-objyr.
    object_id-objno = g_document-objno.
    link_folder_id-objtp = l_folder_id-foltp.
    link_folder_id-objyr = l_folder_id-folyr.
    link_folder_id-objno = l_folder_id-folno.
    REFRESH lt_rec_tab.
    CLEAR lt_rec_tab.
    lt_rec_tab-sel = 'X'.
    lt_rec_tab-recesc = object_type. "This field for FAX/MAIL
    lt_rec_tab-recnam = 'U-'.
    lt_rec_tab-deliver = 'X'.
    lt_rec_tab-not_deli = 'X'.
    lt_rec_tab-read = 'X'.
    lt_rec_tab-mailstatus = 'E'.
    lt_rec_tab-adr_name = fax_mail_number.
    lt_rec_tab-sortfield = fax_mail_number.
    lt_rec_tab-recextnam = fax_mail_number.
    lt_rec_tab-sortclass = '5'.
    APPEND lt_rec_tab.
    lt_rec_tab-recextnam = fax_mail_number.
    lt_rec_tab-recesc = object_type.
    lt_rec_tab-sndart = 'INT'.
    lt_rec_tab-sndpri = 1.
    APPEND lt_rec_tab.
    lt_files-file = c_file.
    APPEND lt_files.
    begin of insertion by faianf01
    hd_dat-objdes = header_mail.
    CALL FUNCTION 'SO_ATTACHMENT_INSERT'
    EXPORTING
    object_id = object_id
    attach_type = attach_type
    object_hd_change = hd_dat
    owner = sy-uname
    TABLES
    objcont = l_objcont
    objhead = l_objhead
    EXCEPTIONS
    active_user_not_exist = 35
    communication_failure = 71
    object_type_not_exist = 17
    operation_no_authorization = 21
    owner_not_exist = 22
    parameter_error = 23
    substitute_not_active = 31
    substitute_not_defined = 32
    system_failure = 72
    x_error = 1000.
    IF sy-subrc > 0.
    ENDIF.
    end of insertion by faianf01
    send email from SAPOFFICE
    CALL FUNCTION 'SO_OBJECT_SEND'
    EXPORTING
    folder_id = folder_id
    object_id = object_id
    outbox_flag = outbox_flag
    link_folder_id = link_folder_id
    owner = sy-uname
    check_send_authority = 'X'
    TABLES
    receivers = lt_rec_tab
    note_text = lt_note_text
    EXCEPTIONS
    active_user_not_exist = 35
    communication_failure = 71
    component_not_available = 1
    folder_no_authorization = 5
    folder_not_exist = 6
    forwarder_not_exist = 8
    object_no_authorization = 13
    object_not_exist = 14
    object_not_sent = 15
    operation_no_authorization = 21
    owner_not_exist = 22
    parameter_error = 23
    substitute_not_active = 31
    substitute_not_defined = 32
    system_failure = 72
    too_much_receivers = 73
    user_not_exist = 35.
    ENDIF.
    ENDFUNCTION.
    =================================================================================
    z_send_email_fax
    FUNCTION ZCBFS_SEND_MAIL.
    ""Interface local:
    *" IMPORTING
    *" REFERENCE(SRC_SPOOLID) LIKE TSP01-RQIDENT
    *" REFERENCE(HEADER_MAIL) TYPE SO_OBJ_DES
    *" TABLES
    *" LIST_FAX_MAIL_NUMBER STRUCTURE SOLI
    *" EXCEPTIONS
    *" ERR_NO_ABAP_SPOOLJOB
    DATA: vg_achou(1) TYPE n.
    Fist part: Verify if the spool really exists
    vg_achou = 1.
    DO 60 TIMES.
    SELECT SINGLE * FROM tsp01 WHERE rqident = src_spoolid.
    IF sy-subrc IS INITIAL.
    CLEAR vg_achou.
    EXIT.
    ELSE.
    WAIT UP TO 1 SECONDS.
    ENDIF.
    ENDDO.
    IF vg_achou = 1.
    RAISE err_no_abap_spooljob. "doesn't exist
    ENDIF.
    client = tsp01-rqclient.
    name = tsp01-rqo1name.
    CALL FUNCTION 'RSTS_GET_ATTRIBUTES'
    EXPORTING
    authority = 'SP01'
    client = client
    name = name
    part = 1
    IMPORTING
    type = type
    objtype = objtype
    EXCEPTIONS
    fb_error = 1
    fb_rsts_other = 2
    no_object = 3
    no_permission = 4
    OTHERS = 5.
    IF objtype(3) = 'OTF'.
    desired_type = otf.
    ELSE.
    desired_type = ali.
    ENDIF.
    CALL FUNCTION 'RSPO_RETURN_SPOOLJOB'
    EXPORTING
    rqident = src_spoolid
    desired_type = desired_type
    IMPORTING
    real_type = real_type
    TABLES
    buffer = l_objcont
    EXCEPTIONS
    no_such_job = 14
    type_no_match = 94
    job_contains_no_data = 54
    no_permission = 21
    can_not_access = 21
    read_error = 54.
    IF sy-subrc EQ 0.
    attach_type = real_type.
    ENDIF.
    CALL FUNCTION 'SO_FOLDER_ROOT_ID_GET'
    EXPORTING
    owner = sy-uname
    region = ou_fol
    IMPORTING
    folder_id = l_folder_id
    EXCEPTIONS
    OTHERS = 5.
    fill out informations about the header of the email
    CLEAR: g_document.
    g_document-foltp = l_folder_id-foltp.
    g_document-folyr = l_folder_id-folyr.
    g_document-folno = l_folder_id-folno.
    g_document-objtp = c_objtp.
    g_document-objdes = header_mail.
    g_document-file_ext = c_file_ext.
    g_header_data-objdes = header_mail.
    CALL FUNCTION 'SO_DOCUMENT_REPOSITORY_MANAGER'
    EXPORTING
    method = 'SAVE'
    office_user = sy-uname
    IMPORTING
    authority = g_authority
    TABLES
    attachments = lt_attachments
    CHANGING
    document = g_document
    header_data = g_header_data
    EXCEPTIONS
    OTHERS = 1.
    folder_id-objtp = l_folder_id-foltp.
    folder_id-objyr = l_folder_id-folyr.
    folder_id-objno = l_folder_id-folno.
    object_id-objtp = c_objtp.
    object_id-objyr = g_document-objyr.
    object_id-objno = g_document-objno.
    link_folder_id-objtp = l_folder_id-foltp.
    link_folder_id-objyr = l_folder_id-folyr.
    link_folder_id-objno = l_folder_id-folno.
    REFRESH lt_rec_tab.
    LOOP AT LIST_FAX_MAIL_NUMBER.
    lt_rec_tab-recextnam = LIST_FAX_MAIL_NUMBER-LINE.
    lt_rec_tab-recesc = 'U'.
    lt_rec_tab-sndart = 'INT'.
    lt_rec_tab-sndpri = 1.
    APPEND lt_rec_tab.
    ENDLOOP.
    lt_files-file = c_file.
    APPEND lt_files.
    hd_dat-objdes = header_mail.
    CALL FUNCTION 'SO_ATTACHMENT_INSERT'
    EXPORTING
    object_id = object_id
    attach_type = attach_type
    object_hd_change = hd_dat
    owner = sy-uname
    TABLES
    objcont = l_objcont
    objhead = l_objhead
    EXCEPTIONS
    active_user_not_exist = 35
    communication_failure = 71
    object_type_not_exist = 17
    operation_no_authorization = 21
    owner_not_exist = 22
    parameter_error = 23
    substitute_not_active = 31
    substitute_not_defined = 32
    system_failure = 72
    x_error = 1000.
    IF sy-subrc > 0.
    ENDIF.
    send email from SAPOFFICE
    CALL FUNCTION 'SO_OBJECT_SEND'
    EXPORTING
    folder_id = folder_id
    object_id = object_id
    outbox_flag = outbox_flag
    link_folder_id = link_folder_id
    owner = sy-uname
    TABLES
    receivers = lt_rec_tab
    note_text = lt_note_text
    EXCEPTIONS
    active_user_not_exist = 35
    communication_failure = 71
    component_not_available = 1
    folder_no_authorization = 5
    folder_not_exist = 6
    forwarder_not_exist = 8
    object_no_authorization = 13
    object_not_exist = 14
    object_not_sent = 15
    operation_no_authorization = 21
    owner_not_exist = 22
    parameter_error = 23
    substitute_not_active = 31
    substitute_not_defined = 32
    system_failure = 72
    too_much_receivers = 73
    user_not_exist = 35.
    ENDFUNCTION.
    Edited by: katigiri linganna on Jul 31, 2009 8:56 AM

  • Send attachment though mail using FM SO_NEW_DOCUMENT_ATT_SEND_API1

    Hello Gurus,
    Please help me with the mail sending attachment(excel file) using FM SO_NEW_DOCUMENT_ATT_SEND_API1.
    Here is the actual problem.
    I am using the FM SO_NEW_DOCUMENT_ATT_SEND_API1 in my prog.
    My attachment(excel sheet which is taken from internal table) contains the 10 records with one header description and data related to that description.
    I am able to send the attachment but the records in the attachment has more than 255 characters nearly 700 character length.
    So I spilt up each internal table record(with structure type solisti1) into 3 internal table records and populated it.
    It is showing the entire record in the attached file but I am not able to see some fields which are embeded deeply inside the cells.
    And they are not having any proper allignment.
    Please do help me.
    Promise to reward points.
    Mac

    Here is the sample code....
    DATA: OBJPACK LIKE SOPCKLSTI1 OCCURS  2 WITH HEADER LINE.
    DATA: OBJHEAD LIKE SOLISTI1   OCCURS  1 WITH HEADER LINE.
    DATA: OBJBIN  LIKE SOLISTI1   OCCURS 10 WITH HEADER LINE.
    DATA: OBJTXT  LIKE SOLISTI1   OCCURS 10 WITH HEADER LINE.
    DATA: RECLIST LIKE SOMLRECI1  OCCURS  5 WITH HEADER LINE.
    DATA: DOC_CHNG LIKE SODOCCHGI1.
    DATA: TAB_LINES LIKE SY-TABIX.
    Creating the document to be sent
    DOC_CHNG-OBJ_NAME = 'OFFER'.
    DOC_CHNG-OBJ_DESCR = 'Auction of a Picasso jr'.
    OBJTXT = 'Reserve price : $250000'.
    APPEND OBJTXT.
    OBJTXT = 'A reproduction of the painting to be auctioned'.
    APPEND OBJTXT.
    OBJTXT = 'is enclosed as an attachment.'.
    APPEND OBJTXT.
    DESCRIBE TABLE OBJTXT LINES TAB_LINES.
    READ TABLE OBJTXT INDEX TAB_LINES.
    DOC_CHNG-DOC_SIZE = ( TAB_LINES - 1 ) * 255 + STRLEN( OBJTXT ).
    Creating the entry for the compressed document
    CLEAR OBJPACK-TRANSF_BIN.
    OBJPACK-HEAD_START = 1.
    OBJPACK-HEAD_NUM   = 0.
    OBJPACK-BODY_START = 1.
    OBJPACK-BODY_NUM   = TAB_LINES.
    OBJPACK-DOC_TYPE   = 'RAW'.
    APPEND OBJPACK.
    Creating the document attachment
    (Assume the data in OBJBIN are given in BMP format)
    OBJBIN = ' \O/ '. APPEND OBJBIN.
    OBJBIN = '     '. APPEND OBJBIN.
    OBJBIN = ' / \ '. APPEND OBJBIN.
    DESCRIBE TABLE OBJBIN LINES TAB_LINES.
    OBJHEAD = 'picasso.bmp'. APPEND OBJHEAD.
    Creating the entry for the compressed attachment
    OBJPACK-TRANSF_BIN = 'X'.
    OBJPACK-HEAD_START = 1.
    OBJPACK-HEAD_NUM   = 1.
    OBJPACK-BODY_START = 1.
    OBJPACK-BODY_NUM   = TAB_LINES.
    OBJPACK-DOC_TYPE   = 'BMP'.
    OBJPACK-OBJ_NAME   = 'ATTACHMENT'.
    OBJPACK-OBJ_DESCR = 'Reproduction object 138'.
    OBJPACK-DOC_SIZE   = TAB_LINES * 255.
    APPEND OBJPACK..
    Entering names in the distribution list
    RECLIST-RECEIVER = '<name>@yahoo.com'.
    RECLIST-REC_TYPE = 'U'.
    APPEND RECLIST.
    RECLIST-RECEIVER = 'DLI-NEUREICH'.
    RECLIST-REC_TYPE = 'P'.
    APPEND RECLIST.
    Sending the document
    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
        EXPORTING
             DOCUMENT_DATA = DOC_CHNG
             PUT_IN_OUTBOX = 'X'
             COMMIT_WORK   = 'X'
        TABLES
             PACKING_LIST  = OBJPACK
             OBJECT_HEADER = OBJHEAD
             CONTENTS_BIN  = OBJBIN
             CONTENTS_TXT  = OBJTXT
             RECEIVERS     = RECLIST
        EXCEPTIONS
             TOO_MANY_RECEIVERS = 1
             DOCUMENT_NOT_SENT  = 2
                   OPERATION_NO_AUTHORIZATION = 4
                   OTHERS = 99.
         CASE SY-SUBRC.
           WHEN 0.
             WRITE: / 'Result of the send process:'.
             LOOP AT RECLIST.
               WRITE: / RECLIST-RECEIVER(48), ':'.
               IF RECLIST-RETRN_CODE = 0.
                 WRITE 'sent successfully'.
               ELSE.
                 WRITE 'not sent'.
               ENDIF.
             ENDLOOP.
           WHEN 1.
         WRITE:
         / 'no authorization to send to the specified number recipients!'.
           WHEN 2.
             WRITE: / 'document could not be sent to any of the recipient'.
           WHEN 4.
             WRITE: / 'no authorization to send !'.
           WHEN OTHERS.
             WRITE: / 'error occurred during sending !'.
         ENDCASE.
    Regards,
    Pavan.

  • Send PDF  attachment through mail

    i have one PDF document on my desktop, i want to sent that PDF as attachment to mail through SAP.
    can anybody have idea how to get?

    i also had the same requirement... the following code is to attach a pdf file from PC. 'PDF' has been hard coded. to attach a text file change it to 'TXT'.
    *& Report  Y_FILE_FROM_PC
    REPORT  y_file_from_pc.
    * This program will allowed you to send email with attachment.
    First, specify the attachment file from your local hardisk and execute.
    Next, specify the sender email address and click the send button.
    DATA: method1 LIKE sy-ucomm,
    g_user LIKE soudnamei1,
    g_user_data LIKE soudatai1,
    g_owner LIKE soud-usrnam,
    g_receipients LIKE soos1 OCCURS 0 WITH HEADER LINE,
    g_document LIKE sood4 ,
    g_header LIKE sood2,
    g_folmam LIKE sofm2,
    g_objcnt LIKE soli OCCURS 0 WITH HEADER LINE,
    g_objhead LIKE soli OCCURS 0 WITH HEADER LINE,
    g_objpara LIKE selc OCCURS 0 WITH HEADER LINE,
    g_objparb LIKE soop1 OCCURS 0 WITH HEADER LINE,
    g_attachments LIKE sood5 OCCURS 0 WITH HEADER LINE,
    g_references LIKE soxrl OCCURS 0 WITH HEADER LINE,
    g_authority LIKE sofa-usracc,
    g_ref_document LIKE sood4,
    g_new_parent LIKE soodk.
    DATA: BEGIN OF g_files OCCURS 10 ,
    text(4096) TYPE c,
    END OF g_files.
    DATA : fold_number(12) TYPE c,
    fold_yr(2) TYPE c, fold_type(3) TYPE c.
    PARAMETERS ws_file(4096) TYPE c DEFAULT 'c:\debugger.PDF'.
    can me any file fromyour pc ....either xls or word or ppt etc ...
    g_user-sapname = sy-uname.
    CALL FUNCTION 'SO_USER_READ_API1'
    EXPORTING user = g_user
    prepare_for_folder_access = ' '
    IMPORTING
    user_data = g_user_data
    *EXCEPTIONS
    user_not_exist = 1
    parameter_error = 2
    x_error = 3
    OTHERS = 4
    IF sy-subrc NE 0.
    message id sy-msgid type sy-msgty number sy-msgno
    with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    fold_type = g_user_data-outboxfol+0(3).
    fold_yr = g_user_data-outboxfol+3(2).
    fold_number = g_user_data-outboxfol+5(12).
    CLEAR g_files.
    REFRESH : g_objcnt, g_objhead, g_objpara, g_objparb, g_receipients, g_attachments, g_references, g_files.
    method1 = 'SAVE'.
    g_document-foltp = fold_type.
    g_document-folyr = fold_yr.
    g_document-folno = fold_number.
    g_document-objtp = g_user_data-object_typ.
    *g_document-objyr = '27'.
    *g_document-objno = '000000002365'.
    *g_document-objnam = 'MESSAGE'.
    g_document-objdes = 'attach file from pc'.
    g_document-folrg = 'O'.
    *g_document-okcode = 'CHNG'.
    g_document-objlen = '0'.
    g_document-file_ext = 'PDF'.
    g_header-objdes = 'attach file from pc'.
    g_header-file_ext = 'PDF'.
    CALL FUNCTION 'SO_DOCUMENT_REPOSITORY_MANAGER'
    EXPORTING method = method1
    office_user = sy-uname
    ref_document = g_ref_document
    new_parent = g_new_parent
    IMPORTING
    authority = g_authority
    TABLES
    objcont = g_objcnt
    objhead = g_objhead
    objpara = g_objpara
    objparb = g_objparb
    recipients = g_receipients
    attachments = g_attachments
    references = g_references
    files = g_files
    CHANGING
    document = g_document
    header_data = g_header
    folmem_data =
    receive_data =
    file from the pc to send..
    method1 = 'ATTCREATEFROMPC'.
    g_files-text = ws_file.
    APPEND g_files.
    CALL FUNCTION 'SO_DOCUMENT_REPOSITORY_MANAGER'
      EXPORTING
        method       = method1
        office_user  = g_owner
        ref_document = g_ref_document
        new_parent   = g_new_parent
      IMPORTING
        authority    = g_authority
      TABLES
        objcont      = g_objcnt
        objhead      = g_objhead
        objpara      = g_objpara
        objparb      = g_objparb
        recipients   = g_receipients
        attachments  = g_attachments
        references   = g_references
        files        = g_files
      CHANGING
        document     = g_document
        header_data  = g_header.
    method1 = 'SEND'.
    g_receipients-recnam = 'ABAP'.
    g_receipients-recesc = 'B'.
    g_receipients-sndex = 'X'.
    APPEND g_receipients.
    CALL FUNCTION 'SO_DOCUMENT_REPOSITORY_MANAGER'
      EXPORTING
        method       = method1
        office_user  = g_owner
        ref_document = g_ref_document
        new_parent   = g_new_parent
      IMPORTING
        authority    = g_authority
      TABLES
        objcont      = g_objcnt
        objhead      = g_objhead
        objpara      = g_objpara
        objparb      = g_objparb
        recipients   = g_receipients
        attachments  = g_attachments
        references   = g_references
        files        = g_files
      CHANGING
        document     = g_document
        header_data  = g_header.
    hope this helps!

  • Sending smartforms as PDF attachement via e mail

    Hello all:
    I have configured PPF actions to send smartforms as PDF attchment via e mail it works fine in one client.
    But when I copied the transport to another client, the entries in field 'Recipient' in the configuration step 'Define Conditions and Output Parameters for Comm. of Cust.Shipm. & Cust.Dcl'  are not copied to the new client. I had maintained the name of the inbox folder that has e mail addresses in this field. Any one has a similar issue ? Or is this similar to the number ranges and not transportable and we have to maintain them in every client. Any insight into this very much appreciated.

    Hello:
    If you want to send the smartform as a PDF attachment, configure your PPF action as described below:
    Step 1: Define Techn. Medium for Msgs (PPF Actions) f. Cust. Shipm. and Cust. Decl.
                In the action definition, choose processing type as 'External Communication'
                                                             form type:  'Smart Forms'
                                                             format: /SAPSLL/FORM_PROC
                                                             personalization type: 2 object specific....
                Make this action definition partner function dependent and create a Z partner function. Maintain that  
                partner function in this definition.
    Step 2: Define Conditions and Output Parameters for Comm. of Cust.Shipm. & Cust.Dcl
                Select Communication Method: Internet Mail
                          Mail Settings: send status: 3
    Configure the reamaining PFF actions as usual.
    This will work if that configured partner function is maintained in the customs declaration. And for that business partner, maintain the e mail address in the address dependent section via txn BP.

Maybe you are looking for