2 PDF attachment in a single mail

Hi All ,
  Have any body seen the functionality of sending 2 PDF attachment in a mail .
If yes please provide some pointers .
Regards
Saurabh Garg

Hi,
I have develop this code to send multiple HTML attachments using CL_BCS class
Form f_send_html_mail.
  data: send_request       type ref to cl_bcs.
  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: exception_info     type ref to if_os_exception_info,
  bcs_exception            type ref to cx_document_bcs.
  data i_attachment_size type sood-objlen.
  data v_status          type bcs_stml.
  data v_request_status  type bcs_rqst.
  data : v_desc like sopcklsti1-obj_descr.
      concatenate 'Doc-' pdocno into v_desc.
      condense v_desc no-gaps.
      submit yttcr0001 exporting list to memory
               with p_docno = pdocno
               and return.
    call function 'LIST_FROM_MEMORY'
      tables
        listobject = report_list
      exceptions
        not_found  = 1
        others     = 2.
    call function 'WWW_HTML_FROM_LISTOBJECT'
      exporting
        template_name = 'WEBREPORTING_REPORT'
      tables
        html          = report_html
        listobject    = report_list.
    describe table objbin lines tab_lines.
    v_lines = tab_lines + 1.
    loop at report_html.
      move report_html to it_attach1.
      append it_attach1.
    endloop.
  send_request = cl_bcs=>create_persistent( ).
  try.
      document = cl_document_bcs=>create_document(
                                    i_type    = 'RAW'
                                    i_text = it_content[]
                                    i_subject = subject ).
      if not attach_name1 is initial.
        call method document->add_attachment
          exporting
            i_attachment_type    = attach_ext1
            i_attachment_subject = attach_name1
            i_att_content_text   = it_attach1[].
      endif.
     "<<< if you want multiple attachment then use this
      if not attach_name2 is initial.
        call method document->add_attachment
          exporting
            i_attachment_type    = attach_ext2
            i_attachment_subject = attach_name2
            i_att_content_text   = it_attach2[].
      endif.
      call method send_request->set_document( document ).
      sender = cl_sapuser_bcs=>create( sy-uname ).
      call method send_request->set_sender
        exporting
          i_sender = sender.
      loop at it_recipient.
        translate it_recipient-smtp_addr to lower case.
        recipient = cl_cam_address_bcs=>create_internet_address( it_recipient-smtp_addr ).
        call method send_request->add_recipient
          exporting
            i_recipient  = recipient
            i_express    = ' '
            i_copy       = ' '
            i_blind_copy = ' '
            i_no_forward = ' '.
      endloop.
      move : 'E' to v_request_status.
      v_status = v_request_status.
      call method send_request->set_status_attributes
        exporting
          i_requested_status = v_request_status
          i_status_mail      = v_status.
      call method send_request->send( ).
      commit work.
    catch cx_document_bcs into bcs_exception.
  endtry.
endform.                               

Similar Messages

  • How Do I Open a PDF attachment in IOS 8 mail app?

    Hi all,
    I am curious how do I open a pdf attachment in IOS 8 mail app?

    Hi,
    My friend has what you stated = a square with and arrow coming out the top and works as expected
    BUT I don't
    what happens to me - is the small muti page opens and does NOT show a pdf ICON - BUT DOES show only the first page and I DO NOT GET = a square with and arrow coming out the top TO CLICK ON!
    So it seems the normal behavior is not happening - how can I fix this - to see ALL pages and or open pdf in another pdf app?

  • Cannot open pdf attachment in my e-mail

    Cannot open pdf attachment in my e-mail                 I can open pdf files on the hard drive
    I am using Windows Internet Explorer 9, Microsoft Vista
    When I receive an e-mail with a pdf attachment a box pops up
    What do you want to do with
    get attachment __ aspx ? file =
    size: 3.11 kb
    from: blu166.mail.live.com
    open
    the file won't be saved automatically
    save
    save as
    cancel
    Your help will be appreciated

    Hi Pat
    Microsoft upgraded Hotmail e-mail accounts to Outlook.com
    The Print Screen key has no function.....when the 2 boxes mentioned above appear on the monitor (which I have detailed) they require action or I cannot proceed to another screen or function.
    Maybe my problem should also be sent to Microsoft Customer Service...your thoughts.
    I note there has been 106 views hard to believe that no one else has had this problem.
    Appreciate your time

  • PDF attachment not proper in Mail

    Hi All,
    We are facing a problem with PDF attachment through workflows.
    We are using CONVERT_ABAPSPOOLJOB_2_PDF to convert SPOOL to PDF and are getting binary file into it_xstring, pdf file into it_pdf. Now we are sending it_xstring to SAP_WAPI_ATTACHMENT_ADD for mail attachment. We are getting the PDF attachment, but the data is not fitting exactly onto the page. In other words, the entire data is being shown only in half of the page which in turn made the font size very small. But when we tried saving the PDF file it_pdf onto a local file through GUI_DOWNLOAD, it's giving the data correctly, as in, the output is being exactly fit into the page.
    Can we stretch the output in XSTIRNG (binaryfile)? Is there any way to show the output data properly in PDF attachment?
    Thanks a lot!!

    Does the FM "CONVERT_ABAPSPOOLJOB_2_PDF" return string ?
    The data that the FM returns if of the type "TLINE".
    Convert the it_pdf using the below:
    CALL FUNCTION 'SX_TABLE_LINE_WIDTH_CHANGE'
        EXPORTING
             LINE_WIDTH_SRC              = 134
             LINE_WIDTH_DST              = 255
         TABLES
              CONTENT_IN                  = PDF_FILE
              CONTENT_OUT                 = PDF_FILE_OUT
         EXCEPTIONS
              ERR_LINE_WIDTH_SRC_TOO_LONG = 1
              ERR_LINE_WIDTH_DST_TOO_LONG = 2
              ERR_CONV_FAILED             = 3
              OTHERS                      = 4.
    Use the method which suits you in the class "CL_BCS_CONVERT" and convert into XSTRING and pass it to the FM "SAP_WAPI_ATTACHMENT_ADD".
    Regards,
    PR.

  • Multiple Mail attachment (PDF and Excel) in a single mail

    Please help me to send the PDF and Excel attachment in the single mail. I am using the FM for PDF is 'SO_NEW_DOCUMENT_ATT_SEND_API1' and for Excel 'SO_DOCUMENT_SEND_API1'. Currently the program sends 2 different attachments for PDF and Excel.
    Thanks in Advance.

    Hi,
    If you want to send multiple attachments in a single mail then i would suggest to use
    CL_BCS for achieving it.
    Look at standard program BCS_EXAMPLE_6 for more clarity.
    There you find this statement of code
    document1 = cl_document_bcs=>create_document
    After creating one document using this you can use the same statement again and create another document.
    document2 = cl_document_bcs=>create_document
    Both documents should have different name.
    Then use
    send_request->set_document( document1 ).
    send_request->set_document( document2 ).
    This will attach both the documents to a single email.
    Hope this helps.
    Regards,
    -Sandeep

  • How to send multiple attachment in single mail

    i am using FM SO_NEW_DOCUMENT_ATT_SEND_API1 for sending mail.
    pls guide me how can i modify my code so that i can send multiple attachments

    Hi Manish,
    Check out the links below.
    E-mail multiple PDF attachments
    Send a Single Mail with Multiple Attachment
    Hope it helps.
    Regards,
    Amit
    *Always reward points for helpful answers
    Message was edited by:
            Amit Kumar

  • Multiple PDF Sending via single mail

    Hi Experts,
    I have a requirement in which when the user runs a report, he could get many invoices. We need to send all the invoices in the list converted to PDF and sent all the PDF(Multiple) to the sold to party mail ID.
    If the Size of the PDF attachment exceeds we need to send as multiple mails.
    I have only the invoice number and output type from the report. ITs not a print program there is no Close_form to get otf_data.
    Is there any function module to convert a invoice to OTF then to PDF. ?
    Is there any function module to send Mutiple PDF(MIN of 10) attached in a single mail ?
    Regards,
    Venkatesh.

    Hi
    USe this link.
    http://forums.sdn.sap.com/search.jspa?threadID=&q=multiplePDFinSinglemail&objID=f231&dateRange=all&numResults=15&rankBy=10001
    Regards
    Azeez

  • Sapscript/Smartform via mail with PDF attachment: logo is missing

    Hi all
    I'm implementing my function to send Sapscript/smartform via mail.
    I need to do it because when a message needs to be sent, I have to insert the message as attachment but also to add a text in the body mail.
    So I've just created a simple sapscript having a logo (as graphic) and a little text.
    I use the fm CONVERT_OTF to convert the OTF to PDF format and the following code to increase the pdf string from 132 to 255 char:
    LOOP AT t_pdf.
          TRANSLATE t_pdf USING ' ~'.
          CONCATENATE l_buffer t_pdf INTO l_buffer.
        ENDLOOP.
        TRANSLATE l_buffer USING '~ '.
        DO.
          MOVE l_buffer TO l_attachment.
          APPEND l_attachment TO x_attachment.
          SHIFT l_buffer LEFT BY 255 PLACES.
          IF l_buffer IS INITIAL.
            EXIT.
          ENDIF.
        ENDDO.
    All seem to work fine, but as soon as I open the pdf file attached to the mail I can't see the logo
    So after calling fm CONVERT_OTF, I've created a pdf file by method GUI_DOWNLOAD, and then upload this file (by GUI_UPLOAD) into internal table for attachment and send the mail.
    Now really all work very fine, becaus I can see the logo
    Of course I don't want to dowload the file before sending a mail, but I need to send my print directly as pdf attachment
    The two ways seem to be equal, they use the same print and the same functions, only the way to upload the internal table for attachment is different:
    1) tha abap code above to expand the line from 132 to 255
    2) the method GUI_UPLOAD
    So something seems to be wrong in the first way because ithe logo is missing in the pdf attachment generated for the mail
    Max

    Hi
    I'm not working on unicode system, anyway I didn't see that parameter BIN_FILE, so I didn't use it
    I've read the note 1324547 and I've done just as it explaines: now works fine
    I don't know why it doesn't work with old manner (i.e data is treated as character-type), but it worls with the new one (If the data is treated as xstring-type)
    I can only suppose the data are corrupted while being elaborated for expand to 255 char....but I don't why
    Anyway your suggestion works for me
    Thank
    Max

  • Can't open .pdf attachment to e-mail

    After straightening out the conflict between Reader & Acrobat (deleted Reader per suggestion on this forum), I now have a new problem.  When I double click a .pdf attachment to an e-mail (I use Thunderbird), I get the following message:
    "C:\DOCUME~1\HP_ADM~1\LOCALS~1\Temp\ADOBE.pdf could not be opened because the associated helper application does not exist. Change the association in your preferences."
    I went to Preferences of Acrobat 9 std but couldn't find anything that seemed to relate to a helper application.
    Any suggestions?
    Thanks.

    Turns out I found a note from Mozilla when this was a problem with
    reader that said to simply delete that preference for acrobat.  Then,
    when I click to open the .pdf file, Thunderbird asks me if I want to use
    Acrobat 9.1 and has a box to click to enable this to occur every time.
    It worked.
    If anyone else encounters this, here's the website containing the
    solution for both Firefox & Thunderbird.
    http://kb.mozillazine.org/The_associated_helper_application_does_not_exist
    Cheers,
    Keith

  • How do I send a adobe pdf attachment to a flash drive from e-mail account?

    How do I send a pdf attachment from my e-mail to a flash drive?
    Thank you for your assisttance.

    In the email client save the attachment to the flash drive.

  • Sending mails from sap to outlook with pdf attachment

    Hi All
    I am using the function module 'SO_NEW_DOCUMENT_ATT_SEND_API1' to send
    mail with the pdf attachment to a SMTP mail id(outlook). I have done all the configuration settings in SCOT transaction. But still i am not able to get the mail in my outlook mailbox. Following are the details of the steps i have followed.
    step1.
    Get the OTF data output from the SMARTFORMS function module.
    step2,
    convert the OTF output data to PDF format.
    step3.
    populate all the required table to pass data to the function
    module 'SO_NEW_DOCUMENT_ATT_SEND_API1' -
                packing_list              
                contents_bin              
                contents_txt              
                receivers 
    and call the function module.
    After doing the above steps still i am not able to get the mail in my outlook mailbox. Please Help.
    Thanks
    Jitendra Kumar Tripathy.

    hi,
    kindly chk the code i wrote for my program.
    it will  solve ur issue.
    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.
    if helped rwrd points
    anver

  • How to send dashboard html & attachment in a single i-bot

    Hello friends,
    I have two questions.
    1.Is it possible to send the multiple reports in a single i-bot?
    For example: I have two reports A & B. I want to send it in a single mail (i-Bot)
    2.Is it possible to send the report as both HTML & attachment?
    For example: I have a report A. I want to send it as both HTML & as an attachment in a single mail (i-Bot)
    Your prompt reply will be greatly appreciated
    Thanks & Regards,
    Satya

    i m not sure, but 1 ibot delivers either a report, or dashboard or brief book, or Condition analysis but not multiple. And only one format can be chosen per delivery.
    just for an idea, Include the 2 reports in a new dashboard and deliver the new dashboard.
    Regards,
    Arjun.

  • Help - PDF Attachment Problem

    Hi,
    Receently, some of our users experienced pdf attachment problem. The user sent a 4mb pdf attachment but after the mail was sent out it only showed 4k in sent item. When the recipient received the e-mail the attachment also showed 4kb and it can't be opend too. These users are using Outlook 2000 and our Exchange server is 2000 Enterprise.
    Thanks for the help,
    JY

    Hi Suresh,
    I just tried this thing in my systtem and it is working... BADI is trigerred everytime there is a change in the PO... even when you release there is a change in the PO so this BADI will be triggerred....
    I suggest you should implement BADI in your dev system and place a break point in the POST method...
    After that create a PO and release it using ME29N... thereafter when you save the PO... this method will trigger and you will have access to PO details...
    PS: Remember this BADI wont work for transaction ME29...
    Regards
    Gautam

  • In the mail app why can't I see single page pdf attachment created by SSRS R2 on iPad with iOS 8?

    We have reports that are generated using Sql Server Reporting Services 2008 R2 and are distributed to users by email as a PDF attachment.  This worked fine in iOS 7 but ever since users have updated to iOS 8 the single page PDF is missing even though it has the paper clip icon indicating there is an attachment with the email.  If the PDF is multiple pages then the PDF icon would appear but there seems to be a problem with the single page pdf that is embedded on the mail app in iOS 8.
    We've recreated this issue creating a test report and sent it to iPads that have iOS 7, iOS 8 using different models of iPads (2, 3, 4) and the ones that have iOS 7 work fine.  Only the ones that have iOS 8 have this issue.  Also tried changing the format of the file to a PNG, TIFF and again the same results on the iPads with iOS 7 display it correctly.  Another test we did was send the PDF to our personal email and open it on our home iPads we were not able to see the single page PDF on iOS 8.  Looking at the headers of the email I can see the that the Content-Type is multipart/mixed.  When the original is forwarded to oneself on the iPad the attachment is included but the Content-Type is application/ms-tnef.

    Can you check your email headers, I have also noticed this for reports that are generated using Sql Server Reporting Services 2008 R2. It could to be due to the Content-ID header I believe.
    As a single page attachment on iPad will try and display inline, the Content_ID header is possibly affecting this and showing a small blank square as the image instead. Although this isn't defined as inline within the Content-Disposition header and will appear as an attachment on Outlook.

  • STO mail : pdf attachment has an error 'file damage' when try to open it

    Dear expert,
    I need to send an e-mail to the vendor with the sto list as attachment at the email.
    I managed to send email to external addresee and made the pdf attachment, BUT somehow when I open the attachment it has an error says "Adobe Reader could not open xx.pdf because it is either not a supported file type or because the file has been damaged(for axample, it was sent as an email attachment and wasn't corectly decoded)."
    Really need your experties to help me. Here is my abap coding to send email and do the pdf attachment at the new ouptput type to send email.
      TYPES: BEGIN OF lty_drad,
              doknr TYPE drad-doknr,
             END OF lty_drad,
             BEGIN OF lty_recpt,
               smtp_addr  TYPE ad_smtpadr,
             END   OF lty_recpt.
      DATA: lt_doc      TYPE STANDARD TABLE OF docs,
            lt_recpt    TYPE STANDARD TABLE OF lty_recpt,
            lt_tline    LIKE tline OCCURS 0 WITH HEADER LINE,
            lt_data     TYPE solix_tab,
            lt_docu     TYPE STANDARD TABLE OF lty_drad,
            lt_docfiles TYPE STANDARD TABLE OF bapi_doc_files2,
            lw_tline    LIKE LINE OF lt_tline,
            lw_docu     LIKE LINE OF lt_docu,
            lw_docfiles LIKE LINE OF lt_docfiles,
            lw_objdes   TYPE tnati-objdes,
            lt_text     TYPE bcsy_text,
            lw_recpt    TYPE adr6-smtp_addr,
            lw_adrnr    TYPE lfa1-adrnr,
            lw_object   TYPE drad-objky,
            lw_doknr    TYPE drad-doknr,
            lw_return   TYPE  bapiret2,
            lw_xcontent TYPE xstring,
            client    TYPE REF TO if_http_client,
             url       TYPE string,
             lw_subrc  TYPE sysubrc,
             response  TYPE REF TO if_http_response,
             lw_message1 TYPE string,
           sent_to_all TYPE os_boolean,
           bin_filesize type i.
      CONSTANTS: lc_dokar_srm TYPE drad-dokar VALUE 'SRM',
                 lc_type      TYPE so_obj_tp  VALUE 'RAW'.
    CLASS-DEFINITIONS
      DATA: send_request       TYPE REF TO cl_bcs.
      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: exception_info     TYPE REF TO if_os_exception_info,
            bcs_exception      TYPE REF TO cx_bcs.
      RANGES: lr_po_pr   FOR  drad-objky.
      DATA:   lw_banfn   TYPE ekpo-banfn,
              lw_bnfpo   TYPE ekpo-bnfpo.
      IF nast-nacha = '5'. "8
    Create recipient and check if exist
       Get email ID
      start commented by sapnislina 21.12.06
       SELECT SINGLE adrnr FROM lfa1 INTO lw_adrnr
                    WHERE lifnr = p_ekko-lifnr.
       IF sy-subrc NE 0.
         PERFORM protocol_update
           USING '303' 'Address of Vendor:' ekko-lifnr 'not found' space
         p_retco = sy-subrc.
         EXIT.
       ENDIF.
      end commented by sapnislina 21.12.06
       SELECT smtp_addr INTO CORRESPONDING FIELDS OF TABLE lt_recpt
            FROM adr6
           WHERE addrnumber = p_ekko-adrnr. "lw_adrnr.
        IF lt_recpt[] IS INITIAL.
          PERFORM protocol_update
            USING '303' 'Email address(es) does not exist for vendor'
            p_ekko-lifnr space space.
          p_retco = sy-subrc.
          EXIT.
        ENDIF.
        CALL FUNCTION 'CONVERT_OTF_2_PDF'
          EXPORTING
            use_otf_mc_cmd         = 'X'
          IMPORTING
            bin_filesize           = bin_filesize
          TABLES
            otf                    = otfdata[]
            doctab_archive         = lt_doc
            lines                  = lt_tline
          EXCEPTIONS
            err_conv_not_possible  = 1
            err_otf_mc_noendmarker = 2
            OTHERS                 = 3.
        IF sy-subrc <> 0.
        PERFORM protocol_update
            USING '303' 'PO Convertion from OTF to PDF failed'
                  space space space.
          p_retco = sy-subrc.
          EXIT.
        ENDIF.
    Get object description from mail title of output types
       SELECT SINGLE objdes INTO lw_objdes
              FROM tnati
              WHERE spras = sy-langu
              AND   kappl = nast-kappl
              AND   kschl = nast-kschl.
       CONCATENATE lw_objdes ekko-ebeln INTO lw_objdes SEPARATED BY
    space
        DATA L_TXT(255) TYPE C.
        DATA L_TXT2(255) TYPE C.
        CONCATENATE 'STO' EKPO-EBELN 'Created for' EKPO-WERKS '/'
    EKPO-LGORT
        'Supply Plant' EKKO-RESWK into l_txt separated by space.
        lw_objdes = l_txt.
        CONCATENATE 'STO' EKKO-EBELN INTO L_TXT2 SEPARATED BY SPACE.
        APPEND L_TXT2 TO LT_TEXT.
       APPEND lw_objdes TO lt_text.
    Instantiate
        CLASS cl_cam_address_bcs DEFINITION LOAD.
        CLASS cl_abap_char_utilities DEFINITION LOAD.
    insert by sapnislina 22.12.06
      DATA : CONTENT_OUT TYPE SOLIX,
             LINE_WIDTH_SRC TYPE I,
             POS_OUT TYPE I,
             POS_IN TYPE I,
             LEN_OUT TYPE I.
      DATA OBJBIN LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE.
      DATA : BEGIN OF CONTENT_IN,
                LINE TYPE TLINE,
                DUMMY TYPE TLINE,
             END OF CONTENT_IN.
      TYPES PDF_RAW TYPE X LENGTH 268.
      FIELD-SYMBOLS <PDF_BIN> TYPE PDF_RAW.
      DESCRIBE FIELD CONTENT_IN-LINE LENGTH LINE_WIDTH_SRC IN BYTE MODE.
      REFRESH lt_data.
      CLEAR CONTENT_OUT.
      POS_OUT = 0.
      LOOP AT OTFDATA INTO CONTENT_IN-LINE.
        ASSIGN CONTENT_IN TO <PDF_BIN> CASTING.
        MOVE <PDF_BIN> TO CONTENT_OUT-LINE+POS_OUT.
        ADD LINE_WIDTH_SRC TO POS_OUT.
        WHILE POS_OUT >= 255.
          APPEND CONTENT_OUT TO lt_data.
          CLEAR CONTENT_OUT.
          SUBTRACT 255 FROM POS_OUT.
          IF POS_OUT > 0.
            POS_IN = LINE_WIDTH_SRC - POS_OUT.
            MOVE <PDF_BIN>+POS_IN TO CONTENT_OUT-LINE.
          ENDIF.
        ENDWHILE.
      ENDLOOP.
      IF POS_OUT > 0.
      APPEND CONTENT_OUT TO lt_data.
      ENDIF.
    end inserted by sapnislina 22.12.06
    starting to create attachment to mail
        TRY.
           CLEAR send_request .
    Create persistent send request
            send_request = cl_bcs=>create_persistent( ).
    Build the document
            document = cl_document_bcs=>create_document(
                                i_type    = lc_type  "RAW
                                i_text    = lt_text  "def of output type
                                i_length  = '12'
                                i_subject = lw_objdes ).
    Attached the document object
            CALL METHOD document->add_attachment
              EXPORTING
                i_attachment_type    = 'PDF'
                i_attachment_subject = lw_objdes "definition of output
    type
                i_attachment_size    = '12'
                i_att_content_hex    = lt_data.
    completed first part to attached PO (pdf format) as attachment
    Now attach the PO related attachments to the mail..
    .... need to read from table DRAD and get all the attachment per PO
         at run time
         REFRESH: lr_po_pr."lt_return.
            CLEAR:   lr_po_pr,lw_return.
            MOVE  'ICP'  TO  lr_po_pr.
         CLEAR: lw_object.
    completed second part for PO related attachments
    Now prepare to send mail
    Add document to send request
         CALL METHOD send_request->set_document( document ).
    Get sender object
         sender = cl_sapuser_bcs=>create( sy-uname ).
    Add sender
         CALL METHOD send_request->set_sender
           EXPORTING
             i_sender = sender.
         LOOP AT lt_recpt INTO lw_recpt
                          WHERE NOT smtp_addr IS INITIAL.
          recipient = cl_cam_address_bcs=>create_internet_address(
    lw_recpt ).
    Add recipient with its respective attributes to send request
            CALL METHOD send_request->add_recipient
              EXPORTING
                i_recipient = recipient
                i_express   = 'X'.
            CLEAR recipient.
         ENDLOOP.
    Send the document
        CALL METHOD send_request->send
          RECEIVING
            result              = sent_to_all.
    Catch any exception
          CATCH cx_bcs INTO bcs_exception.
              CALL FUNCTION 'NAST_PROTOCOL_UPDATE'
                EXPORTING
                  msg_arbgb = bcs_exception->msgid
                  msg_nr    = bcs_exception->msgno
                  msg_ty    = bcs_exception->msgty
                  msg_v1    = bcs_exception->msgv1
                  msg_v2    = bcs_exception->msgv2
                  msg_v3    = bcs_exception->msgv3
                  msg_v4    = bcs_exception->msgv4
                EXCEPTIONS
                  OTHERS    = 1.
              p_retco = sy-subrc.
        ENDTRY.
      ENDIF.
      IF NOT result-tdfaxid  IS INITIAL OR                      " 422131
         NOT result-tdmailid IS INITIAL.                        " 422131
        CLEAR syst-msgv1.                                       " 422131
        IF NOT result-tdfaxid IS INITIAL.                       " 422131
          syst-msgv1 = result-tdfaxid.                          " 422131
        ELSEIF result-tdmailid IS INITIAL.                      " 422131
          syst-msgv1 = result-tdmailid.                         " 422131
        ENDIF.                                                  " 422131
        CALL FUNCTION 'NAST_PROTOCOL_UPDATE'                    " 422131
             EXPORTING                                          " 422131
                  msg_arbgb = 'VN'                              " 422131
                  msg_nr    = '095'                             " 422131
                  msg_ty    = 'I'                               " 422131
                  msg_v1    = syst-msgv1                        " 422131
             EXCEPTIONS                                         " 422131
                  OTHERS    = 1.                                " 422131
      ENDIF.                                                    " 422131
      IF result-userexit EQ 'C' OR
          result-userexit EQ 'E'.
        p_retco = '9'.
      ENDIF.
    ENDFORM.                               " ENDE
    end inserted
    Regards
    Nislina

    Hi Nislina,
    Could you please let me know how do you solve this issue.
    Code:
    if lt_binary[] is not initial.
    *     add attachment to document
             call method document->add_attachment
               exporting
                 i_attachment_type      = 'PDF'            
                 i_attachment_subject = 'My Attachment'
                 i_att_content_hex      = lt_binary.
      endif.
    Thanks & Regard's
    Sateesh

Maybe you are looking for

  • Debit note - Subsequent debit

    Dear all 1.what is the difference between debit note and subsequent debit 2.credit note and subsequent credit 3.credit memo Please guide me with a simple example

  • Packages in odi

    hi friends.. I am very new to ODI. Can any one please tell me how to work with packages and what is its function and how packages work??? soumya.

  • Any BAPI for Auto clearing of Vendor accounts

    Hai, Any body know, any BAPI for Auto clearing of the Vendor account(transaction F.13). This urgent issue. Reward will promote you. Bye , Elamaran

  • Is playing games on my mac air going to ruin it?

    i installed world or warcarft of my computer and when i start playing it the fan kicks in on high gear and the computer gets warm. is that going to hurt my computer?

  • Don't see changes in Live View until after 30 second delay

    Running Dreamweaver CS5.5 on Mac OS X 10.7.5 Running Locally using MAMP Site is configured to run on a local PHP/MySQL server, and consists of a single index.php file with nothing more than an html header (I don't even have any PHP in there yet). Whe