Excel attachment not attached in Workflow
arghadip kar
arghadipkar at yahoo.com
Mon Apr 27 19:02:32 EDT 2009
Hi
I have a strange case where the excel attachment that I am retriveing from the Portal is not getting attached to workflow properly. the Bytesize is getting truncated with a multiple of 255. Here is the small portion of the code attached.
* retrieve the file from app server that was saved by portal
open dataset v_filename for input in binary mode.
if sy-subrc eq 0.
do.
read dataset v_filename into i_solix.
if sy-subrc eq 0.
append i_solix.
else.
exit.
endif.
enddo.
close dataset v_filename.
endif.
* get the index of the binary table
clear v_tab_lines.
describe table i_solix lines v_tab_lines. "get index
read table i_solix into v_wa_solix index v_tab_lines.
"read last line into buffer
* determine the total file size in birnary format
v_doc_size = ( 255 * v_tab_lines ). "whole lines
* convert binary to xstring
call function 'SCMS_BINARY_TO_XSTRING'
exporting
input_length = v_doc_size
importing
buffer = v_xstring
Tables
binary_tab = i_solix.
document file attributes
get the extension name
v_offset = strlen( v_docname_only ) - 3.
v_doc_extension = v_docname_only+v_offset(3).
v_att_header-file_type = 'B'.
v_att_header-file_name = v_docname_only.
v_att_header-file_extension = v_doc_extension.
v_att_header-language = sy-langu.
call function 'SAP_WAPI_ATTACHMENT_ADD'
exporting
workitem_id = v_workitemid
att_header = v_att_header
ATT_TXT =
att_bin = v_xstring
DOCUMENT_OWNER = SY-UNAME
LANGUAGE = SY-LANGU
DO_COMMIT = 'X'
importing
* RETURN_CODE =
att_id = v_att_id
* TABLES
* MESSAGE_LINES =
* MESSAGE_STRUCT =
.
* pass attachment id and internal document number for SOFM
swc_set_element container 'ATT_ID' v_att_id.
swc_set_element container 'SOFM' v_att_id-doc_id.
endif.
Suppose the Byte size is 18992 the v_doc_size is 18870. Can you please check what is the issue.When we try to read the attachment we get the file is damaged and on cancelling the file appears but the byte size is truncated.
Thanks
Arghadip
SAP Workflow Expert
IBM India
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.mit.edu/pipermail/sap-wug/attachments/20090427/4ed34e6b/attachment.htm
More information about the SAP-WUG
mailing list