Sending excel as email attachment

Hi All,
I am getting truncated with the header only upto 255 char length , and the field contents are ok more than 255 length it s taking.
I am using it_attach  type standard table of solisti1 with header line.
the report code is given below
**& Report  ZPBILL_INT1                                                 **
REPORT  zpbill_int1 .
*Declaration of type-pools.
TYPE-POOLS  slis.
     D A T A                                                         **
TABLES: zbill_inphdr,
        zbill_inpdtl.
TYPES: BEGIN OF t_zbill_ipdtl,
        cusnr   TYPE zbill_inpdtl-cusnr,
       svsnr  TYPE   zbill_inpdtl-svsnr,
       revnr  TYPE  zbill_inpdtl-revnr,
       sysnr   TYPE zbill_inpdtl-sysnr,
       sdate  TYPE zbill_inpdtl-sdate,
       filnm  TYPE zbill_inpdtl-filnm,
       zlsch  TYPE   zbill_inpdtl-zlsch,
       clrfe   TYPE zbill_inpdtl-clrfe,
       revds   TYPE  zbill_inpdtl-revds,
       prind  TYPE  zbill_inpdtl-prind,
       svsds  TYPE  zbill_inpdtl-svsds,
       quant  TYPE zbill_inpdtl-quant,
       adate  TYPE  zbill_inpdtl-adate,
       trdat  TYPE  zbill_inpdtl-trdat,
       mdate  TYPE  zbill_inpdtl-mdate,
      trdval  type  zbill_inpdtl-trdval,*
       exrate  TYPE  zbill_inpdtl-exrate,
       birate  TYPE  zbill_inpdtl-birate,
       cusds1  TYPE  zbill_inpdtl-cusds1,
       cusds2  TYPE  zbill_inpdtl-cusds2,
       cusstr  TYPE  zbill_inpdtl-cusstr,
       cuspc   TYPE  zbill_inpdtl-cuspc,
       cuscity  TYPE  zbill_inpdtl-cuscity,
       cusctry   TYPE  zbill_inpdtl-cusctry ,
       rect      TYPE zbill_inpdtl-rect,
        invno  TYPE zbill_inpdtl-invno,
       ldate  TYPE zbill_inpdtl-ldate,
       conty  TYPE zbill_inpdtl-conty,
       edate  TYPE  zbill_inpdtl-edate,
       custa  TYPE  zbill_inpdtl-custa,
       currc  TYPE  zbill_inpdtl-currc,
       warrt  TYPE  zbill_inpdtl-warrt,
       indrp  TYPE   zbill_inpdtl-indrp,
       textc   TYPE  zbill_inpdtl-textc,
      gstr   TYPE   zbill_inpdtl-gstr,
       clrds  TYPE  zbill_inpdtl-clrds,
       commty  TYPE  zbill_inpdtl-commty,
       commyr   TYPE  zbill_inpdtl-commyr,
       commmt  TYPE  zbill_inpdtl-commmt,
       commop   TYPE  zbill_inpdtl-commop,
       eposdoc  TYPE  zbill_inpdtl-eposdoc,
       custp   TYPE  zbill_inpdtl-custp,
END OF t_zbill_ipdtl.
DATA: it_zbill  TYPE   STANDARD TABLE OF t_zbill_ipdtl
INITIAL SIZE 0.
ALV Data declaration.*
DATA : v_repid LIKE sy-repid.
ALV Function Module Variables*
DATA: gs_layout TYPE slis_layout_alv,
g_exit_caused_by_caller,
gs_exit_caused_by_user TYPE slis_exit_by_user.
DATA: gt_fieldcat TYPE slis_t_fieldcat_alv,
gs_print TYPE slis_print_alv,
gt_events TYPE slis_t_event,
gt_list_top_of_page TYPE slis_t_listheader,
g_status_set TYPE slis_formname VALUE 'PF_STATUS_SET',
g_user_command TYPE slis_formname VALUE 'USER_COMMAND',
g_top_of_page TYPE slis_formname VALUE 'TOP_OF_PAGE',
g_top_of_list TYPE slis_formname VALUE 'TOP_OF_LIST',
g_end_of_list TYPE slis_formname VALUE 'END_OF_LIST',
g_variant LIKE disvariant,
g_save(1) TYPE c,
g_tabname_header TYPE slis_tabname,
g_tabname_item TYPE slis_tabname,
g_exit(1) TYPE c,
gx_variant LIKE disvariant.
DATA : gr_layout_bck TYPE slis_layout_alv.
DATA : wa_zbill  TYPE t_zbill_ipdtl.
*Email related declarations
DATA: it_message TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0
WITH HEADER LINE.
*DATA: it_attach TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0
*WITH HEADER LINE.
DATA: it_attach TYPE STANDARD TABLE OF SOMLRECI1 INITIAL SIZE 0
WITH HEADER LINE.
DATA: t_packing_list LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
t_contents LIKE solisti1 OCCURS 0 WITH HEADER LINE,
t_receivers LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
*t_attachment LIKE solisti1 OCCURS 0 WITH HEADER LINE,
t_attachment LIKE SOMLRECI1 OCCURS 0 WITH HEADER LINE,
t_object_header LIKE solisti1 OCCURS 0 WITH HEADER LINE,
w_cnt TYPE i,
w_sent_all(1) TYPE c,
w_doc_data LIKE sodocchgi1,
gd_error TYPE sy-subrc,
gd_reciever TYPE sy-subrc.
*DATA IT_HEADER    TYPE STANDARD TABLE OF SOLIX INITIAL SIZE 0 WITH
*HEADER LINE.
*data : begin of it_header occurs 0,
       header(1023) type C,*
     end of it_header.*
    S E L E C T I O N S                                              **
SELECTION-SCREEN BEGIN OF BLOCK b01 WITH FRAME TITLE text-b01.
SELECT-OPTIONS:   s_cusnr   FOR  zbill_inpdtl-cusnr,
                  s_svsnr   FOR  zbill_inpdtl-svsnr,
                  s_revnr  FOR zbill_inpdtl-revnr,
                  s_sysnr  FOR  zbill_inpdtl-sysnr,
                  s_sdate  FOR  zbill_inpdtl-sdate,
                  s_filnm    FOR  zbill_inpdtl-filnm,
                  s_prind   for  zbill_inpdtl-prind.
PARAMETERS:  p_test  AS CHECKBOX,
              p_email  AS CHECKBOX.
SELECTION-SCREEN END OF BLOCK b01.
*PARAMETERS: p_email TYPE somlreci1-receiver
    Initialization                                             **
INITIALIZATION.
  v_repid = sy-repid.
    start-of-selection                                           **
START-OF-SELECTION.
  PERFORM data_retrieval.
  IF p_test = '' AND  P_EMAIL = ''.
  MESSAGE S038(ZMBILLING).
  ELSEIF  P_TEST  = 'X'.
display the data in the form of ALV*
    PERFORM display_data.
ELSEIF P_EMAIL = 'X'.
*Populate table with detaisl to be entered into .xls file
    PERFORM build_xls_data_table.
*Populate message body text
    PERFORM populate_email_message_body.
*Send file by email as .xls speadsheet
    PERFORM send_file_as_email_attachment
    TABLES it_message it_attach USING p_email
    'Billing Details list'
    'XLS'
    'filename'
    CHANGING gd_error
    gd_reciever.
*Instructs mail send program for SAPCONNECT to send email(rsconn01)
    PERFORM initiate_mail_execute_program.
  ENDIF.
*&      Form  data_retrieval
      text*
FORM data_retrieval.
  SELECT revnr sysnr sdate filnm cusnr
         svsnr zlsch  clrfe revds  prind svsds
         quant adate trdat  mdate exrate
         birate  cusds1 cusds2 cusstr
         cuspc  cuscity  cusctry rect
         invno ldate conty  edate custa
         currc  warrt  indrp textc
         gstr clrds commty commyr commmt
         commop  eposdoc custp
    INTO  CORRESPONDING FIELDS  OF TABLE it_zbill  FROM zbill_inpdtl
    WHERE   cusnr  IN s_cusnr
     AND     svsnr  IN s_svsnr
     AND     revnr  IN s_revnr
     AND    sysnr  IN s_sysnr
     AND    sdate  IN s_sdate
     AND    filnm  IN s_filnm
     and prind  in s_prind.
ENDFORM. " DATA_RETRIEVAL
**&      Form  build_xls_data_table
      text*
FORM build_xls_data_table.
  DATA: ld_store(50) TYPE c. "Leading zeros
  DATA: wa_zbill-quant(20),
        wa_zbill-custa(20),
        wa_zbill-gstr(20).
        wa_zbill-mxamt(20).*
*If you have Unicode check active in program attributes thnen you will
*need to declare constants as follows
  CLASS cl_abap_char_utilities DEFINITION LOAD.
  CONSTANTS:
  con_tab TYPE c VALUE cl_abap_char_utilities=>horizontal_tab,
  con_cret TYPE c VALUE cl_abap_char_utilities=>cr_lf.
CONCATENATE 'Customer code' 'Service Number' 'Revenue Type' 'Source
System Code' 'Date Source' 'File Name' 'Payment Code' 'Single Char Flag'
'Revenue Description' 'Processing Indicator' 'Service Description'
'Order Quantity' 'Date of Adustment' 'Trade Date' 'Mos Date'
'ExchangeRate' 'Billing Rate' 'Customer Name1' 'Customer name2'
  'Customer adress' 'Customer postalcode' 'Customer city'
  'Customer country' 'Billing amt without GST' 'GST Payable'
  'Receipt number' 'Invoice Number' 'Listing Period'
  'Contract  Type' 'Entry date' 'Custody Code' 'Currency Code'
  'Name of Warrant' 'Rights issue' 'No Of copies'
  'GST Rate' 'Clearing Fee' 'Commodity type'
  'Commodity year' 'Commodity month' 'Commodity Option Tpye'
  'Quantity Transacted' 'Amendment Quantity' 'EPOS DOC type'
  'Customer Type'
INTO IT_ATTACH SEPARATED BY con_tab.
  CONCATENATE con_cret IT_ATTACH INTO IT_ATTACH.
*CONCATENATE con_cret it_attach INTO it_attach.
APPEND it_attach.
  LOOP AT  it_zbill INTO wa_zbill.
    CONCATENATE      wa_zbill-cusnr  wa_zbill-svsnr  wa_zbill-revnr
    wa_zbill-sysnr   wa_zbill-sdate  wa_zbill-filnm  wa_zbill-zlsch
    wa_zbill-clrfe   wa_zbill-revds   wa_zbill-prind   wa_zbill-svsds
    wa_zbill-quant   wa_zbill-adate   wa_zbill-trdat   wa_zbill-mdate
    wa_zbill-exrate  wa_zbill-birate   wa_zbill-cusds1  wa_zbill-cusds2
  wa_zbill-cusstr   wa_zbill-cuspc   wa_zbill-cuscity   wa_zbill-cusctry
    wa_zbill-rect    wa_zbill-invno   wa_zbill-ldate  wa_zbill-conty
    wa_zbill-edate   wa_zbill-custa   wa_zbill-currc   wa_zbill-warrt
    wa_zbill-indrp   wa_zbill-textc   wa_zbill-gstr   wa_zbill-clrds
    wa_zbill-commty  wa_zbill-commyr  wa_zbill-commmt   wa_zbill-commop
    wa_zbill-eposdoc  wa_zbill-custp
     INTO it_attach SEPARATED BY con_tab.
    CONCATENATE con_cret it_attach INTO it_attach.
  it_header = it_attach  .*
*append it_header.
    APPEND it_attach.
  ENDLOOP.
  ENDFORM. " BUILD_XLS_DATA_TABLE
***& Form SEND_FILE_AS_EMAIL_ATTACHMENT
FORM send_file_as_email_attachment TABLES pit_message
pit_attach
USING p_email
p_mtitle
p_format
p_filename
p_attdescription
p_sender_address
p_sender_addres_type
CHANGING p_error
p_reciever.
  DATA: ld_error TYPE sy-subrc,
  ld_reciever TYPE sy-subrc,
  ld_mtitle LIKE sodocchgi1-obj_descr,
  ld_email LIKE somlreci1-receiver,
  ld_format TYPE so_obj_tp ,
  ld_attdescription TYPE so_obj_nam ,
  ld_attfilename TYPE so_obj_des ,
  ld_sender_address LIKE soextreci1-receiver,
  ld_sender_address_type LIKE soextreci1-adr_typ,
  ld_receiver LIKE sy-subrc.
  ld_email = p_email.
  ld_mtitle = p_mtitle.
  ld_format = p_format.
  ld_attdescription = p_attdescription.
  ld_attfilename = p_filename.
  ld_sender_address = p_sender_address.
  ld_sender_address_type = p_sender_addres_type.
*ld_sender_address = SY-UNAME.
ld_sender_address_type = 'SMTP'.*
*fill the document data.
  w_doc_data-doc_size = 1.
*populate the subject/generic message attributes
  w_doc_data-obj_langu = sy-langu.
  w_doc_data-obj_name = 'SAPRPT'.
  w_doc_data-obj_descr = ld_mtitle .
  w_doc_data-sensitivty = 'F'.
*Fill the document data and get size of attachment
  CLEAR w_doc_data.
  READ TABLE it_attach INDEX w_cnt.
  w_doc_data-doc_size =
  *( w_cnt - 1 ) * 255 + STRLEN( it_attach ).*
  w_doc_data-obj_langu = sy-langu.
  w_doc_data-obj_name = 'SAPRPT'.
  w_doc_data-obj_descr = ld_mtitle.
  w_doc_data-OBJ_NAME  = ld_attfilename.
  w_doc_data-sensitivty = 'F'.
  CLEAR t_attachment.
  REFRESH t_attachment.
  t_attachment = it_attach.
  t_attachment[] = it_attach[] .
t_attachment = it_header.*
t_attachment[] = it_header[] .*
*Describe the body of the message
  CLEAR t_packing_list.
  REFRESH t_packing_list.
  t_packing_list-transf_bin = space.
  t_packing_list-head_start = 1.
  t_packing_list-head_num = 0.
  t_packing_list-body_start = 1.
  DESCRIBE TABLE it_message LINES t_packing_list-body_num.
  t_packing_list-doc_type = 'RAW'.
  APPEND t_packing_list.
*CREATE attachment notification
  t_packing_list-transf_bin = 'X'.
  t_packing_list-head_start = 1.
  t_packing_list-head_num = 1.
  t_packing_list-body_start = 1.
  DESCRIBE TABLE t_attachment LINES t_packing_list-body_num.
  t_packing_list-doc_type = ld_format.
  t_packing_list-obj_descr = ld_attdescription.
  t_packing_list-obj_name = ld_attfilename.
  *t_packing_list-doc_size = t_packing_list-body_num * 255.*
  APPEND t_packing_list.
*Add the recipients email address
  CLEAR t_receivers.
  REFRESH t_receivers.
t_receivers-receiver = ld_email.*
  t_receivers-rec_type = 'U'.
  t_receivers-com_type = 'INT'.
  t_receivers-notif_del = 'X'.
  t_receivers-notif_ndel = 'X'.
  APPEND t_receivers.
  CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
    EXPORTING
      document_data              = w_doc_data
      put_in_outbox              = 'X'
      sender_address             = ld_sender_address
      sender_address_type        = ld_sender_address_type
      commit_work                = 'X'
    IMPORTING
      sent_to_all                = w_sent_all
    TABLES
      packing_list               = t_packing_list
      contents_bin               = t_attachment
      contents_txt               = it_message
      receivers                  = t_receivers
    EXCEPTIONS
      too_many_receivers         = 1
      document_not_sent          = 2
      document_type_not_exist    = 3
      operation_no_authorization = 4
      parameter_error            = 5
      x_error                    = 6
      enqueue_error              = 7
      OTHERS                     = 8.
*Populate zerror return code
  ld_error = sy-subrc.
*Populate zreceiver return code
  LOOP AT t_receivers.
    ld_receiver = t_receivers-retrn_code.
  ENDLOOP.
ENDFORM.                    "build_xls_data_table
regards
subba

Hi ,
i'm saying check the field doc_size, umcomment it .change 255--->1025 .
w_doc_data-doc_size =
**( w_cnt - 1 ) * 255 + STRLEN( it_attach ).**
**t_packing_list-doc_size = t_packing_list-body_num * 255.**
for more details , check the documentation.
regards
Prabhu

Similar Messages

  • Error when sending excel as email attachment

    Hi All,
    I am sending excel document as email attachment through F.M. SO_DOCUMENT_SEND_API1. I am getting the attachment but when i open it, it is giving error "The file is not in recognizable format....."
    Please let me know how can i solve this problem.
    Regards,
    Saba

    Hi Saba,
    Check this link I think will surely help.
    [http://www.sap-img.com/abap/sending-email-with-attachment.htm]
    Regards,
    Amit.

  • Preview 6.0, no send file as email attachment?

    Does anyone know where they put the send file command?  I need to email pdfs from Preview all the time.
    There used to be a "send file as email attachment" command under the edit menu.  It's gone.  Anyone have any suggestions?

    Handsomfreddy wrote:
    Sorry, I dont understand what you are referring to. Can you calify please "undo the changes."
    Thanks,
    Andy
    Didn't you just post this (below)
    Handsomfreddy wrote:
    Very bizarrely Parallels had changed this Mail Preference to some weird Windows program [Disk Clean up or something equally random] thus preventing me from emailing anything from any program.
    That's the change I am referring to.

  • How to convert sap script to pdf and send it as email attachment

    hi,
    my requirement is to convert a standard sales order form to pdf and send it as email attachment. get me some sample code for the same
    thanks in advance

    Hi
    See this sample code and after that use the fun module to send the mail
    SO_NEW_DOCUMENT_ATT_SEND_API1
    REPORT zzz_jaytest .
    Types Declaration
    TYPES : BEGIN OF ty_pa0001,
    pernr TYPE pa0001-pernr,
    bukrs TYPE pa0001-bukrs,
    werks TYPE pa0001-werks,
    END OF ty_pa0001.
    Internal Table Declaration
    DATA : i_pa0001 TYPE STANDARD TABLE OF ty_pa0001, "For pa0001 Details
    i_otf TYPE STANDARD TABLE OF itcoo, "For OTF data
    i_content_txt TYPE soli_tab, "Content
    i_content_bin TYPE solix_tab, "Content
    i_objhead TYPE soli_tab,
    Work Area Declaration
    w_pa0001 TYPE ty_pa0001, "For pa0001 Details
    w_res TYPE itcpp, "SAPscript output
    "parameters
    w_otf TYPE itcoo, "For OTF
    w_pdf TYPE solisti1, "For PDF
    w_transfer_bin TYPE sx_boolean, "Content
    w_options TYPE itcpo, "SAPscript output
    "interface
    Variable Declaration
    v_len_in TYPE so_obj_len,
    v_size TYPE i.
    Constants Declaration
    CONSTANTS : c_x TYPE c VALUE 'X', "X
    c_locl(4) TYPE c VALUE 'LOCL', "Local Printer
    c_otf TYPE sx_format VALUE 'OTF', "OTF
    c_pdf TYPE sx_format VALUE 'PDF', "PDF
    c_printer TYPE sx_devtype VALUE 'PRINTER', "PRINTER
    c_bin TYPE char10 VALUE 'BIN', "BIN
    c_name TYPE string VALUE 'C:\ZZZ_JAYTEST.PDF',"Downloading
    "File Name
    c_form(11) TYPE c VALUE 'ZZZ_JAYTEST'. "Form Name
    START-OF-SELECTION.
    Selecting the records from pa0001
    SELECT pernr bukrs werks FROM pa0001
    INTO TABLE i_pa0001 UP TO 10 ROWS.
    Setting the options
    w_options-tdcopies = 1 ."Number of copies
    w_options-tdnoprev = c_x."No print preview
    w_options-tdgetotf = c_x."Return of OTF table
    w_options-tddest = c_locl."Spool: Output device
    Opening the form
    CALL FUNCTION 'OPEN_FORM'
    EXPORTING
    form = c_form
    device = c_printer
    language = sy-langu
    OPTIONS = w_options
    IMPORTING
    RESULT = w_res.
    LOOP AT i_pa0001 INTO w_pa0001.
    Writting into the form
    CALL FUNCTION 'WRITE_FORM'
    EXPORTING
    element = 'MAIN'
    window = 'MAIN'.
    ENDLOOP.
    Closing the form
    CALL FUNCTION 'CLOSE_FORM'
    IMPORTING
    RESULT = w_res
    TABLES
    otfdata = i_otf
    EXCEPTIONS
    unopened = 1
    bad_pageformat_for_print = 2
    send_error = 3
    spool_error = 4
    codepage = 5
    OTHERS = 6.
    IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    Converting OTF data to single line
    LOOP AT i_otf INTO w_otf.
    CONCATENATE w_otf-tdprintcom w_otf-tdprintpar
    INTO w_pdf.
    APPEND w_pdf TO i_content_txt.
    ENDLOOP.
    Converting to PDF Format
    CALL FUNCTION 'SX_OBJECT_CONVERT_OTF_PDF'
    EXPORTING
    format_src = c_otf
    format_dst = c_pdf
    devtype = c_printer
    CHANGING
    transfer_bin = w_transfer_bin
    content_txt = i_content_txt
    content_bin = i_content_bin
    objhead = i_objhead
    len = v_len_in
    EXCEPTIONS
    err_conv_failed = 1
    OTHERS = 2.
    v_size = v_len_in.
    Downloading the PDF File
    CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
    bin_filesize = v_size
    filename = c_name
    filetype = c_bin
    TABLES
    data_tab = i_content_bin.
    If you r using this function module check it once....
    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.
    or u can use the standard program RSTXPDFT4 to download the script into PDF format onto a particular location
    follow this link for sample program.
    http://searchsap.techtarget.com/tip/0,289483,sid21_gci1121833,00.html
    check...
    How to send smart form via email
    /people/pavan.bayyapu/blog/2005/08/30/sending-html-email-from-sap-crmerp
    Regards
    Anji

  • Send page by email attaching to Lotus as a link instead of a pdf attachment

    Acrobat reader in internet explorer - Send page by email attaching to Lotus as a link instead of a pdf attachment any ideas? was working fine yesterday. Ive reset the Internet explorer settings , cleared cashe, was gonna try to reinstall next

    I don't think that Adobe Reader is involved in any of this; it looks like a purely IE functionality.

  • Send file as email attachment not working

    any help would be greatly appreciated...
    When I click "send file as email attachment" it will open outlook with the PDF attached but when I click send on the email,  the email closes like it is sent but never actually gets sent (nothing in sent items and recipient never gets the email)
    Adobe Acrobat 11 Pro (Creative Cloud Suite installed)
    Outlook 2013

    Hi sandyw26405588,
    Could you please try sending PDF as email attachment via another email apart from Outlook.
    Are you able to send the file successfully?
    Also, go under 'Help> Check for Updates' and ensure if you are using the latest version of Acrobat XI i.e. 11.0.10
    Have you tried sending any other PDF via Outlook?
    Let me know.
    Regards,
    Anubha

  • Convert SAP spoolOR list to excel and send as an email attachment

    Hello All Masterminds ,
      Iu2019ve developed a utility, in which users has to maintain one u201CZu201D view where they can give any report name, type of attachment (PDF, XLS, TXT) and sender email addresses.u201DNote: thing to remember here is Iu2019m creating XLS,TXT,PDF format dynamicallyu201D 
    It is working fine for PDF. Iu2019m submitting the program and creating spool and converting it to PDF and sending to their emails as an attachment.  It looks fantastic. When Iu2019m doing the same thing for XLS it is showing messy output, I tried many functions and search lots of unanswered, unfinished SDN posts. I almost tried every single clue given in these posts but no luck. Email part is working fine using classes (  l_document = cl_document_bcs=>create_document , l_document->add_attachment , l_send_request->set_document( l_document ).,cl_sapuser_bcs=>create( l_uname ).,l_send_request->add_recipient,  l_send_request->set_send_immediately( '' ).  ) .
    My real deal is to create a beautiful XLS out put. I also tried FMs LIST_FROM_MEMORY and LIST_TO_ASCI but no-luck. I thought instead of spool if I use u201CSubmit  EXPORTING LIST TO MEMORY u201C option may be It works but BIG NO 
       Iu2019m sure some genius out there has done something like his , I ain`t genius that is why I am stuck   Please guys throw me some bones .  As I said, I am able to do most of the things. I need some magic code /answer which turns my messy, ugly unformatted excel sheet attachment to beautiful u201Cpiece of art u201CExcel output.
      Here are the FMs I tried so far with different combinations.
    CALL FUNCTION 'LIST_FROM_MEMORY'
    CALL FUNCTION 'LIST_TO_ASCI'
    CALL FUNCTION 'GUI_DOWNLOAD'
    CALL FUNCTION 'RSPO_DOWNLOAD_SPOOLJOB'
    CALL FUNCTION 'RSPO_RETURN_SPOOLJOB'
    CALL FUNCTION 'CONVERT_OTF'
    CALL FUNCTION 'SAP_CONVERT_TO_XLS_FORMAT'
    And logic like to get rid of things getting in Asci tables
    cl_abap_char_utilities=>newline.
    cl_abap_char_utilities=>horizontal_tab
    cl_abap_char_utilities=>VERTICAL_TAB
    cl_abap_char_utilities=>cr_lf
    FIELD-SYMBOLS: <lfs_table>,    " Internal table structure
                     <lfs_con>.      " Field Content
      DATA: l_text TYPE char1024.     " Text content for mail attachment
      DATA: l_con(50) TYPE c.        " Field Content in character format
    Columns to be tab delimeted
      LOOP AT FINAL ASSIGNING <lfs_table>.
        DO.
          ASSIGN COMPONENT sy-index OF STRUCTURE <lfs_table>
                 TO <lfs_con>.
          IF sy-subrc NE 0.
            CONCATENATE c_cr l_text INTO l_text.
            APPEND l_text TO i_attach.
            EXIT.
          ELSE.
            CLEAR: l_con.
            MOVE <lfs_con> TO l_con.
            CONDENSE l_con.
            IF sy-index = 1.
              CLEAR: l_text.
              MOVE l_con TO l_text.
            ELSE.
              CONCATENATE l_text l_con INTO l_text
                 SEPARATED BY c_tab.
            ENDIF.
          ENDIF.
        ENDDO.
      ENDLOOP.
    Posts : https://forums.sdn.sap.com/click.jspa?searchID=14756211&messageID=4401940
    https://forums.sdn.sap.com/click.jspa?searchID=14756211&messageID=4796657
    https://forums.sdn.sap.com/search.jspa?threadID=&q=convertspoolintoexcelformatforsendingmail&objID=c42&dateRange=all&numResults=30&rankBy=10001
    Will appreciate your help and time.
    Thanks,
    Saquib Khan

    Hi,
    i send excel-att like this.
    REPORT Z_EMAIL_CL_BCS MESSAGE-ID ZZ.
    More examples here BCS_EXAMPLE_* with se38
    DATA: SEND_REQUEST       TYPE REF TO CL_BCS.
    DATA: SUBJECT            TYPE SO_OBJ_DES.
    DATA: ATT_TYPE           TYPE SOODK-OBJTP.
    DATA: IT_TEXT            TYPE BCSY_TEXT.
    DATA: WA_TEXT            LIKE SOLI.
    DATA: IT_BIN             TYPE SOLIX_TAB.
    DATA: WA_BIN             TYPE SOLIX.
    DATA: DOCUMENT           TYPE REF TO CL_DOCUMENT_BCS.
    DATA: SENDER             TYPE REF TO CL_SAPUSER_BCS.
    DATA: RECIPIENT          TYPE REF TO IF_RECIPIENT_BCS.
    DATA: BCS_EXCEPTION      TYPE REF TO CX_BCS.
    DATA: SENT_TO_ALL        TYPE OS_BOOLEAN.
    Bytes der Datei
    DATA: IT_LENGHT          TYPE SO_OBJ_LEN.
    DATA: N10(10)            TYPE N.
    CONSTANTS: CON_NEWL TYPE ABAP_CHAR1 VALUE CL_ABAP_CHAR_UTILITIES=>NEWLINE,
               CON_TAB  TYPE ABAP_CHAR1 VALUE CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB.
    CONSTANTS: CON_NEWL TYPE X VALUE '0D', "OK for non Unicode
                CON_TAB  TYPE X VALUE '09'. "OK for non Unicode
    START-OF-SELECTION.
      PERFORM MAIN.
    END-OF-SELECTION.
    FORM MAIN.
      TRY.
        -------- create persistent send request ------------------------
          SEND_REQUEST = CL_BCS=>CREATE_PERSISTENT( ).
          PERFORM HEAD_CONT.
          PERFORM XLS_ATT.
        add document to send request
          CALL METHOD SEND_REQUEST->SET_DOCUMENT( DOCUMENT ).
        --------- set sender -------------------------------------------
          SENDER = CL_SAPUSER_BCS=>CREATE( SY-UNAME ).
          CALL METHOD SEND_REQUEST->SET_SENDER
            EXPORTING
              I_SENDER = SENDER.
        --------- set recipent -----------------------------------------
          RECIPIENT = CL_CAM_ADDRESS_BCS=>CREATE_INTERNET_ADDRESS(
                                            'the email adress' ).
        add recipient with its respective attributes to send request
          CALL METHOD SEND_REQUEST->ADD_RECIPIENT
            EXPORTING
              I_RECIPIENT = RECIPIENT
              I_EXPRESS   = 'X'.
         RECIPIENT = CL_CAM_ADDRESS_BCS=>CREATE_INTERNET_ADDRESS(
                                           'the email adress 2' ).
        add recipient with its respective attributes to send request
         CALL METHOD SEND_REQUEST->ADD_RECIPIENT
           EXPORTING
             I_RECIPIENT = RECIPIENT
             I_EXPRESS   = 'X'.
        ---------- send document ---------------------------------------
          CALL METHOD SEND_REQUEST->SEND(
            EXPORTING
              I_WITH_ERROR_SCREEN = 'X'
            RECEIVING
              RESULT              = SENT_TO_ALL ).
          COMMIT WORK.
        CATCH CX_BCS INTO BCS_EXCEPTION.
          WRITE: 'Fehler aufgetreten.'(001).
          WRITE: 'Fehlertyp:'(002), BCS_EXCEPTION->ERROR_TYPE.
          EXIT.
      ENDTRY.
    ENDFORM.                    "main
    FORM HEAD_CONT.
      CLEAR: IT_TEXT[], WA_TEXT, SUBJECT.
      ATT_TYPE = 'RAW'.
      CONCATENATE 'Betreffzeile am' SY-DATUM 'um' SY-UZEIT
      INTO SUBJECT SEPARATED BY SPACE.
      WA_TEXT = 'Hello!'.
      APPEND WA_TEXT TO IT_TEXT.
    WA_TEXT = 'dieses ist eine Testmail'.
    APPEND WA_TEXT TO IT_TEXT.
    WA_TEXT = 'Gruß'.
    APPEND WA_TEXT TO IT_TEXT.
      DESCRIBE TABLE IT_TEXT LINES N10.
      N10 = ( N10 - 1 ) * 255 + STRLEN( WA_TEXT ).
      IT_LENGHT = N10.
      DOCUMENT = CL_DOCUMENT_BCS=>CREATE_DOCUMENT(
                I_TYPE    = ATT_TYPE
                I_TEXT    = IT_TEXT
                I_LENGTH  = IT_LENGHT
                I_SUBJECT = SUBJECT ).
    ENDFORM.                    "HEAD_CONT
    FORM XLS_ATT.
      DATA: BEGIN OF ITAB OCCURS 0,
            MATNR     LIKE MARA-MATNR,
            MTART     LIKE MARA-MTART,
            MATKL     LIKE MARA-MATKL,
            BRGEW     LIKE MARA-BRGEW,
          END   OF ITAB.
      DATA: BRGEW(18).
      CLEAR: IT_BIN[], WA_BIN, SUBJECT.
      SELECT MATNR MTART MATKL BRGEW INTO TABLE ITAB FROM MARA UP TO 10 ROWS.
      CONCATENATE 'Material'      CON_TAB
            'Materialart'   CON_TAB
            'Warengruppe'   CON_TAB
            'Bruttogewicht' CON_NEWL
              INTO WA_BIN.
      APPEND WA_BIN TO IT_BIN.
      LOOP AT ITAB.
        WRITE ITAB-BRGEW TO BRGEW.
        CONCATENATE ITAB-MATNR CON_TAB
                    ITAB-MTART CON_TAB
                    ITAB-MATKL CON_TAB
                         BRGEW CON_NEWL
                    INTO WA_BIN.
        APPEND WA_BIN TO IT_BIN.
      ENDLOOP.
      ATT_TYPE = 'XLS'.
      SUBJECT = 'My XLS attachment'.
      DESCRIBE TABLE IT_BIN LINES N10.
      N10 = ( N10 - 1 ) * 255 + STRLEN( WA_BIN ).
      IT_LENGHT = N10.
      CALL METHOD DOCUMENT->ADD_ATTACHMENT
        EXPORTING
          I_ATTACHMENT_TYPE    = ATT_TYPE
          I_ATT_CONTENT_HEX    = IT_BIN
          I_ATTACHMENT_SIZE    = IT_LENGHT
          I_ATTACHMENT_SUBJECT = SUBJECT.
    ENDFORM.                    "XLS_ATT
    Perhaps it helps.
    regards, Dieter

  • Error while sending excel sheet as attachment to Mail Receiver

    Hi everyone,
    I am facing the below error when I am trying to send data to Mail receiver adapter. The attachment is excel sheet.
    Delivery of the message to the application using connection Mail_http://sap.com/xi/XI/System failed, due to: com.sap.aii.af.ra.ms.api.RecoverableException: Object not found in lookup of MessageTransformBean.: com.sap.engine.services.jndi.persistent.exceptions.NameNotFoundException: Object not found in lookup of MessageTransformBean..
    I don't understand where the problem is. This has been running since long time and last month we have changed our web dispatcher details. I hope everything is fine. But not sure the root cause for this issue.
    Please help me in resolving this.
    Thank you.
    Regards
    Bhanu T.

    Check if this helps: MessageTransformBean module
    Confirm that you have configured the MessagetransformationBean properly.
    Are you trying to convert some payload into Excel and send it as an attachment in the Mail CC? If yes, then I hope that you have included the correct Content_type value.
    Check this for more info on Content_type: /people/community.user/blog/2006/09/08/email-report-as-attachment-excelword
    Regards,
    Abhishek.

  • Zip the data and send as an email attachment

    Hi,
    I have a requirement where I want to send the log as an email attachment. The log size is very huge about 20MB. When I try to send this log as an excel attachment through FM SO_DOCUMENT_SEND_API1 its throwing an error related to the attachment size. Is there any way to zip the data and send the zipped attachment?
    Any help is really appreciated.
    Thnaks,
    Rajinikanth G

    which might help you getting the file from the pc or you can change the source path and then send it to the following reciptant
    data method1 like sy-ucomm.
    data g_user like soudnamei1.
    data g_user_data like soudatai1.
    data g_owner like soud-usrnam.
    data g_receipients like soos1 occurs 0 with header line.
    data g_document like sood4 .
    data g_header like sood2.
    data g_folmam like sofm2.
    data g_objcnt like soli occurs 0 with header line.
    data g_objhead like soli occurs 0 with header line.
    data g_objpara  like selc occurs 0 with header line.
    data g_objparb  like soop1 occurs 0 with header line.
    data g_attachments like sood5 occurs 0 with header line.
    data g_references like soxrl occurs 0 with header line.
    data g_authority like sofa-usracc.
    data g_ref_document like sood4.
    data 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.txt'.
    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 <> 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   = 'Manohar testing by program'.
    g_document-folrg   = 'O'.
    *g_document-okcode   = 'CHNG'.
    g_document-objlen = '0'.
    g_document-file_ext = 'TXT'.
    g_header-objdes =  'Manohar testing by program'.
    g_header-file_ext = 'TXT'.
    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 = 'MK085'.
    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.
    this code might help you

  • Excel in email attachment.

    I am creating an excel from report output and sending it as an attachment in email. For 10,000 records in excel with 50 columns.. the file size is getting upto 27 MB ..ideally it should be 3-4 MB... Any hint what could be the issue ? I copied the content of that file into a new excel and after saving it, it shows 3 MB...

    Sometimes what happens is when you apply rules to any particular row of your excel, the same rule is applied to all 10,000 rows which increases the size of your excel file.
    The case may be vce-versa that you are applying a rule to a prticular column and it is applied to all 50 columns. Please check it out.
    Regards,
    Priyankle Aggarwal

  • Send reports as email attachment

    Hi,
    In the APEX application, I have a page that has filters on top and few reports generated based on the given filter values. I have a email button that when pressed, send the whole page as an email attachment. I cannot use PDF. Is it possible to send the page with few reports as email attachment?
    Thanks
    saru

    When you send as an e-mail, do you mean the html produced report or some sort output file? You could send it as an excel produced output.
    Why can't you use a PDF option in this case?
    Thank you,
    Tony Miller
    Webster, TX

  • Send Excel Via Email

    Hello, all.
    I have 3 problems with the above subject:
    1. How can I insert data from internal table into an excel file ?
        According to previous forum messages I seperate the
        columns by the string '09', I guess that's the problem. What
        should I insert instead as a seperator ?
    2. Which parameter includes the file's name ? I'm using FM
       SO_DOCUMENT_SEND_API1 ? I'm inserting it to
       T_PACKING_LIST-OBJ_NAME.
    3. Is the document size should be number of rows at
        attachment internal table * number of rows ?
    Thanks a lot,
    Rebeka

    check this.....
    REPORT  ZMAIL.
    TABLES: ekko.
    PARAMETERS: p_email   TYPE somlreci1-receiver.
    TYPES: BEGIN OF t_ekpo,
      ebeln TYPE ekpo-ebeln,
      ebelp TYPE ekpo-ebelp,
      aedat TYPE ekpo-aedat,
      matnr TYPE ekpo-matnr,
    END OF t_ekpo.
    DATA: it_ekpo TYPE STANDARD TABLE OF t_ekpo INITIAL SIZE 0,
          wa_ekpo TYPE t_ekpo.
    TYPES: BEGIN OF t_charekpo,
      ebeln(10) TYPE c,
      ebelp(5)  TYPE c,
      aedat(8)  TYPE c,
      matnr(18) TYPE c,
    END OF t_charekpo.
    DATA: wa_charekpo TYPE t_charekpo.
    DATA:   it_message TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0
                    WITH HEADER LINE.
    DATA:   it_attach TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0
                    WITH HEADER LINE.
    DATA:   t_packing_list LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
            t_contents LIKE solisti1 OCCURS 0 WITH HEADER LINE,
            t_receivers LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
            t_attachment LIKE solisti1 OCCURS 0 WITH HEADER LINE,
            t_object_header LIKE solisti1 OCCURS 0 WITH HEADER LINE,
            w_cnt TYPE i,
            w_sent_all(1) TYPE c,
            w_doc_data LIKE sodocchgi1,
            gd_error    TYPE sy-subrc,
            gd_reciever TYPE sy-subrc.
    *START_OF_SELECTION
    START-OF-SELECTION.
      Retrieve sample data from table ekpo
      PERFORM data_retrieval.
      Populate table with detaisl to be entered into .xls file
      PERFORM build_xls_data_table.
    *END-OF-SELECTION
    END-OF-SELECTION.
    Populate message body text
      perform populate_email_message_body.
    Send file by email as .xls speadsheet
      PERFORM send_file_as_email_attachment
                                   tables it_message
                                          it_attach
                                    using p_email
                                          'Example .xls documnet attachment'
                                          'XLS'
                                          'filename'
                                 changing gd_error
                                          gd_reciever.
      Instructs mail send program for SAPCONNECT to send email(rsconn01)
      PERFORM initiate_mail_execute_program.
    *&      Form  DATA_RETRIEVAL
          Retrieve data form EKPO table and populate itab it_ekko
    FORM data_retrieval.
      SELECT ebeln ebelp aedat matnr
       UP TO 111 ROWS
        FROM ekpo
        INTO TABLE it_ekpo.
    ENDFORM.                    " DATA_RETRIEVAL
    *&      Form  BUILD_XLS_DATA_TABLE
          Build data table for .xls document
    FORM build_xls_data_table.
      data: ld_store(50) type c.  "Leading zeros
      CONSTANTS: con_cret(5) TYPE c VALUE '0D',  "OK for non Unicode
                 con_tab(5) TYPE c VALUE '09'.   "OK for non Unicode
    *If you have Unicode check active in program attributes thnen you will
    *need to declare constants as follows
    *class cl_abap_char_utilities definition load.
    *constants:
       con_tab  type c value cl_abap_char_utilities=>HORIZONTAL_TAB,
       con_cret type c value cl_abap_char_utilities=>CR_LF.
      CONCATENATE 'EBELN' 'EBELP' 'AEDAT' 'MATNR' INTO it_attach SEPARATED BY con_tab.
      CONCATENATE con_cret it_attach  INTO it_attach.
      APPEND  it_attach.
      LOOP AT it_ekpo INTO wa_charekpo.
    **Modification to retain leading zeros
      inserts code for excell REPLACE command into ld_store
      =REPLACE("00100",1,5,"00100")
       concatenate '=REPLACE("' wa_charekpo-ebelp '",1,5,"'
                                wa_charekpo-ebelp '")' into ld_store .
      concatenate ld_store into .xls file instead of actual value(ebelp)
       CONCATENATE wa_charekpo-ebeln ld_store  wa_charekpo-aedat wa_charekpo-matnr  INTO it_attach SEPARATED BY con_tab.
       CONCATENATE con_cret it_attach  INTO it_attach.
    it_attach[] = it_ekpo[] .
        APPEND  it_attach.
      ENDLOOP.
    ENDFORM.                    " BUILD_XLS_DATA_TABLE
    *&      Form  SEND_FILE_AS_EMAIL_ATTACHMENT
          Send email
    FORM send_file_as_email_attachment tables pit_message
                                              pit_attach
                                        using p_email
                                              p_mtitle
                                              p_format
                                              p_filename
                                              p_attdescription
                                              p_sender_address
                                              p_sender_addres_type
                                     changing p_error
                                              p_reciever.
      DATA: ld_error    TYPE sy-subrc,
            ld_reciever TYPE sy-subrc,
            ld_mtitle LIKE sodocchgi1-obj_descr,
            ld_email LIKE  somlreci1-receiver,
            ld_format TYPE  so_obj_tp ,
            ld_attdescription TYPE  so_obj_nam ,
            ld_attfilename TYPE  so_obj_des ,
            ld_sender_address LIKE  soextreci1-receiver,
            ld_sender_address_type LIKE  soextreci1-adr_typ,
            ld_receiver LIKE  sy-subrc.
      ld_email   = p_email.
      ld_mtitle = p_mtitle.
      ld_format              = p_format.
      ld_attdescription      = p_attdescription.
      ld_attfilename         = p_filename.
      ld_sender_address      = p_sender_address.
      ld_sender_address_type = p_sender_addres_type.
    Fill the document data.
      w_doc_data-doc_size = 1.
    Populate the subject/generic message attributes
      w_doc_data-obj_langu = sy-langu.
      w_doc_data-obj_name  = 'SAPRPT'.
      w_doc_data-obj_descr = ld_mtitle .
      w_doc_data-sensitivty = 'F'.
    Fill the document data and get size of attachment
      CLEAR w_doc_data.
      READ TABLE it_attach INDEX w_cnt.
      w_doc_data-doc_size =
         ( w_cnt - 1 ) * 255 + STRLEN( it_attach ).
      w_doc_data-obj_langu  = sy-langu.
      w_doc_data-obj_name   = 'SAPRPT'.
      w_doc_data-obj_descr  = ld_mtitle.
      w_doc_data-sensitivty = 'F'.
      CLEAR t_attachment.
      REFRESH t_attachment.
      t_attachment[] = pit_attach[].
    Describe the body of the message
      CLEAR t_packing_list.
      REFRESH t_packing_list.
      t_packing_list-transf_bin = space.
      t_packing_list-head_start = 1.
      t_packing_list-head_num = 0.
      t_packing_list-body_start = 1.
      DESCRIBE TABLE it_message LINES t_packing_list-body_num.
      t_packing_list-doc_type = 'RAW'.
      APPEND t_packing_list.
    Create attachment notification
      t_packing_list-transf_bin = 'X'.
      t_packing_list-head_start = 1.
      t_packing_list-head_num   = 1.
      t_packing_list-body_start = 1.
      DESCRIBE TABLE t_attachment LINES t_packing_list-body_num.
      t_packing_list-doc_type   =  ld_format.
      t_packing_list-obj_descr  =  ld_attdescription.
      t_packing_list-obj_name   =  ld_attfilename.
      t_packing_list-doc_size   =  t_packing_list-body_num * 255.
      APPEND t_packing_list.
    Add the recipients email address
      CLEAR t_receivers.
      REFRESH t_receivers.
      t_receivers-receiver = ld_email.
      t_receivers-rec_type = 'U'.
      t_receivers-com_type = 'INT'.
      t_receivers-notif_del = 'X'.
      t_receivers-notif_ndel = 'X'.
      APPEND t_receivers.
      CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
           EXPORTING
                document_data              = w_doc_data
                put_in_outbox              = 'X'
                sender_address             = ld_sender_address
                sender_address_type        = ld_sender_address_type
                commit_work                = 'X'
           IMPORTING
                sent_to_all                = w_sent_all
           TABLES
                packing_list               = t_packing_list
                contents_bin               = t_attachment
                contents_txt               = it_message
                receivers                  = t_receivers
           EXCEPTIONS
                too_many_receivers         = 1
                document_not_sent          = 2
                document_type_not_exist    = 3
                operation_no_authorization = 4
                parameter_error            = 5
                x_error                    = 6
                enqueue_error              = 7
                OTHERS                     = 8.
    Populate zerror return code
      ld_error = sy-subrc.
    Populate zreceiver return code
      LOOP AT t_receivers.
        ld_receiver = t_receivers-retrn_code.
      ENDLOOP.
    ENDFORM.
    *&      Form  INITIATE_MAIL_EXECUTE_PROGRAM
          Instructs mail send program for SAPCONNECT to send email.
    FORM initiate_mail_execute_program.
      WAIT UP TO 2 SECONDS.
      SUBMIT rsconn01 WITH mode = 'INT'
                    WITH output = 'X'
                    AND RETURN.
    ENDFORM.                    " INITIATE_MAIL_EXECUTE_PROGRAM
    *&      Form  POPULATE_EMAIL_MESSAGE_BODY
           Populate message body text
    form populate_email_message_body.
      REFRESH it_message.
      it_message = 'Please find attached a list test ekpo records'.
      APPEND it_message.
    endform.                    " POPULATE_EMAIL_MESSAGE_BODY

  • Send Excel sheet as attachment

    Hello,
    One of our user is trying to send one sheet of an excel file as attachment and the user does not want to save the sheet. 
    User is using MS Excel 2010 and Outlook 2013/Office365, the question is " From Excel when you go to File>Save&Send>Send as attachment , you will loose Excel program control until you send the email", user is complaining the she used to
    be able to go back to the original Excel file and continue working even before she send the email before migration her email from Lotus Notes to Outlook.
    Any idea if that will be a setting in Excel need to be enable/disable to let the user send the sheet as attachment and work on the same excel file at the same time even before clicking on send bottom ?
    Thanks,
    Pkakaie

    Hi,
    We just need to educate the user how Outlook works in thie scenario.
    When we use the option Send as Attachment from Excel, we can't edit the Excel from the new message dialog, you may notice Excel is actually "locked". To workaround this, simply create a new message, then drag the Excel
    file to the message window, double click the attached file, thus we can edit it from the new message. Once you finish editing, click Save button and send the file.
    Regards,
    Melon Chen
    TechNet Community Support

  • Convert SMARTFORM report to PDF and send as an email attachment

    Hi
    I am using the CONVERT_OTF function module to convert a SMARTFORM report in the "spool" to a PDF file. When I use the DOWNLOAD function module, the resulting file can be opened in acrobat.
    I would like to email the report in PDF format as an attachment. I am using the function module SO_NEW_DOCUMENT_ATT_SEND_API1 to create an attachment however the attached file is not being created correctly and When try to open, it gives 'File is damaged and could not be repaired' error message. I believe that somehow I am not using the SO_NEW_DOCUMENT_ATT_SEND_API1 function module correctly.
    Please help me to correct this
    Thanks
    Rohitha
    see my code below,
    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 132 PLACES.
        IF WA_BUFFER IS INITIAL.
          EXIT.
        ENDIF.
      ENDDO.
      REFRESH:  I_RECLIST,
                I_OBJTXT,
                I_OBJBIN,
                I_OBJPACK.
      CLEAR WA_OBJHEAD.
      I_OBJBIN[] = I_RECORD[].
      I_OBJTXT = '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_to_PDF'.
      WA_DOC_CHNG-EXPIRY_DAT = SY-DATUM + 10.
      WA_DOC_CHNG-OBJ_DESCR = 'Smartform to PDF'.
      WA_DOC_CHNG-SENSITIVTY = 'F'.
      WA_DOC_CHNG-DOC_SIZE = STRLEN( I_OBJTXT ) + ( ( V_LINES_TXT - 1 ) * 255 ) .
      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.
      I_OBJPACK-TRANSF_BIN = 'X'.
      I_OBJPACK-HEAD_START = 1.
      I_OBJPACK-HEAD_NUM = 1.
      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 = 'ATTACHMENT'.
      I_OBJPACK-OBJ_DESCR = 'test'.
      APPEND I_OBJPACK.
      CLEAR I_RECLIST.
      I_RECLIST-RECEIVER = 'my email address u2019.
      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 ', SY-SUBRC.
      ELSE.
        WRITE:/ 'Mail sent'.
      ENDIF.

    Hi rohitha.wijewardena ,
    Please find the below code which i followed and succeed ,
    CALL FUNCTION 'WFMC_PREPARE_SMART_FORM'
        EXPORTING
          pi_nast       = nast
          pi_country    = lv_dlv-land
          pi_addr_key   = lv_addr_key
          pi_repid      = sy-repid
          pi_screen     = lc_x
        IMPORTING
          pe_returncode = gv_retcode
          pe_itcpo      = lv_itcpo
          pe_device     = lv_device
          pe_recipient  = lv_recipient
          pe_sender     = lv_sender.
      IF gv_retcode = 0.
    *moving the data to composer and control parameters for output
        MOVE-CORRESPONDING lv_itcpo TO lv_composer_param.
        lv_control_param-device      = lv_device.
        lv_control_param-no_dialog   = lc_x.
        lv_control_param-preview     = lc_x.
        lv_control_param-getotf      = lv_itcpo-tdgetotf.
        lv_control_param-langu       = nast-spras.
        lv_composer_param-tdnoprint = space.
      ENDIF.
    *Getting the Smartform Function module using Standard Function module
      CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
        EXPORTING
          formname                 = lv_formname           "Smartform Name
       IMPORTING
         fm_name                  = lv_fm_name
       EXCEPTIONS
         no_form                  = 1
         no_function_module       = 2
         OTHERS                   = 3
      IF sy-subrc <> 0.
        gv_retcode = sy-subrc.
        PERFORM protocol_update.
        PERFORM add_smfrm_prot.
      ENDIF.
    **Smartform function module to get the output
      CALL FUNCTION lv_fm_name
        EXPORTING
       control_parameters         = lv_control_param
       mail_recipient             = lv_recipient
       mail_sender                = lv_sender
         output_options             = lv_composer_param
         user_settings              = ' '
          is_bil_invoice             = lv_bil_invoice
          gt_header                  = gt_header
       IMPORTING
         job_output_info            = gv_job_output
        TABLES
          gt_item                    = gt_item
       EXCEPTIONS
         formatting_error           = 1
         internal_error             = 2
         send_error                 = 3
         user_canceled              = 4
         OTHERS                     = 5
      IF sy-subrc <> 0.
        gv_retcode = sy-subrc.
        PERFORM protocol_update.
        PERFORM add_smfrm_prot.
      ENDIF.
      IF nast-nacha = lc_mail.
        gt_otfdata[] = gv_job_output-otfdata[].
    *           Converting Smartform to PDF                          *
        CALL FUNCTION 'CONVERT_OTF'
          EXPORTING
            format                = lc_pdf
            max_linewidth         = 10
          IMPORTING
            bin_filesize          = gv_binfilesize
            bin_file              = gv_pdf_xstring
          TABLES
            otf                   = gt_otfdata[]
            lines                 = gt_pdftab[]
          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.
    *           Sending PDF to Email  using Class                     *
        IF NOT lv_email IS INITIAL .
          TRY.
             gv_send_request = cl_bcs=>create_persistent( ).
              gv_pdf_content = cl_document_bcs=>xstring_to_solix( gv_pdf_xstring ).
              gv_document = cl_document_bcs=>create_document(
                    i_type    = lc_pdf
                    i_hex     = gv_pdf_content
                    i_length  = gv_pdf_size
                    i_subject = lc_subject ).            "Subject for Email
              gv_send_request->set_document( gv_document ).
             gv_recipient = cl_cam_address_bcs=>create_internet_address( lv_email ).
              gv_send_request->add_recipient( gv_recipient ).
              gv_sent_to_all = gv_send_request->send( i_with_error_screen = lc_x ).
              COMMIT WORK.
              IF gv_sent_to_all IS INITIAL.
                MESSAGE i500(sbcoms) WITH lv_email.
              ELSE.
                MESSAGE s022(so).
              ENDIF.
            CATCH cx_bcs INTO gv_bcs_exception.
              MESSAGE i865(so) WITH gv_bcs_exception->error_type.
          ENDTRY.
        ENDIF.

  • Send PO as email attachment

    Currently Iam able to send the PO as an email attachment
    using NACE settings as
    Medium    Program       Form-routine      Form
    External  SAPFM06P   ENTRY_NEU     MEDRUCK
    send
    My requiremnet is to send a custom designed form(PDF based)
    when ever a new PO is created and saved.
    Could any one please help me in finding out the exact program
    where the current code for converting and sending the email
    is present so that I can replace that one with the custom program
    I have developed.

    Check
    Re: Send Purchase Order via email?
    Re: Send Purchase Order via email&#2760004
    Regards,
    Santosh

Maybe you are looking for

  • How do I save photos to CD/backup HD within their albums in iphoto 8.1.2?

    I used to save photos in their intact albums by using the "Originals" folder. Now I don't seem to have one with iPhoto 8.1.2. So if I drag a bunch of albums to a CD to burn, say, they just go in as filenames, not within the albums I took pains to mak

  • Excise tab not appearing in GR display

    Hi, After creating the Goods reciept, when we display the GR document the excise tab is not appearing. While creating only the excise tab appears and can enter all the excise details. But if want check the values entered in the display mode of the GR

  • HP Pavilion TS 14-n020se Notebook PC

    I bought a hp laptop Product number: F0F94EA#ABV from Dubai. The laptop crashed after updating to windows 8.1 along with updates provided by hp. On visiting the HP service center at Gutahalli,Bangalore , India as per the information at HP web site, I

  • Close Notification is triggering at the completion of each path

    In my company we are using BRF+ flat rule for routing rule in process id: SAP GRAC Access Request.  The problem is when each path is completed the end user receives close notification and we want user to receive close notification only at the end of

  • Q.Status  Stopped

    Hi all, We are doing RFC->XI(BPM)->File scenarios. When we test the scenario with the same input and sometimes it works fine. But in some case we are getting a "Scheduled" status in the 'Monitor for processed XML messages(sxmb_moni)' . Ex if we test