Mail in workflow via SO_NEW_DOCUMENT_ATT_SEND_API1 with archiveddocument attached
Griffiths, Mark
mark.griffiths at sap.com
Wed Apr 5 10:37:03 EDT 2006
I haven't tried doing what you are describing, however, if your archive
system supports HTTP you may be better to generate a URL for the
document - there are some archivelink functions to do this. The only
problem can be that the URLs can end up being over a 1000 characters
long once you include securtiy keys, so you may need to use a bit of
HTML to disguise the full ugly URL. Also, when you are testing be
careful as function module test screens only output 255 characters.
When testing a development I did in this area last year I ended up
having to write the URL to my screen in a test program, and then cut and
paste into Word to see if it would work properly!
Regards,
Mark
SAP UK
________________________________
From: sap-wug-bounces at mit.edu [mailto:sap-wug-bounces at mit.edu]
On Behalf Of NICKLAS, Christian
Sent: 05 April 2006 14:48
To: SAP Workflow Users' Group
Subject: WG: Mail in workflow via SO_NEW_DOCUMENT_ATT_SEND_API1
with archiveddocument attached
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/3134fd69/attachment.htm
More information about the SAP-WUG
mailing list