Skip to Content
avatar image
Former Member

Greater than 255 characters not allowed - CSV attachment

While sending the data as a CSV attachemnent, its not allowing more than 255 characters per line.

I want to send more than 255 characters in a line (in the CSV attacment. how to do this ?

The function module which i used is

SO_new_document_att_send_appi1.

or else suggest me a function module used to send csv attachement more than 255 characters in a line

Thanks

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

6 Answers

  • Best Answer
    Sep 04, 2008 at 11:12 AM

    Hi

    Check this Link

    sending-excel-sheet-of-more-than-255-characters-as

    Regards

    Pavan

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi experts,

      Still the issue is not solved.

      I need a function module which sends more than 255 characters in a CSV format as an attachement. If anyone come across the same situtation , please guid me to solve the issue...

      Thanks

  • avatar image
    Former Member
    Sep 08, 2008 at 05:08 AM

    Hi,

    In the packing list..modify 255 to the required value..say 300.

    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.
      t_packing_list-doc_size   =  t_packing_list-body_num * 300.
      APPEND t_packing_list.

    Also change the REPORT ZSENDMAIL LINE-SIZE 300.

    Best regards,

    Prashant

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Cant the issue be solved by using any FM which allows more than 255 characters per line in the CSV file format.. as an attachment ?

      Please provide some good solution to solve this issue

  • avatar image
    Former Member
    Sep 04, 2008 at 11:10 AM

    First you need to compress the internal table data using compress FM, then decompress the data and send it. It will allow more than 255 characters..

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi,

      Give me the name of the function module to compress and decompress

      After that i have to send it to the same function module..

      I have my final datas in the internal table.

      Please check the following and let me know where to use the compress and decompress functin module

      FORM send_csv_mail .

      DATA: lc_raw TYPE so_obj_tp VALUE 'RAW',

      lc_csv TYPE so_obj_tp VALUE 'CSV'.

      DATA: tab_lines TYPE i.

      CONSTANTS : con_tab TYPE c VALUE cl_abap_char_utilities=>horizontal_tab,"#EC NEEDED

      con_cret TYPE c VALUE cl_abap_char_utilities=>cr_lf.

      CLEAR wa_doc_data.

      *

      LOOP AT it_csv1 INTO wa_csv1.

      CONCATENATE con_cret wa_csv1 INTO wa_objbin.

      APPEND wa_objbin TO it_objbin.

      ENDLOOP.

      wa_doc_data-obj_name = 'Name'. "#EC

      CLEAR va_date.

      va_temp_date = sy-datum.

      CONCATENATE va_temp_date6(2) '-' va_temp_date4(2) '-' va_temp_date+0(4) INTO va_date.

      CONCATENATE va_order va_date INTO wa_doc_data-obj_descr SEPARATED BY space.

      *

      DESCRIBE TABLE it_objtxt LINES tab_lines.

      READ TABLE it_objtxt INTO wa_objtxt INDEX tab_lines.

      wa_doc_data-doc_size = ( tab_lines - 1 ) * 1000 + STRLEN( wa_objtxt ).

      *

      CLEAR wa_objpack-transf_bin.

      wa_objpack-head_start = 1.

      wa_objpack-head_num = 0.

      wa_objpack-body_start = 1.

      wa_objpack-body_num = tab_lines.

      wa_objpack-doc_type = lc_raw.

      APPEND wa_objpack TO it_objpack.

      DESCRIBE TABLE it_objbin LINES tab_lines.

      CLEAR wa_objpack.

      wa_objpack-transf_bin = co_on.

      wa_objpack-head_start = 1.

      wa_objpack-head_num = 1.

      wa_objpack-body_start = 1.

      wa_objpack-body_num = tab_lines.

      wa_objpack-doc_type = lc_csv.

      wa_objpack-obj_descr = va_filename.

      wa_objpack-doc_size = tab_lines * 1000.

      APPEND wa_objpack TO it_objpack.

      Append Receiver List

      REFRESH it_receivers.

      CLEAR wa_receivers.

      wa_receivers-rec_type = lc_rec_type.

      wa_receivers-receiver = lv_smtp_addr.

      APPEND wa_receivers TO it_receivers.

      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'

      EXPORTING

      document_data = wa_doc_data

      put_in_outbox = co_on

      commit_work = co_on

      TABLES

      packing_list = it_objpack

      contents_txt = it_objtxt

      contents_bin = it_objbin

      receivers = it_receivers

      EXCEPTIONS "#EC *

      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.

      va_subrc = sy-subrc.

      SUBMIT rsconn01 WITH mode = 'INT' AND RETURN.

  • avatar image
    Former Member
    Sep 09, 2008 at 09:14 AM

    Check below code and adjust your code for compress/decompress...

    DATA : l_email_title TYPE sood1-objdes.

    DATA : l_file_name TYPE soobjchgi1-obj_descr.

    DATA : lit_email_receiver TYPE zphr1_email_tab.

    DATA : lit_email_msg LIKE soli.

    DATA : lit_attachment LIKE soli.

    DATA: l_lines LIKE sy-tabix,

    l_msg_lines LIKE sy-tabix.

    • Creation of the document to be sent

    CLEAR: l_email_title,

    l_file_name,

    lit_email_receiver,

    lit_email_msg,

    lit_attachment,

    gf_doc_chng,

    it_objtxt,

    it_objbody,

    it_objpack,

    it_objhead,

    it_reclist.

    REFRESH: it_objtxt,

    it_objbody,

    it_objpack,

    it_objhead,

    it_reclist.

    *Passing mail subject

    gf_doc_chng-obj_name = text-035.

    gf_doc_chng-obj_descr = text-036.

    • Fill the document data.

    gf_doc_chng-doc_size = 1.

    • Populate the subject/generic message attributes

    gf_doc_chng-obj_langu = sy-langu.

    gf_doc_chng-obj_name = c_saprpt.

    gf_doc_chng-sensitivty = c_value_f.

    • Fill the document data and get size of attachment

    • DESCRIBE TABLE it_output_soli LINES l_lines.

    gf_doc_chng-doc_size =

    ( l_lines - 1 ) * 255 + STRLEN( it_output_soli ).

    gf_doc_chng-obj_langu = sy-langu.

    gf_doc_chng-obj_name = c_saprpt.

    gf_doc_chng-sensitivty = c_value_f.

    *Passing text for mail body

    it_objbody = space.

    APPEND it_objbody.

    CLEAR it_objbody.

    it_objbody = c_hi.

    APPEND it_objbody.

    CLEAR it_objbody.

    it_objbody = space.

    APPEND it_objbody.

    CLEAR it_objbody.

    it_objbody = text-036.

    APPEND it_objbody.

    CLEAR it_objbody.

    it_objbody = space.

    APPEND it_objbody.

    CLEAR it_objbody.

    it_objbody = c_thanks.

    APPEND it_objbody.

    CLEAR it_objbody.

    it_objbody = space.

    APPEND it_objbody.

    CLEAR it_objbody.

    DESCRIBE TABLE it_objbody LINES l_msg_lines.

    READ TABLE it_objbody INDEX l_msg_lines.

    gf_doc_chng-doc_size = ( l_msg_lines - 1 ) * 255 + STRLEN( it_objbody

    ).

    • Creation of the entry for the compressed document

    it_objpack-transf_bin = ' '.

    it_objpack-head_start = 1.

    it_objpack-head_num = 0.

    it_objpack-body_start = 1.

    it_objpack-body_num = l_msg_lines.

    it_objpack-doc_type = c_doc_type.

    APPEND it_objpack.

    CLEAR it_objpack.

    LOOP AT it_output_soli.

    it_objtxt = it_output_soli.

    APPEND it_objtxt.

    CLEAR it_objtxt.

    ENDLOOP.

    • Passing the heading of the report

    it_objhead = text-037.

    APPEND it_objhead.

    CLEAR it_objhead.

    *To compress the table to size of 255 characters

    CALL FUNCTION 'TABLE_COMPRESS'

    TABLES

    in = it_objtxt

    out = it_comprsd.

    IF sy-subrc <> 0.

    ENDIF.

    • To decompress the compressed table

    CALL FUNCTION 'TABLE_DECOMPRESS'

    TABLES

    in = it_comprsd

    out = it_decomprsd.

    IF sy-subrc <> 0.

    ENDIF.

    • Creation of the document attachment

    CLEAR : l_msg_lines,l_lines.

    DESCRIBE TABLE it_decomprsd LINES l_lines.

    IF l_lines <> 0. "Don't create attachment if no data is present

    • Creation of the entry for the compressed attachment

    it_objpack-transf_bin = c_value_x.

    it_objpack-head_start = 1.

    it_objpack-head_num = 1.

    it_objpack-body_start = 1.

    it_objpack-body_num = l_lines.

    it_objpack-doc_type = c_excel.

    it_objpack-obj_name = sy-repid.

    it_objpack-obj_descr = text-036.

    it_objpack-doc_size = l_lines * 255.

    APPEND it_objpack.

    CLEAR it_objpack.

    ENDIF.

    LOOP AT s_email.

    it_reclist-receiver = s_email-low.

    it_reclist-rec_type = c_rec_type.

    it_reclist-express = c_value_x.

    APPEND it_reclist.

    ENDLOOP.

    *Passing maild of the user(who runs the report)

    CLEAR it_reclist.

    CONCATENATE sy-uname text-031 INTO it_reclist-receiver.

    it_reclist-rec_type = c_rec_type.

    it_reclist-express = c_value_x.

    APPEND it_reclist.

    CLEAR it_reclist.

    CONCATENATE sy-uname text-032 INTO it_reclist-receiver.

    it_reclist-rec_type = c_rec_type.

    it_reclist-express = c_value_x.

    APPEND it_reclist.

    *Sending mail with attachment

    CALL FUNCTION 'SO_DOCUMENT_SEND_API1'

    EXPORTING

    document_data = gf_doc_chng

    put_in_outbox = c_val

    commit_work = c_val

    TABLES

    packing_list = it_objpack

    contents_bin = it_decomprsd

    contents_txt = it_objbody

    receivers = it_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 IS NOT INITIAL.

    WRITE: / text-034.

    ELSE.

    WRITE: / text-033.

    ENDIF.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      What is the data type declaration for the internal table it_comprsd

      it_decomprsd.

      it_output_soli

      So that i can use the same for my code.

      then...

      My internal table data : contains the following

      data :begin of it_csv,

      part(2000) type c,

      end of it_csv.

      it_csv is the internal table contains the attachement data . where each line in the internal table goes beyond 255 characteres.

      then i will do

      loop at it_csv into wa_csv.

      concatenate con_cret wa_csv into wa_objbin.

      append wa_objbin to it_objbin.

      endloop.

      this it_objbin i will pass this to so_new_document_... function module.

      Please let me know wat are all the declarations you have used

  • avatar image
    Former Member
    Sep 09, 2008 at 09:58 AM

    You can edit the same FM to adjust more than 255 characters....

    rgds,

    SG

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Dec 02, 2008 at 04:56 AM

    used XI interface to send the document

    Add comment
    10|10000 characters needed characters exceeded