<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;"><DIV>Hi</DIV>
<DIV>&nbsp;</DIV>
<DIV>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.</DIV>
<DIV>&nbsp;</DIV>
<DIV>* retrieve the file from app server that was saved by portal<BR>&nbsp;&nbsp; open dataset v_filename for input in binary mode.<BR>&nbsp;&nbsp; if sy-subrc eq 0.<BR>&nbsp;&nbsp;&nbsp;&nbsp; do.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; read dataset v_filename into i_solix.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if sy-subrc eq 0.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; append i_solix.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; exit.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; endif.<BR>&nbsp;&nbsp;&nbsp;&nbsp; enddo.<BR>&nbsp;&nbsp;&nbsp;&nbsp; close dataset v_filename.<BR>&nbsp;&nbsp; endif.<BR>* get the index of the binary table<BR>&nbsp; clear v_tab_lines.<BR>&nbsp; describe table i_solix lines v_tab_lines.&nbsp; "get index<BR>&nbsp; read table i_solix into v_wa_solix index
 v_tab_lines.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "read last line into buffer</DIV>
<DIV>* determine the total file size in birnary format<BR>&nbsp; v_doc_size = ( 255 * v_tab_lines ).&nbsp;&nbsp;&nbsp; "whole lines</DIV>
<DIV>* convert binary to xstring<BR>&nbsp;&nbsp;&nbsp; call function 'SCMS_BINARY_TO_XSTRING'<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; exporting<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; input_length = v_doc_size<BR>&nbsp;&nbsp;&nbsp;&nbsp; importing<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; buffer&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = v_xstring</DIV>
<DIV>Tables<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; binary_tab&nbsp;&nbsp; = i_solix.</DIV>
<DIV>&nbsp;document file attributes<BR>&nbsp;get the extension name<BR>&nbsp; v_offset = strlen( v_docname_only ) - 3.<BR>&nbsp; v_doc_extension = v_docname_only+v_offset(3).<BR>&nbsp; v_att_header-file_type&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = 'B'.<BR>&nbsp; v_att_header-file_name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = v_docname_only.<BR>&nbsp; v_att_header-file_extension = v_doc_extension.<BR>&nbsp; v_att_header-language&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = sy-langu.</DIV>
<DIV>&nbsp;&nbsp; call function 'SAP_WAPI_ATTACHMENT_ADD'<BR>&nbsp;&nbsp;&nbsp;&nbsp; exporting<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; workitem_id&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = v_workitemid<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; att_header&nbsp;&nb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nbsp; .<BR>* pass attachment id and internal document number for SOFM<BR>&nbsp;swc_set_element container 'ATT_ID' v_att_id.<BR>&nbsp;swc_set_element container 'SOFM'&nbsp;&nbsp; v_att_id-doc_id.</DIV>
<DIV>&nbsp; endif.</DIV>
<DIV>&nbsp;</DIV>
<DIV>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.</DIV>
<DIV>&nbsp;</DIV>
<DIV>Thanks</DIV>
<DIV>Arghadip</DIV>
<DIV>SAP Workflow Expert</DIV>
<DIV>IBM India</DIV></td></tr></table><br>