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: 

SO_NEW_DOCUMENT_ATT_SEND_API1 - Release 7.0 Issue

SimoneMilesi
Active Contributor
0 Kudos

Hi all!

I'm just upgrading my Sap from release 4.7 to release 7.0 and i got an issue with the F.M. "SO_NEW_DOCUMENT_ATT_SEND_API1".

All the attachments are truncated but they are all small than 255 characters

This is my code, can anyone tell me what i'm missing?


CLEAR receivers_tab. REFRESH receivers_tab. 
    LOOP AT address. "Upload addresses
    receivers_tab2-rec_date = sy-datum.
    receivers_tab2-rec_type = 'U'.
    receivers_tab2-receiver = address.
    APPEND receivers_tab.
  ENDLOOP.

* E-Mail Header and body message
  CLEAR document_data.
  document_data-obj_name   = 'Spedizioni. "Nome doc.
  document_data-obj_langu  = 'I'.            "Lingua
  document_data-sensitivty = 'O'.            "Sensibilità: Standard
  CONCATENATE 'Sped da' t_dest_mail-vstel
    INTO document_data-obj_descr SEPARATED BY space.

* Riempimento contenuto e-mail (EMAIL BODY)
  DATA va_line LIKE soli-line.
  CLEAR contenuto. REFRESH contenuto.
  WRITE: 'Data:'  TO va_line(5),
         sy-datum TO va_line+6(10) DD/MM/YYYY,
         'Ora:'   TO va_line+18(4),
         sy-uzeit TO va_line+23(8) USING EDIT MASK '__:__:__'.
  PERFORM: riempi_riga TABLES contenuto USING va_line,
           riempi_riga TABLES contenuto USING '',
           riempi_riga TABLES contenuto USING text-102, "Si prega ...
           riempi_riga TABLES contenuto USING '',
           riempi_riga TABLES contenuto USING text-103.

{color:green}* Attachment
* This is the old way i create the attachment and at the end, my CONTENTS_BIN contain all the 
* Line
  DATA: va_line_bin LIKE soli-line.
 
  CLEAR va_line_bin.
  LOOP AT t_attach.
    WRITE t_attach TO va_line_bin.
    PERFORM riempi_riga TABLES contents_bin USING va_line_bin.
    CLEAR va_line_bin.
  ENDLOOP.
{color}

*     Informazioni aggiuntive per allegato e-mail (dimensione)
  DATA n LIKE sy-tabix.
  DESCRIBE TABLE contenuto LINES n.
  document_data-doc_size = n * 255.
*     Descrizione componenti oggetto importati
  CLEAR packing_list-transf_bin.
  packing_list-body_num = n.
  packing_list-doc_type = 'RAW'.
  APPEND packing_list.
*     Creazione del documento allegato (CONTENTS_BIN)
  DESCRIBE TABLE contents_bin LINES n.
  object_header = 'SPEDIZIONI.CSV'. "Nome al salvataggio
  APPEND object_header.

* CREATION OF THE ENTRY FOR THE COMPRESSED ATTACHMENT
  packing_list-transf_bin = 'X'.
  packing_list-head_start = 1.
  packing_list-head_num   = 1.
  packing_list-body_start = 1.
  packing_list-body_num   = n.
  packing_list-doc_type   = 'RAW'.    "Formato allegato
  packing_list-obj_name   = 'FILE_SPED'.
  packing_list-obj_descr = document_data-obj_descr.

{color:green}
* Here i create the new CONTENT_HEX table, which seems to be truncated.
  FIELD-SYMBOLS: <fs_solix> TYPE solix.
  DATA : content_hex TYPE STANDARD TABLE OF solix WITH HEADER LINE.


  REFRESH content_hex.

  LOOP AT  contents_bin.
    CONDENSE contents_bin-line.
    ASSIGN contents_bin TO <fs_solix> CASTING.
    APPEND <fs_solix> TO content_hex.
  ENDLOOP.
  READ TABLE content_hex INDEX n.
*
{color}
* ITSIMIL 13/01/2009 - fine
  packing_list-doc_size   = n * 255.
  APPEND packing_list.

  CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
    EXPORTING
      document_data              = document_data
      put_in_outbox              = 'X'
    TABLES
      packing_list               = packing_list
      object_header              = object_header
*      CONTENTS_BIN               = CONTENTS_BIN
       contents_hex               = content_hex
       contents_txt               = contenuto
      receivers                  = receivers_tab2
    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 NE 0.
    MOVE 'X' TO flag.
  ENDIF.
  COMMIT WORK.

5 REPLIES 5

Former Member
0 Kudos

hi

use parameter

commit_work = 'X'. to send mail.

0 Kudos

It would be nice to read what i posted before reply instead of spamming

1-I sent emails

2-Look at last statement of my code: COMMIT WORK.

Former Member
0 Kudos

Can you check OSS note # 787418 ?

0 Kudos

Thanks for the hint, but note 787418 is already implemented.

manubhutani
Active Contributor
0 Kudos

Hi Simone,

I am facing the same issue.

Can you please help.

Regards,

Manu