<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.6000.16640" name=GENERATOR></HEAD>
<BODY bgColor=#fafafa>
<DIV><FONT face=Arial size=2>Hi,</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>you'll need to convert an internal table from
structure length 1024 to 255.</FONT></DIV>
<DIV><FONT face=Arial size=2>There is a SAP Function and Kernel Call that can do
this. I think it was CONVERT_TABLE </FONT></DIV>
<DIV><FONT face=Arial size=2>This is working fine.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Before I have stumbled over this simple function
call, I have programmed it myself to send an ArchiveLink document as an Office
attachment.</FONT></DIV>
<DIV><FONT face=Arial size=2>This is how I did it (but I'm not a 100% sure if
this is the very latest, bugfree, version).</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>For more programming techniques I would advice to
ask in the ABAP Forums of the SDN.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Best wishes,</FONT></DIV>
<DIV><FONT face=Arial size=2>Florin</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>FUNCTION Z_WF_GET_DOC_FOR_SAPOFFICE
.<BR>*"----------------------------------------------------------------------<BR>*"*"Lokale
Schnittstelle:<BR>*" IMPORTING<BR>*"
VALUE(ARCHIV_ID) LIKE TOAV0-ARCHIV_ID<BR>*"
VALUE(ARC_DOC_ID) LIKE TOAV0-ARC_DOC_ID<BR>*"
EXPORTING<BR>*" VALUE(LENGTH) TYPE I<BR>*"
TABLES<BR>*" ATTACHMENT STRUCTURE SOLISTI1
OPTIONAL<BR>*" EXCEPTIONS<BR>*"
ERROR_RETRIEVAL<BR>*"----------------------------------------------------------------------</FONT></DIV>
<DIV> </DIV><FONT face=Arial size=2>
<DIV><BR> DATA: binobject LIKE TBL1024
OCCURS 200,<BR>
archivobject LIKE DOCS OCCURS 200 WITH HEADER
LINE,<BR>
length_bin TYPE
I,<BR>
length_att TYPE
I,<BR> length_archive LIKE
SAPB-LENGTH.</DIV>
<DIV> </DIV>
<DIV><BR> REFRESH: binobject, attachment.</DIV>
<DIV> </DIV>
<DIV> CALL FUNCTION 'SCMS_AO_TABLE_GET'<BR>
EXPORTING<BR>
ARC_ID =
archiv_id<BR>
DOC_ID =
arc_doc_id<BR>
COMP_ID =
'data'<BR>
IMPORTING<BR>
LENGTH =
length_bin<BR>
TABLES<BR>
DATA =
binobject<BR>
EXCEPTIONS<BR>
error_http =
1<BR>
error_archiv =
2<BR>
error_kernel =
3<BR>
error_config =
4<BR>
others =
5<BR>
.<BR> IF SY-SUBRC <> 0.<BR>
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER
SY-MSGNO<BR>
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3
SY-MSGV4<BR>
RAISING ERROR_RETRIEVAL.<BR> ENDIF.</DIV>
<DIV> </DIV>
<DIV> CALL FUNCTION
'SCMS_BINARY_TO_FTEXT'<BR>
EXPORTING<BR>
input_length =
length_bin<BR>
IMPORTING<BR>
output_length =
length_att<BR>
TABLES<BR>
binary_tab =
binobject<BR>
ftext_tab
= archivobject<BR>
EXCEPTIONS<BR>
failed
= 1<BR>
others
= 2.</DIV>
<DIV> </DIV>
<DIV> IF sy-subrc <>
0.<BR> MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER
SY-MSGNO<BR>
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3
SY-MSGV4<BR>
RAISING ERROR_RETRIEVAL.<BR> ENDIF.</DIV>
<DIV> </DIV>
<DIV> length_att = length_bin.<BR>
length_archive = length_att.</DIV>
<DIV> </DIV>
<DIV><BR> CALL FUNCTION
'Z_WF_CONVERT_DOCTABLE_2_OFFICE'<BR>
EXPORTING<BR>
LENGTH =
length_archive<BR>
TABLES<BR>
ARCHIVOBJECT =
archivobject<BR>
ATTACHMENT = attachment.</DIV>
<DIV> </DIV>
<DIV> length = length_archive.</DIV>
<DIV> </DIV>
<DIV>ENDFUNCTION.</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>FUNCTION
Z_WF_CONVERT_DOCTABLE_2_OFFICE.<BR>*"----------------------------------------------------------------------<BR>*"*"Lokale
Schnittstelle:<BR>*" IMPORTING<BR>*" VALUE(LENGTH)
LIKE SAPB-LENGTH<BR>*" TABLES<BR>*"
ARCHIVOBJECT STRUCTURE DOCS<BR>*" ATTACHMENT
STRUCTURE
SOLISTI1<BR>*"----------------------------------------------------------------------</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>****** Die ArchiveLink-API liefert das Dokument in einer internen<BR>******
Tabelle, der Länge 1024 zurück.<BR>****** SAP-Office-API benötigt eine interne
Tabelle der Länge 255.<BR>******<BR>****** Diese Funktion konvertiert von der
ArchiveLink-Tabelle in<BR>****** die SAP-Office konforme Tabelle.</DIV>
<DIV> </DIV>
<DIV><BR> DATA: currentPos TYPE I, " Zeiger
auf die Leseposition
in<BR>
" der ArchiveLink-Tabelle<BR>
writePos TYPE I, " Zeiger auf
Schreibposition<BR>
remain TYPE I, " Anzahl Zeichen
in der
aktuellen<BR>
" Zeile des
ArchiveLink-Objektes,<BR>
" Max=255<BR>
written TYPE I, " Anzahl bytes
übertragen<BR> targetLines
TYPE I, " Größe der Zieltabelle in
Zeilen<BR> lines_attachment TYPE
I, " Anzahl der Zeilen im
Attachement.<BR> currentIndex
TYPE I, " Aktuelle Zeile in der
Quelltab.<BR> line_out(255) TYPE
C,<BR> line_attachment TYPE
solix,<BR>
line_len TYPE I. " Länge
derselbigen</DIV>
<DIV> </DIV>
<DIV><BR> currentPos = 0.<BR> writePos =
0.<BR> REFRESH: attachment.<BR> CLEAR: line_out,
attachment.</DIV>
<DIV> </DIV>
<DIV> targetLines = length / 255.<BR> " Rest
prüfen<BR> remain = length - ( targetLines *
255 ).<BR> IF remain <> 0. " Ja, noch eine
Restzeile<BR> ADD 1 TO
targetLines.<BR> ENDIF.</DIV>
<DIV> </DIV>
<DIV> remain =
255. " Wieder initialisieren<BR>
currentIndex = 1.</DIV>
<DIV> </DIV>
<DIV> WHILE lines_attachment <= targetLines.</DIV>
<DIV> </DIV>
<DIV> READ TABLE archivobject INDEX
currentIndex.<BR> line_Out+writePos(remain) =
archivobject+currentPos(remain).<BR> "
Concat schluckt spaces</DIV>
<DIV> </DIV>
<DIV> written = remain.</DIV>
<DIV> </DIV>
<DIV> line_len = writePos + remain. "
writePos beginnt ja bei 1<BR> writePos = writePos
+ remain.<BR> IF writePos = 255. " Voll gefüllt,
dann appenden</DIV>
<DIV> </DIV>
<DIV> APPEND line_out TO
attachment.<BR> CLEAR
line_out.<BR> writePos =
0.<BR> ELSEIF writePos >
255.<BR> "
exception<BR> ENDIF.</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> " Jetzt prüfen, ob dies bereits der Rest der
Quell-Zeile war.<BR> " Wenn ja, dann müssen wir
beim nächsten Durchlauf die<BR> " nächste Zeile
lesen.<BR> IF currentPos >
769.<BR> ADD 1 TO
currentIndex.<BR> " Und den Rest
ausrechnen, mit dem die nächste
Zeile<BR> " noch gefüllt werden
muss.<BR> remain = currentPos +
255 - 1024.</DIV>
<DIV> </DIV>
<DIV>*---> Insert part
IIId<BR> " Wenn die letzten
Bytes exakt reingepaßt haben, dann
eine<BR> " neue volle zeile
lesen<BR> IF remain <=
0.<BR> remain
= 255.<BR> ENDIF.<BR>*<----
end of Insert<BR> currentPos =
0.<BR> ELSE. " Die aktuelle Zeile enthält noch
genügend Bytes,
um<BR> " voll
zu lesen.</DIV>
<DIV> </DIV>
<DIV> ADD written TO
currentPos. " Zeiger weiterschieben</DIV>
<DIV> </DIV>
<DIV> IF currentPos >
769. " Nächste Zeile kann nicht
mehr<BR>
" voll gefüllt werden, da
keine<BR>
" 255 byte übrig sind<BR>*---> Insert part
IIId<BR> IF
currentPos >= 1024. " Hat genau bis zum Ende
gereicht<BR>
remain =
255.<BR>
ADD 1 TO
currentIndex.<BR>
currentPos =
0.<BR>
ELSE.<BR>
remain = 1024 - currentPos. " Rest
ausrechnen<BR>
ENDIF.<BR>*<---- end of
Insert<BR>
ELSE.<BR>
remain =
255.
" sonst voll befüllen<BR>
ENDIF.</DIV>
<DIV> </DIV>
<DIV> ENDIF.</DIV>
<DIV> </DIV>
<DIV> DESCRIBE TABLE attachment LINES
lines_attachment.</DIV>
<DIV> </DIV>
<DIV> ENDWHILE.</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>ENDFUNCTION.<BR></DIV>
<DIV></FONT> </DIV>
<BLOCKQUOTE
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
<DIV
style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B>
<A title=avnrkumar@yahoo.co.in href="mailto:avnrkumar@yahoo.co.in">a.v.n.r
kumar</A> </DIV>
<DIV style="FONT: 10pt arial"><B>To:</B> <A title=sap-wug@mit.edu
href="mailto:sap-wug@mit.edu">SAP Workflow Users' Group</A> </DIV>
<DIV style="FONT: 10pt arial"><B>Sent:</B> Friday, May 02, 2008 7:36 AM</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> SOFM</DIV>
<DIV><BR></DIV>
<DIV>Hi,</DIV>
<DIV> </DIV>
<DIV> I can get the doucment details using ARCHIVOBJECT_GET_TABLE. It
returns the data in 1024 char table. The SOFM object needs data of 255 char.
How can we convert this.</DIV>
<DIV> </DIV>
<DIV>Thanks</DIV>
<DIV>Raghavendra<BR><BR><B><I>"Florin Wach (gmx)" <<A
href="mailto:florin.wach@gmx.net">florin.wach@gmx.net</A>></I></B>
wrote:</DIV>
<BLOCKQUOTE class=replbq
style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px solid">
<META content="MSHTML 6.00.6000.16640" name=GENERATOR>
<STYLE></STYLE>
<DIV><FONT face=Arial size=2>Hi,</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>instantiate the object type IMAGE and execute
IMAGE.Display as "Secondary Method" to display the archived document
together with the workitem's execution.</FONT></DIV>
<DIV><FONT face=Arial size=2>If you just want to add a hyperlink to the
document in the workitem display, use a container operation _ADHOC_OBJECT
<- &IMAGE& and add it there.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Best wishes,</FONT></DIV>
<DIV><FONT face=Arial size=2>Florin</FONT></DIV>
<BLOCKQUOTE
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
<DIV
style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B>
<A title=avnrkumar@yahoo.co.in href="mailto:avnrkumar@yahoo.co.in">a.v.n.r
kumar</A> </DIV>
<DIV style="FONT: 10pt arial"><B>To:</B> <A title=sap-wug@mit.edu
href="mailto:sap-wug@mit.edu">sap-wug@mit.edu</A> </DIV>
<DIV style="FONT: 10pt arial"><B>Sent:</B> Thursday, May 01, 2008 3:40
PM</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> How to attach archived
documents in the Workitem</DIV>
<DIV><BR></DIV>
<DIV>Hi,</DIV>
<DIV> </DIV>
<DIV> How to attach archived documents in the Workitem.</DIV>
<DIV> </DIV>
<DIV>Thanks</DIV>
<DIV>Raghavendra</DIV>
<DIV><!--2-->
<HR SIZE=1>
</HR>Unlimited freedom, unlimited storage. <A
href="http://in.rd.yahoo.com/tagline_mail_2/*http://help.yahoo.com/l/in/yahoo/mail/yahoomail/tools/tools-08.html/">Get
it now</A>
<DIV>
<HR>
<DIV></DIV>_______________________________________________<BR>SAP-WUG
mailing list<BR><A href="mailto:SAP-WUG@mit.edu">SAP-WUG@mit.edu</A><BR><A
href="http://mailman.mit.edu/mailman/listinfo/sap-wug">http://mailman.mit.edu/mailman/listinfo/sap-wug</A><BR></DIV></DIV></BLOCKQUOTE>_______________________________________________<BR>SAP-WUG
mailing
list<BR>SAP-WUG@mit.edu<BR>http://mailman.mit.edu/mailman/listinfo/sap-wug<BR></BLOCKQUOTE><BR>
<P><!--7-->
<HR SIZE=1>
</HR>Meet people who discuss and share your passions. <A
href="http://in.rd.yahoo.com/tagline_groups_7/*http://in.promos.yahoo.com/groups/bestofyahoo/">Join
them now.</A>
<P>
<HR>
<P></P>_______________________________________________<BR>SAP-WUG mailing
list<BR>SAP-WUG@mit.edu<BR>http://mailman.mit.edu/mailman/listinfo/sap-wug<BR></BLOCKQUOTE></BODY></HTML>