WG: Mail in workflow via SO_NEW_DOCUMENT_ATT_SEND_API1 with archived document attached

NICKLAS, Christian christian.nicklas at ser.de
Wed Apr 5 09:47:42 EDT 2006


 Hi All,

I am trying to send a mail with an attachment with function
SO_NEW_DOCUMENT_ATT_SEND_API1. 

In the workflow an email is sent with an attachment of an archived
document..

I get the document via Function ARCHIVOBJECT_GET_TABLE out of the
archive. Now the problem is to transfer the table archivobject
(structure docs = CHAR1024) into the export binary-table contents_bin
(structure SOLISTI1 = SO_TEXT255).

How can I transfer the table of the image into the table of the
attachment-table or has anybody done this before. I always have the
problem that the document cannot be displayed. Also when I try to work
with the binary table

Extract of the code:

*get Image

 CALL FUNCTION 'ARCHIVOBJECT_GET_TABLE'

    EXPORTING

      archiv_id                = lv_archiv_id

      document_type            = 'FAX'

      archiv_doc_id            = lv_arc_doc_id

    IMPORTING

      length                   = lv_length

      binlength                = lv_binlength

    TABLES

      archivobject             = lt_archivobject

      binarchivobject          = lt_binarchivobject

    EXCEPTIONS

      error_archiv             = 01

      error_communicationtable = 02

      error_kernel             = 03.

  IF sy-subrc <> 0.

    RAISE error_get_document.

  ENDIF.

 

*copy internal table via xstring buffer

  DATA:

  lv_buffer TYPE xstring,

  x TYPE i.

 

  LOOP AT lt_binarchivobject INTO ls_binarchivobject.

    CONCATENATE lv_buffer ls_binarchivobject-line INTO lv_buffer

             IN BYTE MODE.

  ENDLOOP.

  x = 0.

  DO.

    objhex-line = lv_buffer+x.

    APPEND objhex.

    x = x + 255.

    IF x GT lv_binlength. EXIT. ENDIF.

  ENDDO.

 

* Insert Attachment

  objpack-transf_bin = ' '.

  objpack-head_start = 1.

  objpack-head_num   = 1.

  objpack-body_start = tab_lines + 1 .

  objpack-body_num   = tab_lines2.

  CONCATENATE 'Beleg' objhead '.FAX' INTO objhead .

  APPEND objhead.

  objpack-doc_type   = 'FAX'.

  objpack-obj_name   = 'ANLAGE'.

  objpack-obj_descr  = 'Rechnungsbeleg'.

  objpack-doc_size   = lv_binlength.

  APPEND objpack.

 

* SendMail

  CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'

    EXPORTING

      document_data              = ls_doc_chng

      put_in_outbox              = 'X'

      commit_work                = 'X'

    TABLES

      packing_list               = objpack

      object_header              = objhead

      contents_bin               = objbin

      contents_txt               = lt_body

      contents_hex               = objhex

      receivers                  = lt_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.

 

Thanks in advance for any hints and regards

Chris

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.mit.edu/pipermail/sap-wug/attachments/20060405/d9165fe7/attachment.htm


More information about the SAP-WUG mailing list