Sending smartform through email as PDF attachment

Hi,
I want to send a smartform through email as pdf attachment.In the code I have hardcoded the receiver mail id.But I don't want this to be sent only to a particular receiver.I want this to be sent as many people as I can without hardcoding their mail id's in the program.How can I do that?
Regards,
Hema

**Data Declarations
**Internal Table
DATA : BEGIN OF it_spfli OCCURS 0,
          carrid LIKE spfli-carrid,
          connid LIKE spfli-connid,
       END OF it_spfli.
DATA:   it_packing_list LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
        it_contents     LIKE solisti1 OCCURS 0 WITH HEADER LINE,
storing receivers      
        it_receivers    LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
**storing file attachment data
        it_attachment   LIKE solisti1 OCCURS 0 WITH HEADER LINE,                    gd_doc_data     LIKE sodocchgi1,
        gd_error        TYPE sy-subrc,
        l_gntxt         LIKE t357g_t-gntxt,
        lv_message(100) TYPE c.
DATA:   it_message TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0
                WITH HEADER LINE. "storing mail body
DATA : psubject(30) TYPE c VALUE 'Sample Mail'. "subject of the mail
DATA : ld_format TYPE so_obj_tp , "file format
       ld_attfilename TYPE so_obj_des, "file name
       w_cnt TYPE i.
**Selecting the data
SELECT carrid connid INTO TABLE it_spfli FROM spfli WHERE carrid EQ 'AA'.
**Perform for populating mail body
PERFORM populate_message.
**Perform for populating file attachment
PERFORM populate_attachment.
**Perform for populating mail characteristic info
PERFORM populate_pack.
**Perform for populating receivers
PERFORM populate_receivers.
**Perform to send mail
PERFORM send_mail.
*&      Form  populate_message
      text
-->  p1        text
<--  p2        text
FORM populate_message .
**Populating the body
  lv_message = 'Sample mail for testing purpose.'.
  APPEND lv_message TO it_message.
ENDFORM.                    " populate_message
*&      Form  populate_attachment
      text
-->  p1        text
<--  p2        text
FORM populate_attachment .
**Populating the attachment file with the data from final intenal table
  CONCATENATE 'CARRIER ID'
              'CONNECTION ID'
              INTO it_attachment SEPARATED BY
              cl_abap_char_utilities=>horizontal_tab.
  CONCATENATE cl_abap_char_utilities=>cr_lf it_attachment INTO
  it_attachment.
  APPEND it_attachment.
  LOOP AT it_spfli.
    CONCATENATE it_spfli-carrid it_spfli-connid INTO it_attachment SEPARATED BY
             cl_abap_char_utilities=>horizontal_tab.
    CONCATENATE cl_abap_char_utilities=>cr_lf it_attachment INTO
    it_attachment.
    APPEND it_attachment.
  ENDLOOP.
ENDFORM.                    " populate_attachment
*&      Form  populate_receivers
      text
-->  p1        text
<--  p2        text
FORM populate_receivers .
**Populating Mail Recepients
**If there are more than one mail recepient then loop and append them to it_receivers
  it_receivers-receiver = '[email protected]'.
  it_receivers-rec_type = 'U'.
  it_receivers-com_type = 'INT'.
  it_receivers-notif_del = 'X'.
  it_receivers-notif_ndel = 'X'.
  it_receivers-express = 'X'.
  APPEND it_receivers.
ENDFORM.                    " populate_receivers
*&      Form  populate_pack
      text
-->  p1        text
<--  p2        text
FORM populate_pack .
**File Type
  ld_format = 'XLS'.
**File Name
  ld_attfilename = 'File1'.
Fill the document data.
  gd_doc_data-doc_size = 1.
Populate the subject/generic message attributes
  gd_doc_data-obj_langu = sy-langu.
  gd_doc_data-obj_name = 'SAPRPT'.
  gd_doc_data-obj_descr = psubject .
  gd_doc_data-sensitivty = 'F'.
Fill the document data and get size of attachment
  CLEAR gd_doc_data.
Populate the subject/generic message attributes
  gd_doc_data-obj_langu = sy-langu.
  READ TABLE it_attachment INDEX w_cnt.
  gd_doc_data-doc_size = ( w_cnt - 1 ) * 255 + STRLEN( it_attachment ).
  gd_doc_data-obj_name  = 'SAPRPT'.
  gd_doc_data-obj_descr = psubject.
  gd_doc_data-sensitivty = 'F'.
Describe the body of the message
  CLEAR it_packing_list.
  REFRESH it_packing_list.
  it_packing_list-transf_bin = space.
  it_packing_list-head_start = 1.
  it_packing_list-head_num = 0.
  it_packing_list-body_start = 1.
  DESCRIBE TABLE it_message LINES it_packing_list-body_num.
  it_packing_list-doc_type = 'RAW'.
  APPEND it_packing_list.
**Describe the attachment info
  it_packing_list-transf_bin = 'X'.
  it_packing_list-head_start = 1.
  it_packing_list-head_num = 1.
  it_packing_list-body_start = 1.
  DESCRIBE TABLE it_attachment LINES  it_packing_list-body_num.
  it_packing_list-doc_type = ld_format.
  it_packing_list-obj_name = ld_attfilename.
  it_packing_list-obj_descr = ld_attfilename.
  it_packing_list-doc_size = it_packing_list-body_num * 255.
  APPEND it_packing_list.
ENDFORM.                    " populate_pack
*&      Form  send_mail
      text
-->  p1        text
<--  p2        text
FORM send_mail .
**Function Module to send mail
  CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
    EXPORTING
      document_data              = gd_doc_data
      put_in_outbox              = 'X'
      commit_work                = 'X'
    TABLES
      packing_list               = it_packing_list
      contents_bin               = it_attachment
      contents_txt               = it_message
      receivers                  = it_receivers
    EXCEPTIONS
      too_many_receivers         = 1
      document_not_sent          = 2
      document_type_not_exist    = 3
      operation_no_authorization = 4
      parameter_error            = 5
      x_error                    = 6
      enqueue_error              = 7
      OTHERS                     = 8.
ENDFORM.                    " send_mail

Similar Messages

  • External Send PO as email with PDF attachment not working

    hi,
    we are using ECC6, and in txn NACT, Processing routine we can use Sapscript External send > SAPFM06P > ENTRY_NEU > MEDRUCK > PDF and in MN04/5 i create Output record, and in SCOT my PO is ready for transmission from either ME21N/2 and ME9F - works well - email sent with pdf PO attached.
    <b>HOWEVER,</b> we have just created a SMARTFORM PO, and with similar settings, i cannot create External send OUTPUT!!! (Output failed in ME9F/ME23N) NACT settings External Send > /SMB40/FM06P > Z_MMPO_A > PDF
    In SCOT > SMTP > Internet X > Sapscript/SmartForm = PDF.
    Does special code need to be entered into Smartform to generate PDF email similar to Sapscript? Any code would be appreciated.
    regards Adam

    Hi,
    You need to build a code to create the Spool OTF output into PDF.
    This can be done in Print program, which converts the spool into PDF & sends a mail with PDF attachment.
    Please refer this sample program:
    http://www.sapdevelopment.co.uk/reporting/rep_spooltopdf.htm
    Best regards,
    Prashant

  • Edit invoice smartform to email with pdf attachment

    Hi,
    I need to send the invoice details by mail that are currently only printed through the edit function.
    When i go to VF02 enter invoice number and then edit, is it possible to send this message through email with the invoice as pdf attachment?
    Also it would be necessary to enter receivers email at that time.
    Maybe there is an exit before the sending that could raise a popup...
    Do you think this can be done this way?
    Thanks,
    Laurent.

    Hi Laurent
    I have done this succesfully in a different way:
    1) Create a Z Table for the email ID per Bill to party  - this table accomodates up to 999 email ids per customer and also has a column for CC
    2) Create a new output type for EMAIL purposes with the Transmission medium as 1 -
    assign the output program and form to this.
    In the program, add new code to refer to the new Z table for getting the email ids of respective Bill to parties
    In the program add code to convert the form to PDF format and attach to the email craeted.
    Your ABAPPER should be able to assist in this code writing - in my case it took some time to get the desired result but the customers are very happy with the end result -
    best wishes
    Nandu

  • Sending smartform through email or fax

    Hi,
    I have to send the smartform output through email if the email address is present else it has to be sent through fax.
    When I tested the program it is giving information message as 'Output was successfully issued'.But I am not able to see any entry in SOST transaction.What would be the reason for this?

    In SAP Table USR21, put enter the username in field BNAME, from there you will get the ADDRNUMBER

  • New output type to be triggered to send smartform through email

    Hi,
    Currently we are using Milwaukee printer (USJC-PM03) as default for out put type ZURD. When this output get created in the invoice with the printer as USJC-PM03, the iinvoices get printed on the Milwaukee printer.
    When someone tries to print an invoice by copying the ZURD, then system should trigger the newly created output ZUPG with the printer setting as u2018LOCLu2019 and medium u2018External Sendu2019, Communication strategy = u2018CS01u2019,dispatch time = 1.
    When again the user tries to print the same  invoice by copying the ZUPG output type,the system should trigger the output type ZUPG with medium u2018Print outu2019, Logical Destination = u2018LOCLu2019 and Dispatch time = u20181u2019.
    How the output type ZUPG be triggered even if the user select the output type ZURD.
    If anyone has come across this type of requirement please let me know.

    This can be done with the standard form itself.
    first find out the output type u r using.
    Then goto T-code NACE and then choose EF- purchase order and then select the output type u r using.
    Then goto the 'processing Routines' at the lefe side of the screen.
    There u can find out the output forms for this output typr u r using. Here add 'Simple mail-7' in the list and then give the program name and the smartform or the script u r using.
    We can also give the mail texts for this output form.
    After that goto ME22N and then choose the 'Messages' tab and then click the simple mail and in the 'communication method' kindly provide the mail id for which the PO mail has to be sent.
    And then the mail can be viewed in the inbox of the recipient.
    in this way we can sent the PO mail to the corresponding mail address,.
    I guess this will solve ur issue.
    Thanks and Regards
    Siva
    Edited by: Sivaprakash R on Apr 20, 2009 1:00 PM
    Edited by: Sivaprakash R on Apr 20, 2009 1:00 PM

  • Smartform through email

    Hi,
    I have a requirement to send the smartform through email as PDF attachment.I have declared
    DATA: lt_lines TYPE TABLE OF tline WITH HEADER LINE.
    for the PDF data.
    But lt_lines field is not getting populated with values.
    Can anyone tell me what would be the reason for this?

    hi,
    First thing would be try to debug ur code by putting the break point at Convert_Otf.... and c whether u r getting any data into the internal table once u execute that fm...
    second option would be...
    There are lot of sample codes in SDN for the same scenario... go through it once and try to find where exactly it is going wrong... in that fashion u can easily solve ur prob.

  • Send Invoice email with pdf attachement through DI?

    Hi all,
    is it possible to send an Invoice email with pdf attachement through DI as it can be done through UI?
    Best Regards,
    Vangelis

    Hi Vangelis,
    I Don't think that the DI API has that functionality (but I am not sure).
    However with .Net's System.Net.Mail it should be quite easy to build.
    Good luck,
    Johan

  • Send Smartform as Email body not PDF attachment

    Hello Experts,
    I have a requirement where I need to send Smartform as Email body and NOT as PDF attachment.
    I have spool ID generated for the smartform, how can I send this spool in Email body rather than as an attachment.

    Hi K C
    Try this.. Get the OTF data from the SMARTFORM, use the OTF data and pass this to FM'CONVERT_OTF', and use the format as PDF.
    Then use the resultant converted PDF data as attachment while calling the  'SO_NEW_DOCUMENT_ATT_SEND_API1' FM.
    let us know if this works.
    Thanks
    Rajesh Chowdary

  • I work for a retailer who sends out e-receipts as pdf attachements.  When the email arrives on any apple product, i see the email with the paperclip icon showing that there is an attachment but i cannot ever see or find the actual attachment.  Any ideas?

    i work for a retailer who sends out e-receipts as pdf attachements.  When the email arrives on any apple product, i see the email with the paperclip icon showing that there is an attachment but i cannot ever see or find the actual attachment.  Any ideas?

    i have scrolled left, right, up and down on iphone4, iphone5 and ipad and the attachment simply does not exist.  It has to be something with the apple mail client setup because for any mail client, if they go to the webemail thru safari, the attachment is there and it can be viewed without issue.
    I know there are plenty of people out there with this issue with the mail clients set up that you access thru the email icon on the iphone and ipad but i cannot find anyone with a resolution.  I cannot find any settings in the mail client setup that has anything to do with attachments or for what attachments can or cannot be read or seen.
    Hopefully someone out there has figured something out because this is an odd one.

  • Problem in sending online interactive form in email as PDF attachment

    Hi,
    I am trying to send online intercative forms as PDF attachment once user fills it and click on send button. But this mail i am trying to send from SAP workflow. For this am using one function module which is accepting the pdfsource context attribute of binary type as Xstring. Once i run the webdynpro application i am getting mail in out look but when i open the attachment i am getting error file is damaged.
    Can you pls help me in solving this, Or any other way for doing the same.
    Here is the code i am using for triggering the RFC from WD
    Zsend_Mail_Attachment_Sev_Input mail = new Zsend_Mail_Attachment_Sev_Input();     
              //to capture the outplacement level entered in the form
              mail.setI_Out_Place_Level(wdContext.currentVn_severancedetailsElement().getVa_outplacement_level().getBytes());
         mail.setI_Bin_Data(wdContext.currentContextElement().getPdfSource());
         wdContext.nodeZsend_Mail_Attachment_Sev_Input().bind(mail);
         try
              wdContext.currentZsend_Mail_Attachment_Sev_InputElement().modelObject().execute();
              wdComponentAPI.getMessageManager().reportSuccess("Notification Sent Successfully.");
         catch (WDDynamicRFCExecuteException e)
              // TODO Auto-generated catch block
              wdComponentAPI.getMessageManager().reportSuccess(" This is inside the mail exception!!"+e);
              e.printStackTrace();
    Here is the function module code
    FUNCTION ZSEND_MAIL_ATTACHMENT_SEV.
    ""Local Interface:
    *"  IMPORTING
    *"     VALUE(I_OUT_PLACE_LEVEL) TYPE  XSTRING OPTIONAL
    *"     VALUE(I_BIN_DATA) TYPE  XSTRING OPTIONAL
    *"  TABLES
    *"      T_V_BIN_DATA STRUCTURE  SOLISTI1
    *"      IT_MESSAGE STRUCTURE  SOLISTI1
    Data Declaration
      DATA: gd_cnt TYPE i,
            gd_sent_all(1) TYPE c,
            gd_error TYPE sy-subrc,
            tab_lines LIKE sy-tabix,
            v_subject(255) VALUE 'HI'.
    Structure Declaration
      DATA : BEGIN OF it_file OCCURS 0,
              row(255),
             END OF it_file.
      DATA : BEGIN OF i_split OCCURS 0,
      row(50),
      END OF i_split.
    DESCRIBE TABLE it_message LINES tab_lines.
    READ TABLE it_message INDEX tab_lines.
    Internal Table Declaration
      data : it_receivers like table of SOMLRECI1 with header line."occurs 0.
      DATA : objbin LIKE SOLIX OCCURS 0 WITH HEADER LINE.
      DATA : it_packing_list LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE.
      data : wa_receiver like table of SOMLRECI1 with header line.
      data : it_receiver like table of SOMLRECI1 with header line.
      DATA :   gd_doc_data LIKE sodocchgi1 OCCURS 0 WITH HEADER LINE.
      REFRESH : objbin, it_packing_list, it_receivers, wa_receiver.
      CLEAR   : objbin, it_packing_list, wa_receiver, it_receivers.
    gd_doc_data-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( it_message ).
    gd_doc_data-obj_langu = sy-langu.
    gd_doc_data-obj_name = 'SENDFILE'.
    gd_doc_data-obj_descr = v_subject.
    gd_doc_data-sensitivty = 'O'.
    APPEND GD_DOC_DATA.
    Appending The Internal Table it_packing_list
      it_packing_list-head_start = 1.
      it_packing_list-head_num = 0.
      it_packing_list-body_start = 1.
      it_packing_list-doc_type = 'RAW'.
      it_packing_list-body_num = tab_lines.
      APPEND it_packing_list.
      move i_bin_data to t_v_bin_data.
    ********Add By Anuj
      APPEND t_v_bin_data.
    ********End Add By Anuj
      LOOP AT t_v_bin_data.
        MOVE t_v_bin_data TO objbin-line.
        APPEND objbin.
      ENDLOOP.
      CLEAR it_packing_list.
      DESCRIBE TABLE objbin LINES tab_lines.
      it_packing_list-transf_bin = 'X'.
      it_packing_list-head_start = 1.
      it_packing_list-head_num = 1.
      it_packing_list-body_start = 1.
      it_packing_list-doc_type = 'PDF'.
      it_packing_list-body_num = tab_lines.
      it_packing_list-doc_size = tab_lines * 255.
      APPEND it_packing_list.
      wa_receiver-receiver = '[email protected]'.
      wa_receiver-rec_type = 'U'.
      wa_receiver-com_type = 'INT'.
      APPEND wa_receiver.
      move wa_receiver[] to it_receiver[].
      append it_receiver.
    *Appending The Internal Table it_receivers
    wa_receiver-receiver = '[email protected]'.
    wa_receiver-rec_type = 'U'.
    wa_receiver-com_type = 'INT'.
    APPEND wa_receiver.
    move wa_receiver[] to it_receiver[].
    append it_receiver.
    wa_receiver-receiver = '[email protected]'.
    wa_receiver-rec_type = 'U'.
    wa_receiver-com_type = 'INT'.
    APPEND wa_receiver.
    move wa_receiver[] to it_receiver[].
    append it_receiver.
    wa_receiver-receiver = '[email protected]'.
    wa_receiver-rec_type = 'U'.
    wa_receiver-com_type = 'INT'.
    APPEND wa_receiver.
    move wa_receiver[] to it_receiver[].
    append it_receiver.
    wa_receiver-receiver = '[email protected]'.
    wa_receiver-rec_type = 'U'.
    wa_receiver-com_type = 'INT'.
    APPEND wa_receiver.
    wa_receiver-receiver = '[email protected]'.
    wa_receiver-rec_type = 'U'.
    wa_receiver-com_type = 'INT'.
    APPEND wa_receiver.
    move wa_receiver to it_receiver.
    append it_receiver.
      Move wa_receiver[] to it_receivers[].
    Clear it_receivers.
      if i_OUT_PLACE_LEVEL NE 0.
    loop at it_receivers into wa_receiver.
       loop at it_receivers into wa_receiver.
    *Function Module To Post The Message To Externa Mail
        CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
          EXPORTING
            document_data              = gd_doc_data
            put_in_outbox              = 'X'
            commit_work                = 'X'
          TABLES
            packing_list               = it_packing_list
            contents_hex               = objbin
            receivers                  = it_receivers
          EXCEPTIONS
            too_many_receivers         = 1
            document_not_sent          = 2
            document_type_not_exist    = 3
            operation_no_authorization = 4
            parameter_error            = 5
            x_error                    = 6
            enqueue_error              = 7
            OTHERS                     = 8.
        clear wa_receiver.
       endloop.
      elseif i_OUT_PLACE_LEVEL eq 0.
        CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
          EXPORTING
            document_data              = gd_doc_data
            put_in_outbox              = 'X'
            commit_work                = 'X'
          TABLES
            packing_list               = it_packing_list
            contents_hex               = objbin
            receivers                  = it_receiver
          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.
        clear wa_receiver.
      endif.
    ENDFUNCTION.
    Regards
    Ravindra

    Hi,
    I am trying to send online intercative forms as PDF attachment once user fills it and click on send button. But this mail i am trying to send from SAP workflow. For this am using one function module which is accepting the pdfsource context attribute of binary type as Xstring. Once i run the webdynpro application i am getting mail in out look but when i open the attachment i am getting error file is damaged.
    Can you pls help me in solving this, Or any other way for doing the same.
    Here is the code i am using for triggering the RFC from WD
    Zsend_Mail_Attachment_Sev_Input mail = new Zsend_Mail_Attachment_Sev_Input();     
              //to capture the outplacement level entered in the form
              mail.setI_Out_Place_Level(wdContext.currentVn_severancedetailsElement().getVa_outplacement_level().getBytes());
         mail.setI_Bin_Data(wdContext.currentContextElement().getPdfSource());
         wdContext.nodeZsend_Mail_Attachment_Sev_Input().bind(mail);
         try
              wdContext.currentZsend_Mail_Attachment_Sev_InputElement().modelObject().execute();
              wdComponentAPI.getMessageManager().reportSuccess("Notification Sent Successfully.");
         catch (WDDynamicRFCExecuteException e)
              // TODO Auto-generated catch block
              wdComponentAPI.getMessageManager().reportSuccess(" This is inside the mail exception!!"+e);
              e.printStackTrace();
    Here is the function module code
    FUNCTION ZSEND_MAIL_ATTACHMENT_SEV.
    ""Local Interface:
    *"  IMPORTING
    *"     VALUE(I_OUT_PLACE_LEVEL) TYPE  XSTRING OPTIONAL
    *"     VALUE(I_BIN_DATA) TYPE  XSTRING OPTIONAL
    *"  TABLES
    *"      T_V_BIN_DATA STRUCTURE  SOLISTI1
    *"      IT_MESSAGE STRUCTURE  SOLISTI1
    Data Declaration
      DATA: gd_cnt TYPE i,
            gd_sent_all(1) TYPE c,
            gd_error TYPE sy-subrc,
            tab_lines LIKE sy-tabix,
            v_subject(255) VALUE 'HI'.
    Structure Declaration
      DATA : BEGIN OF it_file OCCURS 0,
              row(255),
             END OF it_file.
      DATA : BEGIN OF i_split OCCURS 0,
      row(50),
      END OF i_split.
    DESCRIBE TABLE it_message LINES tab_lines.
    READ TABLE it_message INDEX tab_lines.
    Internal Table Declaration
      data : it_receivers like table of SOMLRECI1 with header line."occurs 0.
      DATA : objbin LIKE SOLIX OCCURS 0 WITH HEADER LINE.
      DATA : it_packing_list LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE.
      data : wa_receiver like table of SOMLRECI1 with header line.
      data : it_receiver like table of SOMLRECI1 with header line.
      DATA :   gd_doc_data LIKE sodocchgi1 OCCURS 0 WITH HEADER LINE.
      REFRESH : objbin, it_packing_list, it_receivers, wa_receiver.
      CLEAR   : objbin, it_packing_list, wa_receiver, it_receivers.
    gd_doc_data-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( it_message ).
    gd_doc_data-obj_langu = sy-langu.
    gd_doc_data-obj_name = 'SENDFILE'.
    gd_doc_data-obj_descr = v_subject.
    gd_doc_data-sensitivty = 'O'.
    APPEND GD_DOC_DATA.
    Appending The Internal Table it_packing_list
      it_packing_list-head_start = 1.
      it_packing_list-head_num = 0.
      it_packing_list-body_start = 1.
      it_packing_list-doc_type = 'RAW'.
      it_packing_list-body_num = tab_lines.
      APPEND it_packing_list.
      move i_bin_data to t_v_bin_data.
    ********Add By Anuj
      APPEND t_v_bin_data.
    ********End Add By Anuj
      LOOP AT t_v_bin_data.
        MOVE t_v_bin_data TO objbin-line.
        APPEND objbin.
      ENDLOOP.
      CLEAR it_packing_list.
      DESCRIBE TABLE objbin LINES tab_lines.
      it_packing_list-transf_bin = 'X'.
      it_packing_list-head_start = 1.
      it_packing_list-head_num = 1.
      it_packing_list-body_start = 1.
      it_packing_list-doc_type = 'PDF'.
      it_packing_list-body_num = tab_lines.
      it_packing_list-doc_size = tab_lines * 255.
      APPEND it_packing_list.
      wa_receiver-receiver = '[email protected]'.
      wa_receiver-rec_type = 'U'.
      wa_receiver-com_type = 'INT'.
      APPEND wa_receiver.
      move wa_receiver[] to it_receiver[].
      append it_receiver.
    *Appending The Internal Table it_receivers
    wa_receiver-receiver = '[email protected]'.
    wa_receiver-rec_type = 'U'.
    wa_receiver-com_type = 'INT'.
    APPEND wa_receiver.
    move wa_receiver[] to it_receiver[].
    append it_receiver.
    wa_receiver-receiver = '[email protected]'.
    wa_receiver-rec_type = 'U'.
    wa_receiver-com_type = 'INT'.
    APPEND wa_receiver.
    move wa_receiver[] to it_receiver[].
    append it_receiver.
    wa_receiver-receiver = '[email protected]'.
    wa_receiver-rec_type = 'U'.
    wa_receiver-com_type = 'INT'.
    APPEND wa_receiver.
    move wa_receiver[] to it_receiver[].
    append it_receiver.
    wa_receiver-receiver = '[email protected]'.
    wa_receiver-rec_type = 'U'.
    wa_receiver-com_type = 'INT'.
    APPEND wa_receiver.
    wa_receiver-receiver = '[email protected]'.
    wa_receiver-rec_type = 'U'.
    wa_receiver-com_type = 'INT'.
    APPEND wa_receiver.
    move wa_receiver to it_receiver.
    append it_receiver.
      Move wa_receiver[] to it_receivers[].
    Clear it_receivers.
      if i_OUT_PLACE_LEVEL NE 0.
    loop at it_receivers into wa_receiver.
       loop at it_receivers into wa_receiver.
    *Function Module To Post The Message To Externa Mail
        CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
          EXPORTING
            document_data              = gd_doc_data
            put_in_outbox              = 'X'
            commit_work                = 'X'
          TABLES
            packing_list               = it_packing_list
            contents_hex               = objbin
            receivers                  = it_receivers
          EXCEPTIONS
            too_many_receivers         = 1
            document_not_sent          = 2
            document_type_not_exist    = 3
            operation_no_authorization = 4
            parameter_error            = 5
            x_error                    = 6
            enqueue_error              = 7
            OTHERS                     = 8.
        clear wa_receiver.
       endloop.
      elseif i_OUT_PLACE_LEVEL eq 0.
        CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
          EXPORTING
            document_data              = gd_doc_data
            put_in_outbox              = 'X'
            commit_work                = 'X'
          TABLES
            packing_list               = it_packing_list
            contents_hex               = objbin
            receivers                  = it_receiver
          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.
        clear wa_receiver.
      endif.
    ENDFUNCTION.
    Regards
    Ravindra

  • Custome FM to create Email with PDF attachment

    Hi Experts,
    I am working in Smart form.  my requriment is to create a Custom Function module , for sending  email  with PDF attachment  to the customer. PDF is nothing but which ever I create smart form.
    How can I approach , please give me a suggestion or send me a sample code, if any one create.
    1. This FM should work like : convert form to PDF and send Email to particular customer.

    Hi,
    Steps to convert Smartform to PDF,
    1 Call smartform through FM SSF_FUNCTION_MODULE_NAME.
       CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
    2  Converting Smartform to OTF and in turn to PDF
       Set Following parameter in order to convert Smartform into OTF.
      gs_cparam-no_dialog = 'X'.   " Suppressing the dialog box
      gs_cparam-preview = 'X'.     " for print preview
      gs_cparam-getotf = 'X'.     " To get Output in OTF
        CALL FUNCTION g_fmodule
          EXPORTING
            control_parameters = gs_cparam
            output_options     = gs_outoptions
          IMPORTING
            job_output_info    = gt_otf_from_fm
          TABLES
            gt_final           = gt_final
         gt_otf[] = gt_otf_from_fm-otfdata [].
        CALL FUNCTION 'CONVERT_OTF'
          EXPORTING
            format                = 'PDF'
            max_linewidth         = 132
          IMPORTING
            bin_filesize          = g_bin_filesize
          TABLES
            otf                   = gt_otf
            lines                 = gt_pdf_tab
        CHECK sy-subrc = 0.
        g_bin_filesize = g_bin_filesize + 1.
    Transfer the 132-long strings to 255-long strings
        LOOP AT gt_pdf_tab into gs_pdf_tab.
          TRANSLATE gs_pdf_tab USING ' ~'.
          CONCATENATE g_buffer gs_pdf_tab INTO g_buffer.
        ENDLOOP.
        TRANSLATE g_buffer USING '~ '.
        DO.
          gs_mess_att = g_buffer.
          APPEND gs_mess_att to gt_mess_att.
          SHIFT g_buffer LEFT BY 255 PLACES.
          IF g_buffer IS INITIAL.
            EXIT.
          ENDIF.
        ENDDO.
    3 For Sending Mail use following mail,
    CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
        EXPORTING
          document_data              = ls_doc_data
          put_in_outbox              = 'X'
          sender_address             = l_sender_address
          sender_address_type        = l_sender_address_type
          commit_work                = 'X'
        TABLES
          packing_list               = lt_packing_list
          contents_bin               = lt_attachment
          contents_txt               = lt_message
          receivers                  = lt_receivers
    I hope this could help you,
    Please let me know if any issue.
    Thanks & regards,
    ShreeMohan
    Edited by: ShreeMohan Pugalia on Jul 18, 2009 8:02 AM
    Edited by: ShreeMohan Pugalia on Jul 18, 2009 8:03 AM
    Edited by: ShreeMohan Pugalia on Jul 18, 2009 8:05 AM

  • Send SmartForm as Email Body

    Hi All!
    I need to send a SmarForm by email as an email body.
    The SmartForm is a simple plain text form.
    Does someone know how to do it?
    Regards,
    Alejandro.

    hi,
    try this link u will have two codes.
    Email Body
    even if u dont understand check this code.
    Here is the code to send the Smartform to mail as PDF attachment.
    REPORT ZTEST_PDF_MAIL.
    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 = 'ZTEST'
    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.
    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
    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.
    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 = 'mail id'.
    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'
    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.
    If you want to send some text as Body of the Mail then follow this once
    when u r callin the FM'SO_NEW_DOCUMENT_ATT_SEND_API1'.. points to remember
    1.u have to pass the body of content in table CONTENTS_TXT(ia m using I_OBJBIN) (each line a record) then. suppose i have appended 11 records to the table CONTENTS_TXT .
    2.PACKING_LIST(iam usign I_OBJPACK) table u ahve to append a redord as follows
    I_OBJPACK-TRANSF_BIN = ' '.
    I_OBJPACK-HEAD_START = 000000000000001.
    I_OBJPACK-HEAD_NUM = 000000000000001.
    I_OBJPACK-BODY_START = 000000000000002
    I_OBJPACK-BODY_NUM = 000000000000010.
    I_OBJPACK-DOC_TYPE = 'RAW'.
    append I_OBJPACK-.
    by the above code system treat the first line in table I_OBJBIN as header and the 2nd line to 10 lines tread as body.
    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.
    reward me ig helpful.

  • How do I add text message to this email with PDF attachment?

    Good day, everyone!
    Okay, we have a "z"-version of program RFFOUS_T and some of its include codes.  One include code, RFFORIO6, has a form called MAIL_PDF_ADVICE.  It is in this form that we are emailing a remittance advice form.  The actual form is attached as a PDF file.
    Unfortunately, there's no text in the body of the email -- it's just the attachment -- so the users would like us to add a couple basic lines in the body of the email that explain the attachment.  I'm pretty new to using this particular FM and emailing the PDF attachment, and I've gotten stuck in my research trying to find out exactly how to do this.  I'm guessing this shouldn't be all that difficult, but I'm not finding the right solution.  Here's the form:
    *&      Form  mail_pdf_advice
          E-mail PDF advice
         -->IT_ADVICE     PDF form (output from Adobe server)
         -->I_PDF_LEN     length of PDF advice in bytes
    FORM mail_pdf_advice USING it_advice   TYPE solix_tab
                               i_pdf_len   TYPE i.
      DATA:
        lt_receivers       TYPE TABLE OF somlreci1 WITH HEADER LINE,
        l_user             LIKE soextreci1-receiver,
        ls_send_doc        LIKE sodocchgi1,
        lt_pdf_attach      TYPE TABLE OF sopcklsti1 WITH HEADER LINE.
      CHECK NOT finaa-intad IS INITIAL.
      CHECK finaa-nacha EQ 'I'.
    *--- determine E-Mail sender and recipient
      IF fsabe-usrnam EQ space.
        l_user = sy-uname.
      ELSE.
        l_user = fsabe-usrnam.         "Office-User des Sachbearb.
      ENDIF.
      lt_receivers-receiver = finaa-intad.
      lt_receivers-rec_type = 'U'.      "E-mail address
      APPEND lt_receivers.
      ls_send_doc-obj_descr =  itcpo-tdtitle.
      lt_pdf_attach-transf_bin = 'X'.
      lt_pdf_attach-doc_type   = 'PDF'.
      lt_pdf_attach-obj_langu  = reguh-zspra.
      lt_pdf_attach-body_start = 1.
      lt_pdf_attach-doc_size   = i_pdf_len.
      DESCRIBE TABLE it_advice LINES lt_pdf_attach-body_num.
      APPEND lt_pdf_attach.
      CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
        EXPORTING
          document_data              = ls_send_doc
          sender_address             = l_user
        TABLES
          packing_list               = lt_pdf_attach
          contents_hex               = it_advice
          receivers                  = lt_receivers
        EXCEPTIONS
          too_many_receivers         = 1
          document_not_sent          = 2
          document_type_not_exist    = 3
          operation_no_authorization = 4
          parameter_error            = 5
          x_error                    = 6
          enqueue_error              = 7
          OTHERS                     = 8.
    <error checking code snipped>
    Does someone know how to do this?  <b><REMOVED BY MODERATOR></b>  Thanks so much in advance!
    Dave
    Message was edited by:
            Alvaro Tejada Galindo

    Hi Dave,
    Table <b>contents_bin</b> is used to pass attachment file and <b>contents_txt</b> is used to pass mail body contents. You need to declare one more int table to give contents for mail body.
    For reference check the code below
    ut_message is for message body
    and ut_attach is having attachement file.
      FORM send_file_as_email_attachment TABLES ut_message
                                              ut_attach
                                        USING uv_email
                                              uv_mtitle
                                              uv_format
                                              uv_filename
                                              uv_attdescription
                                              uv_sender_address
                                              uv_sender_addres_type
                                     CHANGING uc_error
                                              uc_reciever.
      DATA:  l_error                TYPE  sy-subrc,
             l_reciever             TYPE  sy-subrc,
             l_mtitle               LIKE  sodocchgi1-obj_descr,
             l_email                LIKE  somlreci1-receiver,
             l_format               TYPE  so_obj_tp ,
             l_attdescription       TYPE  so_obj_nam ,
             l_attfilename          TYPE  so_obj_des ,
             l_sender_address       LIKE  soextreci1-receiver,
             l_sender_address_type  LIKE  soextreci1-adr_typ,
             l_receiver             LIKE  sy-subrc.
      DATA:   lt_packing_list    LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
              lt_contents        LIKE solisti1   OCCURS 0 WITH HEADER LINE,
              lt_receivers       LIKE somlreci1  OCCURS 0 WITH HEADER LINE,
              lt_attachment      LIKE solisti1   OCCURS 0 WITH HEADER LINE,
              lt_object_header   LIKE solisti1   OCCURS 0 WITH HEADER LINE,
              l_cnt TYPE i,
              l_sent_all(1) TYPE c,
              lw_doc_data LIKE sodocchgi1.
      l_email               = uv_email.
      l_mtitle              = uv_mtitle.
      l_format              = uv_format.
      l_attdescription      = uv_attdescription.
      l_attfilename         = uv_filename.
      l_sender_address      = uv_sender_address.
      l_sender_address_type = uv_sender_addres_type.
    Fill the document data.
      lw_doc_data-doc_size = 1.
    Populate the subject/generic message attributes
      lw_doc_data-obj_langu = sy-langu.
      lw_doc_data-obj_name  = 'SAPRPT'.
      lw_doc_data-obj_descr = l_mtitle.
      lw_doc_data-sensitivty = 'F'.
    Fill the document data and get size of attachment
      CLEAR lw_doc_data.
      READ TABLE ut_attach INDEX l_cnt.
      lw_doc_data-doc_size =
         ( l_cnt - 1 ) * 255 + STRLEN( ut_attach ).
      lw_doc_data-obj_langu  = sy-langu.
      lw_doc_data-obj_name   = 'SAPRPT'.
      lw_doc_data-obj_descr  = l_mtitle.
      lw_doc_data-sensitivty = 'F'.
      CLEAR lt_attachment.
      REFRESH lt_attachment.
      lt_attachment[] = ut_attach[].
    Describe the body of the message
      CLEAR lt_packing_list.
      REFRESH lt_packing_list.
      lt_packing_list-transf_bin = space.
      lt_packing_list-head_start = 1.
      lt_packing_list-head_num = 0.
      lt_packing_list-body_start = 1.
      DESCRIBE TABLE ut_message LINES lt_packing_list-body_num.
      lt_packing_list-doc_type = 'RAW'.
      APPEND lt_packing_list.
    Create attachment notification
      lt_packing_list-transf_bin = 'X'.
      lt_packing_list-head_start = 1.
      lt_packing_list-head_num   = 1.
      lt_packing_list-body_start = 1.
      DESCRIBE TABLE lt_attachment LINES lt_packing_list-body_num.
      lt_packing_list-doc_type   =  l_format.
      lt_packing_list-obj_descr  =  l_attdescription.
      lt_packing_list-obj_name   =  l_attfilename.
      lt_packing_list-doc_size   =  lt_packing_list-body_num * 255.
      APPEND lt_packing_list.
    Add the recipients email address
      CLEAR lt_receivers.
      REFRESH lt_receivers.
      lt_receivers-receiver = l_email.
      lt_receivers-rec_type = 'U'.
      lt_receivers-com_type = 'INT'.
      lt_receivers-notif_del = 'X'.
      lt_receivers-notif_ndel = 'X'.
      APPEND lt_receivers.
      CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
        EXPORTING
          document_data              = lw_doc_data
          put_in_outbox              = 'X'
          commit_work                = 'X'
        IMPORTING
          sent_to_all                = l_sent_all
        TABLES
          packing_list               = lt_packing_list
          contents_bin               = lt_attachment
          contents_txt               = ut_message
          receivers                  = lt_receivers
        EXCEPTIONS
          too_many_receivers         = 1
          document_not_sent          = 2
          document_type_not_exist    = 3
          operation_no_authorization = 4
          parameter_error            = 5
          x_error                    = 6
          enqueue_error              = 7
          OTHERS                     = 8.
    Message was edited by:
            Amit Kumar

  • Sending an e-mail with pdf attachment and logo as a signature

    Hi,
    My task is to send an email with pdf attachement. And an image file need to be added as a signature. Is it possible, if so, can anyone please guide me?
    Thanking you.
    Kumar.

    Hi
    I'm having the same issue, except my application actually sends the email but the attachment is 0 octet and it doesn't even give me an error... Any chance you found a solution for this and could share it ?
    Thanks

  • 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

Maybe you are looking for