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

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.

  • 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

  • Excel doc as email attachment

    Hi Experts
    Hope you guys are doing fine.
    I have a requirement where i need to send the internal table data as an excel email attachment.I used the FM 'SO_NEW_DOCUMENT_ATT_SEND_API1',but in the email attachment,the data is getting distorted and not coming in a properly manner.Here with,i am pasting the code i used.
    (l_pto_tab is the internal table)
    FORM report_as_email .
      TYPES : BEGIN OF ty_pto_tab,
               pernr(10),
               nachn(40),
               vorna(40),
               hdate(15),
               supno(10),
               supln(40),
               supfn(40),
             END    OF  ty_pto_tab.
      DATA:   wa_pack_list  TYPE sopcklsti1,
              it_pack_list  TYPE TABLE OF sopcklsti1.
      DATA:  it_email_lines  like SOLISTI1 occurs 0 with header line,
             it_obj_text  like SOLISTI1 occurs 0 with header line.
      DATA:  wa_object_header  TYPE solisti1,
             it_object_header  TYPE TABLE OF solisti1.
      DATA: wa_mail_receiver  TYPE somlreci1,
            it_mail_receiver  TYPE TABLE OF somlreci1.
      DATA: wa_mail_data      TYPE sodocchgi1,
            l_pto_tab type ty_pto_tab occurs 0 with header line.
      DATA: w_att_lines(6) TYPE n.
      DATA: w_att_lines1(6) TYPE n.
      DATA: text1 TYPE c LENGTH 155.
      DATA: text2 TYPE c LENGTH 155.
      DATA: text3 TYPE c LENGTH 155.
      DATA: wa_error_cols  TYPE ty_email_lines.
      DATA: count TYPE i.
      DATA: gv_date1 TYPE c LENGTH 10.
      REFRESH: it_pack_list,
               it_object_header,
               it_mail_receiver.
    Set first line to be displayed in the document
      wa_object_header-line = 'PTO_Reminder_List.TXT'.
      APPEND wa_object_header TO it_object_header.
    *-- Document data
      CLEAR: wa_mail_data.
      wa_mail_data-obj_name = 'Object name'.
      wa_mail_data-sensitivty = 'O'.
      wa_mail_data-obj_descr = 'PTO Reminder Report'.
    Set Mail body
    it_obj_text = 'PTO Reminder'.
    append it_obj_text.
    clear it_obj_text.
    *-- Set Attachment values
      l_pto_tab-pernr = 'EE Number'.
      l_pto_tab-nachn = 'EE LNAME'.
      l_pto_tab-vorna = 'EE FNAME'.
      l_pto_tab-hdate = 'Hire Date'.
      l_pto_tab-supno = 'Sup No'.
      l_pto_tab-supln = 'Sup LNAME'.
      l_pto_tab-supfn = 'Sup FNAME'.
      INSERT l_pto_tab INTO it_email_lines INDEX 1.
      CLEAR l_pto_tab.
    count = 1.
    loop at it_pto_tab.
      l_pto_tab-pernr = it_pto_tab-pernr.
      l_pto_tab-nachn = it_pto_tab-nachn.
      l_pto_tab-vorna = it_pto_tab-vorna.
      l_pto_tab-hdate = it_pto_tab-hdate.
      l_pto_tab-supno = it_pto_tab-supno.
      l_pto_tab-supln = it_pto_tab-supln.
      l_pto_tab-supfn = it_pto_tab-supfn.
      append l_pto_tab.
      clear l_pto_tab.
      endloop.
    l_pto_tab is the internal table
      LOOP AT l_pto_tab.
          count = count + 1.
          INSERT l_pto_tab INTO it_email_lines INDEX count.
        ENDLOOP.
      REFRESH  l_pto_tab.
      wa_pack_list-head_start = 1.
      wa_pack_list-head_num   = 0.
      wa_pack_list-body_start = 1.
      wa_pack_list-body_num   = 1.
      wa_pack_list-doc_type   = 'RAW'.
      wa_pack_list-doc_size   = 255.
      APPEND wa_pack_list TO it_pack_list.
      CLEAR: wa_pack_list.
    DESCRIBE TABLE it_email_lines LINES w_att_lines.
    READ TABLE it_email_lines INDEX w_att_lines.
    wa_mail_data-doc_size = ( w_att_lines - 1 ) * 255 +
                     STRLEN( it_email_lines-line ).
    Attachment
      wa_pack_list-transf_bin = 'X'.
      wa_pack_list-head_start = 1.
      wa_pack_list-head_num   = 1.
      wa_pack_list-body_start = 1.
      wa_pack_list-body_num   = w_att_lines.
    Excel attachment
      wa_pack_list-doc_type   = 'XLS'.
      wa_pack_list-obj_name   = 'ATTACHMENT'.
      wa_pack_list-obj_descr  = 'PTO_REMINDER_LIST'.
      wa_pack_list-doc_size   = wa_mail_data-doc_size.
      APPEND wa_pack_list TO it_pack_list.
      CLEAR: wa_pack_list.
    *-- Set E-Mail Receiver address
      wa_mail_receiver-receiver = '[email protected]'.
      wa_mail_receiver-rec_type = 'U'.
      wa_mail_receiver-express  = 'X'.
      APPEND wa_mail_receiver TO it_mail_receiver.
      *-- Send E-Mail
      call function 'SO_NEW_DOCUMENT_ATT_SEND_API1'
        exporting
          document_data              = wa_mail_data
          put_in_outbox              = 'X'
          commit_work                = 'X'
        tables
          packing_list               = it_pack_list
          object_header              = it_object_header
          contents_bin               = it_email_lines
          contents_txt               = it_obj_text
          receivers                  = it_mail_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.
      IF NOT sy-subrc IS INITIAL.
        WRITE: / 'E-mail failed.'.
      ENDIF.
    ENDFORM.                    " report_as_email
    Can anyone look into this code and let me know what changes i need to make to correct this error.Or if anyone has any sample code,can you pls share it with me.
    Your help wud be greatly appreciated.
    Thnx

    alan,
      Check the below code.
    report y_cr17_mail .
    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.
    Don't forget to reward if useful.......

  • Excel email attachment

    Hi,
    My excel file contains a logo  , text and other information .
    I have to send this excel file(which is on the local PC in the C drive )  as email attachment .So I am using the FM SO_NEW_DOCUMENT_ATT_SEND_API1 .
    The receiver is able to get the mail but the contents are missing in the attached file .
    Suggest what changes should I make in the below code to successfully send the attachment 
    I am passing the file path as value to parameter  object_header .
    Also I feel  the value to parameter  CONTENTS_BIN   is wrong.
    So please help
    Report ZKNTEST1.
    TABLES: ekko.
    PARAMETERS: p_email TYPE somlreci1-receiver.
    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: TAB_LINES LIKE SY-TABIX.
    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.
    *Populate message body text
    it_message = 'Please find attached a layout'.
    APPEND it_message.
    *Send file by email as .xls speadsheet
    PERFORM send_file_as_email_attachment
    tables it_message
    it_attach
    using p_email
    'Excel layout documnet attachment'
    'XLS'
    'C:\layout.xls'
    'Excel attachment'
    changing gd_error
    gd_reciever.
    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.
    it_message = pit_message.
    *Fill the document data.
    DESCRIBE TABLE it_attach LINES  TAB_LINES.
    w_doc_data-doc_size = ( TAB_LINES - 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'.
    pit_attach = ' \O/ '. APPEND pit_attach.
    pit_attach = '  |  '. APPEND pit_attach.
    pit_attach = ' / \ '. APPEND pit_attach.
    t_attachment = pit_attach.
    t_object_header = 'C:\layout.xls'.
    append t_object_header .
    *Create document notification
    DESCRIBE TABLE it_message LINES  TAB_LINES.
    t_packing_list-TRANSF_BIN = 'X'.
    t_packing_list-HEAD_START = 1.
    t_packing_list-HEAD_NUM   = 0.
    t_packing_list-BODY_START = 1.
    t_packing_list-BODY_NUM   = TAB_LINES.
    t_packing_list-doc_type = 'RAW'.
    t_packing_list-DOC_SIZE   = TAB_LINES * 255.
    APPEND t_packing_list..
    *Create attachment notification
    DESCRIBE TABLE t_attachment LINES TAB_LINES.
    t_packing_list-transf_bin = 'X'.
    t_packing_list-head_start = 1.
    t_packing_list-head_num = 1.
    t_packing_list-body_start = 1.
    t_packing_list-BODY_NUM   = TAB_LINES.
    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   = TAB_LINES * 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_NEW_DOCUMENT_ATT_SEND_API1'
      EXPORTING
        DOCUMENT_DATA                    = w_doc_data
       PUT_IN_OUTBOX                    = 'X'
       COMMIT_WORK                      = 'X'
    IMPORTING
       SENT_TO_ALL                      = w_sent_all
      NEW_OBJECT_ID                    =
      TABLES
        PACKING_LIST                     = t_packing_list
       OBJECT_HEADER                    = t_object_header
       CONTENTS_BIN                     = t_attachment
      CONTENTS_TXT                     = it_message
        RECEIVERS                        = t_receivers
    *Populate zerror return code
    ld_error = sy-subrc.
    *Populate zreceiver return code
    LOOP AT t_receivers.
    ld_receiver = t_receivers-retrn_code.
    ENDLOOP.
    ENDFORM.

    Hi Sandhya,
    Try this out.Reward points if useful
    ISR_FI_SEND_EMAIL
    ISR_FI_SEND_EMAIL_NEW_USER
    SLS_CUST_SEND_EMAIL_TOOL
    OR
    Refer to followinh code
    report y_cr17_mail.
    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 = 'sap-img.com testing by program'.
    g_document-folrg = 'O'.
    *g_document-okcode = 'CHNG'.
    g_document-objlen = '0'.
    g_document-file_ext = 'TXT'.
    g_header-objdes = 'sap-img.com 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.
    End of Program[/code]
    Also check this links as well.
    http://www.sapdevelopment.co.uk/reporting/email/attach_xls.htm
    /people/thomas.jung3/blog/2004/09/09/receiving-e-mail-and-processing-it-with-abap--version-610-and-higher
    Edited by: ravee on May 15, 2008 11:26 PM

  • Problem viewing Japanese characters in Excel sent via Email attachment

    Hi All
    I am using FM '''SO_DOCUMENT_SEND_API1'' to send out an e-mail attachment (Excel file). I am able to receive the Excel file successfully. However I am not able to display the Japanese characters properly in my Excel file.
    I tried to display some Japanese characters in my e-mail contents and I have no problem viewing these characters in my e-mail (I am using MS Outlook 2003). These statements becomes something illegible when I transfer it over to Excel as an attachment. In my Internal Table, these characters are displayed correctly as well.
    Anyone has any advice to solve this issue?
    Thanks for your replies.

    Hi Divya,
    refer to the link below:
    http://www.sapdevelopment.co.uk/reporting/email/attach_xls.htm
    The code in this demonstrates how to send an email to an external email addresswhere the data is stored within a .xls attachment.
    Hope this helps.
    Reward if helpful.
    Regards,
    Sipra

  • Issue with excel email attachment after upgrade

    Hi ,
    We have recently upgraded from ECC 5.0 non-unicode to ECC 6.0 unicode version.
    An existing program converts the data in an internal table into HTML code and then sends this as an email attachment(XLS format) using the FM SO_NEW_DOCUMENT_ATT_SEND_API1.
    Now if the mail attachment is sent from the non-unicode system , excel converts the HTML code and shows the data perfectly but when i open the mail attachment from the unicode system, the HTML code sits in a cell of the excel and therefore data is not visible.If i wish to see the data, i will have to cut the data from the cell and paste it .
    I anticipate that this is because of some issue with the unicode.
    Your inputs towards the issue resolution are highly appreciated.
    Thanks,
    Avanish Joshi

    I found the note 1151258 and as mentioned in it, i used the BCS class for sending excel attachments and it worked.
    My sincere apologies for not replying to those who posted queries to this question.
    Thanks.

  • I have an email attachment that I would like to be able to access when NOTconnected.  I found one suggestion that I should open the attachemtn iniBooks and save it there.  Unfortunately, I have no idea how to do that.

    I am trying to store an email attachment (an Excel spreadsheet) somewhere on my iPhone 5 to be able to access it easily in the future.  I do not need the ability to work on it, just to access it, although it would be convenient if i could load updated versions over it on a regular basis.  The spreadsheet was created in Excel on a laptop with Win 7.  I read one posting that said I should save the document to iBooks and then could open it whenever I wanted.  The same posting refered to something in the upper right corner of the attachment that enabled me to save it to iBooks.  Unfortunately, there is no such option showing when I looked at the file, which I did email to myself.  I was able to open the attachment, but can't get beyond this point.  My tech ability doesn't go much beyond being able to power up my phone, so I need a really simple solution, if one exists.

    First of all, Excel file can't save to iBook.  (iBook only can view PDF files). That's why you don't see it in "open in" options.  In order for you to save excel, you will need a third party app like Numbers, Office2.  There are a few free apps that can use to view.  I used Office2 from Byte2, because I can not only store and view later, I can do some edit too.  Especially when you want to edit a few numbers and re send them to my office or clients will be very useful for me. 

  • How to convert a workbook into PDF and broadcast as Email attachment

    Hello Gurus,
    i have installed the ADS (Adobe Document services). I would like to broadcast workbooks as a pdf file to some user.
    When i open the workbook and go to Broadcast --> Setup a broadcast setting for this workbook. The distribution type is
    Broadcast E-mail; Broadcast E-mail (Bursting); Broadcast Portal; Broadcast Multichannel and Output Format only MS Workbook and Link to current Data. Here i miss the possibility as PDF.
    Where can i set up that the workbook should be broadcast as PDF.
    Any help appreciated.
    Thanks and kind rgerads,
    Murat

    Thanks all for your answers,
    i also read that with changing the format in Report designer then broadcasting via PDF. Is there no possibility for PDFs for MS Excel Workbooks? How does it work when opening the query in Report designer? What do i have to do there but it is no solution for us because in the workbooks we use GET BEX DATA formulas and just show parts of the analyisis grid. I need a proper solution how to use broadcaster converting workbooks into PDF an send them as email attachment
    Thanks,
    Murat

  • Excel file as attachment in mail

    Hi Friends,
    I have a requirement of sending th Excel sheet through email attachment.
    I am getting the records into the internal table,but after sending the Email and receiving it the first line in the excel sheet is a blank line.
    Can you please provide me a solution with source code.

    Hi Pooja,
    check thios code...hope it helps
    *& Report ZWBSAP_EMAIL *
    *Send an email via SAP Workplace
    *Select files from SAP server
    *Note:
    Uses custom table zlookup to pick up a group of email addresses to send to
    if more than one is needed.
    Please note some hard coding.
    REPORT zsap_email MESSAGE-ID z001.
    TABLES: rlgrap, btcxpm, zlookup.
    DATA:
    v_zcode(3) TYPE c,
    svrname LIKE zlookup-zdesc,
    wa_error(80) TYPE c,
    global_filemask_all(80).
    DATA: t_soud LIKE soud.
    DATA: p_infolder LIKE sofdk.
    DATA: p_outfolder LIKE sofdk.
    DATA: object_hd_display LIKE sood2.
    DATA: object_id LIKE soodk.
    DATA: document LIKE sood4.
    DATA: header_data LIKE sood2.
    DATA: link_folder_id LIKE soodk.
    DATA: folder_selections LIKE sofds.
    DATA: folder_list LIKE soxli OCCURS 0 WITH HEADER LINE.
    DATA: receivers LIKE soos1 OCCURS 0 WITH HEADER LINE.
    DATA: objcont LIKE soli OCCURS 0 WITH HEADER LINE.
    DATA: objhead LIKE soli OCCURS 0 WITH HEADER LINE.
    DATA: object_content LIKE solisti1 OCCURS 0 WITH HEADER LINE.
    DATA: object_hd_change LIKE sood1.
    DATA: BEGIN OF files OCCURS 0,
    line(200) TYPE c,
    END OF files.
    DATA: listobject LIKE abaplist OCCURS 1 WITH HEADER LINE.
    *Email to addresses
    SELECTION-SCREEN: BEGIN OF BLOCK bl1 WITH FRAME TITLE text-bl1.
    PARAMETERS: p_mailto(240) TYPE c.
    SELECTION-SCREEN SKIP 1.
    SELECTION-SCREEN COMMENT 10(2) text-001.
    *Use zlookup-ztype as group to define multiple email to addresses
    SELECT-OPTIONS: s_mailto FOR zlookup-ztype.
    SELECTION-SCREEN: END OF BLOCK bl1.
    *Subject
    SELECTION-SCREEN: BEGIN OF BLOCK bl2 WITH FRAME TITLE text-bl2.
    PARAMETERS: p_subj LIKE document-objdes.
    SELECTION-SCREEN: END OF BLOCK bl2.
    *Body
    SELECTION-SCREEN: BEGIN OF BLOCK bl3 WITH FRAME TITLE text-bl3.
    PARAMETERS: p_body1 LIKE solisti1-line LOWER CASE.
    PARAMETERS: p_body2 LIKE solisti1-line LOWER CASE.
    PARAMETERS: p_body3 LIKE solisti1-line LOWER CASE.
    PARAMETERS: p_body4 LIKE solisti1-line LOWER CASE.
    PARAMETERS: p_body5 LIKE solisti1-line LOWER CASE.
    PARAMETERS: p_body6 LIKE solisti1-line LOWER CASE.
    SELECTION-SCREEN: END OF BLOCK bl3.
    *Attachments
    SELECTION-SCREEN: BEGIN OF BLOCK bl4 WITH FRAME TITLE text-bl4.
    PARAMETERS: p_fname1 LIKE files-line.
    PARAMETERS: p_fname2 LIKE files-line.
    PARAMETERS: p_fname3 LIKE files-line.
    PARAMETERS: p_fname4 LIKE files-line.
    PARAMETERS: p_fname5 LIKE files-line.
    PARAMETERS: p_fname6 LIKE files-line.
    SELECTION-SCREEN: END OF BLOCK bl4.
    AT SELECTION-SCREEN.
    PERFORM chk_selection.
    IF NOT wa_error IS INITIAL.
    MESSAGE e001 WITH wa_error.
    ENDIF.
    START-OF-SELECTION.
    END-OF-SELECTION.
    PERFORM send_email.
    FORM chk_selection *
    FORM chk_selection.
    CLEAR wa_error.
    *Loop only once ???
    *If more checkings to be done.
    *Think about it and if not clear.
    *Let it sink in for a couple of minutes.
    *Still doesn't make sence? Go home and sleep on it.
    DO 1 TIMES.
    *Check Email to
    IF p_mailto IS INITIAL
    AND s_mailto IS INITIAL.
    wa_error = 'Invalid or no EMAIL TO selection'.
    EXIT.
    ENDIF.
    ENDDO.
    ENDFORM.
    *& Form send_email
    text
    --> p1 text
    <-- p2 text
    FORM send_email.
    PERFORM get_folder_info.
    PERFORM fill_body.
    PERFORM ins_new_object.
    PERFORM crt_attachments.
    PERFORM fill_receivers_info.
    PERFORM snd_email.
    ENDFORM. " send_email
    FORM Get_folder_info *
    FORM get_folder_info.
    CLEAR t_soud.
    *Small so should be quick.
    SELECT * FROM soud
    INTO t_soud
    WHERE sapnam = sy-uname.
    p_infolder-foltp = 'FOL'.
    p_infolder-folyr = t_soud-inbyr. "inbox
    p_infolder-folno = t_soud-inbno.
    p_outfolder-foltp = 'FOL'.
    p_outfolder-folyr = t_soud-outyr. "outbox
    p_outfolder-folno = t_soud-outno.
    ENDSELECT.
    ENDFORM.
    FORM fill_body *
    FORM fill_body.
    object_content-line = p_body1.
    APPEND object_content.
    object_content-line = p_body2.
    APPEND object_content.
    object_content-line = p_body3.
    APPEND object_content.
    object_content-line = p_body4.
    APPEND object_content.
    object_content-line = p_body5.
    APPEND object_content.
    object_content-line = p_body6.
    APPEND object_content.
    ENDFORM.
    FORM ins_new_object *
    FORM ins_new_object.
    object_hd_change-objnam = 'Notes'.
    object_hd_change-objdes = p_subj.
    CALL FUNCTION 'SO_OBJECT_INSERT'
    EXPORTING
    folder_id = p_outfolder
    object_hd_change = object_hd_change
    object_type = 'RAW'
    owner = sy-uname
    IMPORTING
    object_hd_display = object_hd_display
    object_id = object_id
    TABLES
    objcont = object_content
    objhead = objhead
    EXCEPTIONS
    active_user_not_exist = 1
    communication_failure = 2
    component_not_available = 3
    dl_name_exist = 4
    folder_not_exist = 5
    folder_no_authorization = 6
    object_type_not_exist = 7
    operation_no_authorization = 8
    owner_not_exist = 9
    parameter_error = 10
    substitute_not_active = 11
    substitute_not_defined = 12
    system_failure = 13
    x_error = 14
    OTHERS = 15.
    IF sy-subrc 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    ENDFORM.
    FORM crt_attachments *
    --> P_SUBJ *
    FORM crt_attachments.
    document-foltp = p_outfolder-foltp.
    document-folyr = p_outfolder-folyr.
    document-folno = p_outfolder-folno.
    document-objtp = object_id-objtp.
    document-objyr = object_id-objyr.
    document-objno = object_id-objno.
    document-objnam = 'Notes'.
    document-objdes = p_subj.
    document-okcode = 'CHNG'.
    document-file_ext = 'TXT'.
    link_folder_id = object_id.
    header_data-objla = 'EN'.
    header_data-objnam = document-objnam.
    header_data-objdes = document-objdes.
    header_data-objpri = '5'.
    header_data-objsns = 'O'.
    header_data-file_ext = 'TXT'.
    REFRESH files.
    CLEAR files.
    IF NOT p_fname1 IS INITIAL.
    files-line = p_fname1.
    APPEND files.
    ENDIF.
    IF NOT p_fname2 IS INITIAL.
    files-line = p_fname2.
    APPEND files.
    ENDIF.
    IF NOT p_fname3 IS INITIAL.
    files-line = p_fname3.
    APPEND files.
    ENDIF.
    IF NOT p_fname4 IS INITIAL.
    files-line = p_fname4.
    APPEND files.
    ENDIF.
    IF NOT p_fname5 IS INITIAL.
    files-line = p_fname5.
    APPEND files.
    ENDIF.
    IF NOT p_fname6 IS INITIAL.
    files-line = p_fname6.
    APPEND files.
    ENDIF.
    IF NOT files[] IS INITIAL.
    CALL FUNCTION 'SO_DOCUMENT_REPOSITORY_MANAGER'
    EXPORTING
    method = 'ATTCREATEFROMPC'
    TABLES
    files = files
    CHANGING
    document = document
    header_data = header_data.
    IF sy-subrc = 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    ENDIF.
    ENDFORM.
    FORM fill_receivers_info *
    FORM fill_receivers_info.
    DATA: BEGIN OF reclist OCCURS 0,
    rec LIKE receivers-recextnam,
    END OF reclist.
    *Build reclist
    REFRESH reclist.
    IF NOT p_mailto IS INITIAL.
    reclist-rec = p_mailto.
    APPEND reclist.
    ENDIF.
    IF NOT s_mailto IS INITIAL.
    SELECT zdesc
    INTO reclist-rec
    FROM zlookup
    WHERE ztype IN s_mailto.
    APPEND reclist.
    ENDSELECT.
    ENDIF.
    REFRESH receivers.
    LOOP AT reclist.
    folder_selections-folnam = 'INBOX'.
    CALL FUNCTION 'SO_FOLDER_LIST_READ'
    EXPORTING
    folder_selections = folder_selections
    owner = sy-uname
    region = 'P'
    TABLES
    folder_list = folder_list
    EXCEPTIONS
    component_not_available = 1
    operation_no_authorization = 2
    owner_not_exist = 3
    parameter_error = 4
    x_error = 5
    OTHERS = 6.
    IF sy-subrc = 0.
    CLEAR receivers.
    receivers-rcdat = sy-datum.
    receivers-rctim = sy-uzeit.
    receivers-recnam = reclist-rec.
    receivers-recno = folder_list-parno.
    receivers-rectp = folder_list-partp.
    receivers-recyr = folder_list-paryr.
    receivers-sndtp = folder_list-partp.
    receivers-sndyr = folder_list-paryr.
    receivers-sndno = folder_list-parno.
    receivers-sndnam = sy-uname.
    receivers-sndpri = '1'.
    receivers-msgid = 'SO'.
    receivers-msgno = '619'.
    receivers-deliver = 'X'.
    receivers-not_deli = 'X'.
    receivers-read = 'X'.
    receivers-mailstatus = 'E'.
    *receivers-ADR_NAME
    receivers-resend = ' '.
    receivers-sortfield = ' '. "'USER WF_BATCH INDIGO BATCH'.
    receivers-sortclass = '5'.
    APPEND receivers.
    ELSE.
    CLEAR receivers.
    receivers-sel = 'X'.
    receivers-recesc = 'U'.
    receivers-recnam = 'U-'.
    receivers-recextnam = reclist-rec.
    receivers-deliver = 'X'.
    receivers-not_deli = 'X'.
    receivers-read = 'X'.
    receivers-mailstatus = 'E'.
    receivers-adr_name = reclist-rec.
    receivers-sortfield = reclist-rec.
    receivers-sortclass = '5'.
    APPEND receivers.
    ENDIF.
    ENDLOOP.
    ENDFORM.
    FORM snd_email *
    FORM snd_email.
    CALL FUNCTION 'SO_OBJECT_SEND'
    EXPORTING
    folder_id = p_outfolder
    object_id = object_id
    outbox_flag = 'X'
    owner = sy-uname
    check_send_authority = 'X'
    originator_type = 'J'
    link_folder_id = link_folder_id
    TABLES
    objcont = object_content
    receivers = receivers
    EXCEPTIONS
    active_user_not_exist = 1
    communication_failure = 2
    component_not_available = 3
    folder_not_exist = 4
    folder_no_authorization = 5
    forwarder_not_exist = 6
    note_not_exist = 7
    object_not_exist = 8
    object_not_sent = 9
    object_no_authorization = 10
    object_type_not_exist = 11
    operation_no_authorization = 12
    owner_not_exist = 13
    parameter_error = 14
    substitute_not_active = 15
    substitute_not_defined = 16
    system_failure = 17
    too_much_receivers = 18
    user_not_exist = 19
    originator_not_exist = 20
    x_error = 21
    OTHERS = 22.
    IF sy-subrc 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    ENDFORM.
    Thanks
    Nayan

  • CSV email attachment and spaces

    Hello everyone,
    I have been working on making an email attachment in CSV for a client. I have created the file dynamically in a string table. Though, because it is done dynamically, my string table has sometimes, as a fictive example, something like this
    First line has 63 characters,
    Second line has 225 characters
    Third line has 182 characters, etc
    Often, a group of three lines has to be put on one line in the CSV and I added a control return character that works just fine so my problem is not there.
    My problem is the fact that I have lot of blanks in my files when I wouldn't want it to be... Taking the same example:
    First line has 192 blanks,
    Second line has 30 blanks
    Third line has 73 blanks, etc.
    In fact, I have always 255 - X characters = Y Blanks. I understand a string is 255 characters so it's not a question for me to know why 255.
    My question though is this: Is there a way to prevent those blanks to be put in the CSV file? Because I have huge gaps and I know it would mess up the data inserted in it.
    As a complement of informations, I use Module Function 'SO_NEW_DOCUMENT_ATT_SEND_API1' to create the email with attachment and my CSV is not open by Excel (who places the field correctly) but via notepad to show the data to its raw values. All those gaps need to be removed.
    Thank you very much for your help
    Don't hesitate if you need more infos.
    EDIT: Oh and I tried with CONDENSE WITH NO-GAPS but it's not working either.

    Hi Sylvain,
    Can you check for any special characters in your data. Special characters like ',",!,# do behave in an unwanted way and create problems. Check for the special characters from the point of start of spaces to the next character where the spaces end.
    Regards, Pranav.

  • Read PDF form from email attachment

    Hope someone is able to help on this one...
    We are using a pdf form at work to gather some feedback and the user will be submitting the form via email...
    Using outlook 2003 I had a crack at writing a vba module to read the pdf form from the email attachment to update into an excel spreadsheet
    Is it possible to read pdf forms from the email attachment with outlook vba? Or does the attachment need to be saved to a directory first?
    I have in the past done a vba module to save the pdf form attachments to a directory and then using acrobat and it's in-built form data collection tool and exported as a csv, but this feedback form will be an ongoing thing that will be updated daily - and to minimise handling would like to run the outllook macro that reads straight from the email attachment instead of doing another 3 or so steps...
    Below is the snippet I am using - it's a mashup of different code I've found on the net
    Sub Feedback()
        On Error GoTo Feedback_err
        'Dim ns As NameSpace
        Dim objNS As NameSpace
        'Dim Inbox As MAPIFolder
        Dim objFolder As Outlook.MAPIFolder
        'Dim SubFolder As MAPIFolder
        Dim objExcel
        Dim oBook
        Dim oSheet
        Dim gApp As Acrobat.CAcroApp ' In Tools > References > Checked all Acrobat Libraries in VBA > Tools > References
        Dim pdDoc As Acrobat.CAcroPDDoc
        Dim jso As Object
        Dim Item As Object
        Dim Atmt As Attachment
        Dim filename As String
        'Dim i As Integer
        Dim myOrt As String ' Added 13/1/2010
        Set objApp = CreateObject("Outlook.Application")
        Set objNS = objApp.GetNamespace("MAPI")
        Set objFolder = objNS.PickFolder
    ' Check subfolder for messages and exit of none found
        If objFolder.Items.Count = 0 Then
        'If SubFolder.Items.Count = 0 Then
            MsgBox "There is no Feedback emails in this folder.", vbInformation, _
                   "Nothing Found"
            Exit Sub
        End If
    ' Check each message for attachments
        Set objExcel = CreateObject("Excel.Application")
        Set oBook = objExcel.Workbooks.Open("G:\Path\Filename.xls")
        Set oSheet = objExcel.Worksheets(1)
        oSheet.Range("A2").Select
        Set gApp = CreateObject("AcroExch.App") ' make acrobat session
        Set pdDoc = CreateObject("AcroExch.PDDoc")
        Set jso = pdDoc.GetJSObject ' set the Javascript object via this way we can fill in the PDF document fields
        For Each Item In objFolder.Items
            For Each Atmt In Item.Attachments
                If Right(Atmt.filename, 3) = "pdf" Then
                    Do
                    If IsEmpty(objExcel.ActiveCell) = False Then
                        objExcel.ActiveCell.Offset(1, 0).Select
                    End If
                    Loop Until IsEmpty(objExcel.ActiveCell) = True
                        objExcel.ActiveCell.value = jso.getField("CurrentDocDate").value
                        objExcel.ActiveCell.Offset(0, 1).value = Item.Session.CurrentUser
                        objExcel.ActiveCell.Offset(0, 2).value = jso.getField("txtJobNo").value
                        objExcel.ActiveCell.Offset(0, 3).value = jso.getField("rbStatus").value
                        objExcel.ActiveCell.Offset(0, 4).value = jso.getField("rbFeedback").value
                        objExcel.ActiveCell.Offset(0, 5).value = jso.getField("txtComments").value
                End If
            Next Atmt
        Next Item
        oBook.Save
        objExcel.Quit
    Feedback_exit:
        Set Atmt = Nothing
        Set Item = Nothing
        Set objNS = Nothing
        Set pdDoc = Nothing
        Set objExcel = Nothing
        Set jso = Nothing
        Exit Sub
    ' Handle Errors
    Feedback_err:
        MsgBox "An unexpected error has occurred." _
            & vbCrLf & "Please note and report the following information." _
            & vbCrLf & "Macro Name: Feedback" _
            & vbCrLf & "Error Number: " & Err.Number _
            & vbCrLf & "Error Description: " & Err.Description _
            , vbCritical, "Error!"
    Resume Feedback_exit
    End Sub
    I get a vba error 91 "Object Variable or With  block variable not set"
    Cheers
    Ben

    hi Phani,
    with regard to your problem I would suggest you to please go thru this link.
    Hope this would be helpful to you.
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webdynpro/offline%20interactive%20pdf%20form%20using%20e-mail.pdf
    Thanks,
    kris

  • 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

  • Report output as an email attachment

    Hi ,
    I am sending report output as email attachment by using 'mail recipient ' CLTR+ F7' option in alv list.
    But this is sending mail as pdf attachment. I want it as excel format.
    Is there any option to change type of attachment which sending mail?

    Hi,
    This is not possible to change the filetype of the attachment. Instead you can have your own functionality in the program to send email with excel attachment
    Refer to this link..http://docs.google.com/Doc?id=dfv2hmgs_0fm22tggx&hl=en

  • 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

Maybe you are looking for

  • Sender Mail Adapter - default interface name

    Hi, I need to receive through one e-mail sender channel tree different kind of messages. In sender mail adapter I specify ecept other parameters "Default Interface Name". When I send a message with a same as defined in an interface the message is pro

  • How to Make a Multi-Level Game in Flash 5

    I'm wanting to know, "How to Make a Multi-Level game with Flash 5"? EX: If I were to make a space game, where after reaching a score of 2000 points, the game pauses and displays the text "Stage 2", then continues or provides a button to make the game

  • Deleting a .plist file

    I have deleted my Carbonite account and there is still an annoying popup that keeps appearing on my desktop.  I logged in as root user and deleted all the carbonite files from system/library. There is still 2 .plist files in library/launchagents. Can

  • XML import issue in Primavera P6: "Process completed with errors."

    When trying to import a small XML file (from MS Project 2010) to P6 server via P6 V7 CITRIX client, then I receive the message "Process completed with errors. See log file for details.". But the log files are fine (no error, no warning, final validat

  • Airdrop unresponsive

    Set up Yosemite on my iMac and MacBook Pro - no problems. Now I just discovered that Airdrop is completely dead on both. They cannot find each other. Had no problems whatsoever with Mavericks and cannot find any guide for solving this. Sharing is als