Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Text File in SO_NEW_DOCUMENT_ATT_SEND_API1

Former Member
0 Kudos

Hello!

We're using SO_NEW_DOCUMENT_ATT_SEND_API1 to send txt files attached to an e-mail.

My problem is that whenever a text file with less than 500 characters is attached to e-mail, the last line of this text file is filled with many blank characters (spaces)

I can only see this if I open the file by the e-mail, and I'm not able to see this blank line in debug.

I think this is related to table CONTENTS_BIN, due to it's line size of char255, but i'm not 100% sure.

Does any one knows how to solve this? We don't want that blank line at the end of the file.

Mauricio

5 REPLIES 5

Former Member
0 Kudos

Hi Mauricio,

Did you pass xs_gd_doc_data and xt_packing_list in your FM

Constant : lc_name    TYPE string VALUE 'Test Mail',
             lc_descr   TYPE string VALUE 'Test Mail',
             lc_f       TYPE c      VALUE 'F',
             lc_zero    TYPE c      VALUE '0',
             lc_one     TYPE c      VALUE '1',
             lc_doctype TYPE string VALUE 'RAW'.

  CLEAR: lv_cnt.

xy_message-line = lc_string.
  APPEND xyt_message.

  CONCATENATE lc_text_01 xv_premise INTO lv_message_premise SEPARATED BY space.
  xt_message-line = lv_message_premise.
  APPEND xt_message.

  CONCATENATE lc_text_02 xv_address INTO lv_message_address SEPARATED BY space.
  xt_message-line = lv_message_address.
  APPEND xt_message.

  CONCATENATE lc_text_03 xv_auszdat INTO lv_message_auszdat SEPARATED BY space.
  xt_message-line = lv_message_auszdat.
  APPEND xt_message.


  DESCRIBE TABLE xt_message LINES lv_cnt.
  xys_gd_doc_data-doc_size =
     ( lv_cnt - 1 ) * 255 + STRLEN( xt_message ).
  xys_gd_doc_data-obj_langu = sy-langu.
  xys_gd_doc_data-obj_name  = lc_name.
  xys_gd_doc_data-obj_descr = lc_descr.
  xys_gd_doc_data-sensitivty = lc_f.

  CLEAR xyt_packing_list.
  REFRESH xyt_packing_list.

  xyt_packing_list-transf_bin = space.
  xyt_packing_list-head_start = lc_one.
  xyt_packing_list-head_num = lc_zero.
  xyt_packing_list-body_start = lc_one.

  DESCRIBE TABLE xt_message LINES xyt_packing_list-body_num.
  xyt_packing_list-doc_type = lc_doctype.
  APPEND xyt_packing_list.

  CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
    EXPORTING
      document_data              = xs_gd_doc_data
      put_in_outbox              = lc_true
      commit_work                = lc_true
    IMPORTING
      sent_to_all                = lv_sent_all
    TABLES
      packing_list               = xt_packing_list
      contents_txt               = xt_message
      receivers                  = xt_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.

  IF sy-subrc <> 0.
*Do Nothing
  ENDIF.

Hope this resolve your query.

Regards,

Manish

Former Member
0 Kudos

Hi Manish,

Thanks for the input but I'm passing all the correct parameters to the FM. I just don't know why the TXT file is receiveing the blank line..

0 Kudos

HI,

Are you passing the correct Document Size.

xys_gd_doc_data-doc_size =
     ( lv_cnt - 1 ) * 255 + STRLEN( xt_message ).

Regards,

Manish

0 Kudos

I'm passing the correct size..

And - correct me if i'm wrong - but it seems that this parameter is regarding the message body size, and not the attachements size

Former Member
0 Kudos

Hello All,

I am also facing the same problem.

Can anyone let me know how to avoid this.