<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]-->
<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
        {mso-style-priority:34;
        margin-top:0in;
        margin-right:0in;
        margin-bottom:0in;
        margin-left:.5in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
span.EmailStyle18
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.EmailStyle19
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.EmailStyle20
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext="edit">
  <o:idmap v:ext="edit" data="1" />
 </o:shapelayout></xml><![endif]-->
</head>

<body lang=EN-US link=blue vlink=purple>

<div class=Section1>

<p class=MsoNormal><span style='color:#1F497D'>Sergey, great input! EDID4 was the
piece I missed! Thanks a lot for all your input!<o:p></o:p></span></p>

<p class=MsoNormal><span style='color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='color:#1F497D'>Cheers,<o:p></o:p></span></p>

<p class=MsoNormal><span style='color:#1F497D'>Torsten<o:p></o:p></span></p>

<p class=MsoNormal><span style='color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<div>

<div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'>

<p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span
style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>
sap-wug-bounces@mit.edu [mailto:sap-wug-bounces@mit.edu] <b>On Behalf Of </b>Breslavets
Sergey<br>
<b>Sent:</b> Wednesday, May 30, 2007 2:14 AM<br>
<b>To:</b> SAP Workflow Users' Group<br>
<b>Subject:</b> RE: SAP workflow and IDOC processing (incoming invoices)<o:p></o:p></span></p>

</div>

</div>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif";
color:blue'>Torsten, you could use a &quot;duplicate documents&quot; logic to
match them - i.e. invoice amount, currency, document date, vendor id,
material/service number, etc (Invoice amount, date and vendor are usually
enough to match 99%), but&nbsp;i've actually just thought of a better way to
handle it:</span><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'><o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'>&nbsp;<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif";
color:blue'>You can do the following:&nbsp;Develop a&nbsp;FM to match the
posted invoices and set it as the Check FM for the BKPF-POSTED event (you may
need to setup FICO business event to generate it).&nbsp;Set it as &quot;Check
FM&quot; so it'll kick out in the same session as the posting transaction
itself(!!). Inside your check FM you can use
cl_swf_evt_requester=&gt;get_workitem to retrieve the active workitem id and
check the associated task and worklfow to make sure it's your IDOC posting WF
and not something else. If you got the right workitem&nbsp;it means
that&nbsp;your check&nbsp;FM was kicked out from the posting being processed
inside the IDOC posting workflow&nbsp;- i.e. you can be 100% certain that the
document that is being posted comes from the IDOC workflow... - You got a
match! </span><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'><o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif";
color:blue'>Next, store&nbsp;the posted document number and the IDOC number
(from the workitem container) somewhere (in cluster or whatever) and complete
your check FM without raising an event. Then, back in you IDOC processing
workflow&nbsp; - after completion of the posting step retrieve the posted
document number from the location where you have stored it previously from your
check FM. Last step - you can match IDOC numbers to make sure you got the right
one. </span><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'><o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'>&nbsp;<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif";
color:blue'>... instead of the Check FM you can also use a user-exit or BADI
exit if available.</span><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'><o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'>&nbsp;<o:p></o:p></span></p>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif";
color:blue'>As&nbsp;for&nbsp;the&nbsp;segments&nbsp;-&nbsp;look&nbsp;in&nbsp;EDI*&nbsp;tables,&nbsp;particularly&nbsp;EDIDC
(Control record) and
EDID4(Data):&nbsp;every&nbsp;record&nbsp;has&nbsp;a&nbsp;segment&nbsp;name&nbsp;-&nbsp;you
can use&nbsp;it&nbsp;to&nbsp;map&nbsp;the&nbsp;SDATA&nbsp;field&nbsp;content.</span><span
style='font-size:12.0pt;font-family:"Times New Roman","serif"'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'>&nbsp;<o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif";
color:blue'>here daddy... :)</span><span style='font-size:12.0pt;font-family:
"Times New Roman","serif"'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'>&nbsp;<o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'><br>
&nbsp;<o:p></o:p></span></p>

</div>

<div class=MsoNormal align=center style='text-align:center'><span
style='font-size:12.0pt;font-family:"Times New Roman","serif"'>

<hr size=2 width="100%" align=center>

</span></div>

<p class=MsoNormal style='margin-bottom:12.0pt'><b><span style='font-size:10.0pt;
font-family:"Tahoma","sans-serif"'>From:</span></b><span style='font-size:10.0pt;
font-family:"Tahoma","sans-serif"'> sap-wug-bounces@mit.edu
[mailto:sap-wug-bounces@mit.edu] <b>On Behalf Of </b>Torsten Schnorpfeil<br>
<b>Sent:</b> Tuesday, May 29, 2007 9:44 PM<br>
<b>To:</b> 'SAP Workflow Users' Group'<br>
<b>Subject:</b> RE: SAP workflow and IDOC processing (incoming invoices)</span><span
style='font-size:12.0pt;font-family:"Times New Roman","serif"'><o:p></o:p></span></p>

<p class=MsoNormal><span style='color:#1F497D'>Hi Sergey,<o:p></o:p></span></p>

<p class=MsoNormal><span style='color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='color:#1F497D'>I&#8217;m doing alright, even though
we have to get together sometime for a drink!<o:p></o:p></span></p>

<p class=MsoNormal><span style='color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='color:#1F497D'>Actually you describes exactly
what I&#8217;m trying to do! So, I guess my 64,000 dollar questions would be: how do
you link the data from a posted document to a IDOC document? The IDOC does not
contain the info of the posted document (other than a number in the message,
which is ugly and not really good to use). What is the IDOC table names&nbsp;
you are referring below? In what table does SAP store the segment name and the
segment value linked together?<o:p></o:p></span></p>

<p class=MsoNormal><span style='color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='color:#1F497D'>OK, son&#8230; here are the questions,
so show me that you are worth the big bucks;)<o:p></o:p></span></p>

<p class=MsoNormal><span style='color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='color:#1F497D'>Hope u are doing good and I hear
from you soon ;)<o:p></o:p></span></p>

<p class=MsoNormal><span style='color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='color:#1F497D'>Cheers,<o:p></o:p></span></p>

<p class=MsoNormal><span style='color:#1F497D'>Torsten<o:p></o:p></span></p>

<p class=MsoNormal><span style='color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<div>

<div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'>

<p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span
style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>
sap-wug-bounces@mit.edu [mailto:sap-wug-bounces@mit.edu] <b>On Behalf Of </b>Breslavets
Sergey<br>
<b>Sent:</b> Tuesday, May 29, 2007 8:11 PM<br>
<b>To:</b> SAP Workflow Users' Group<br>
<b>Subject:</b> RE: SAP workflow and IDOC processing (incoming invoices)<o:p></o:p></span></p>

</div>

</div>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif";
color:blue'>Hi Torsten,&nbsp; how you've been?</span><span style='font-size:
12.0pt;font-family:"Times New Roman","serif"'><o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'>&nbsp;<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif";
color:blue'>- you can use an event handler on posting and match attributes of a
posted document to the processed idoc - if you got a match then you got your
document (and a number)</span><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'><o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'>&nbsp;<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif";
color:blue'>- if you know&nbsp;the IDOC number then you can retrieve it and any
associated data from the IDOC tables where it's stored</span><span
style='font-size:12.0pt;font-family:"Times New Roman","serif"'><o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'>&nbsp;<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif";
color:blue'>- finally, if it does not work then you can pay me to do it for
you... &nbsp;:)</span><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'><o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'>&nbsp;<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif";
color:blue'>cheers! Serge~</span><span style='font-size:12.0pt;font-family:
"Times New Roman","serif"'><o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'><o:p>&nbsp;</o:p></span></p>

<div class=MsoNormal align=center style='text-align:center'><span
style='font-size:12.0pt;font-family:"Times New Roman","serif"'>

<hr size=2 width="100%" align=center>

</span></div>

<p class=MsoNormal style='margin-bottom:12.0pt'><b><span style='font-size:10.0pt;
font-family:"Tahoma","sans-serif"'>From:</span></b><span style='font-size:10.0pt;
font-family:"Tahoma","sans-serif"'> sap-wug-bounces@mit.edu
[mailto:sap-wug-bounces@mit.edu] <b>On Behalf Of </b>Torsten Schnorpfeil<br>
<b>Sent:</b> Tuesday, May 29, 2007 4:44 PM<br>
<b>To:</b> sap-wug@mit.edu<br>
<b>Subject:</b> SAP workflow and IDOC processing (incoming invoices)<br>
<b>Importance:</b> High</span><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'><o:p></o:p></span></p>

<p class=MsoNormal>Hello WUGers,<o:p></o:p></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal>We are currently implementing a IDOC scenario with SAP
workflow and I have a question, I&#8217;m seeking enlightenment:<o:p></o:p></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal>When I trigger a customer workflow and I have the IDOC
object as the main object in the workflow (i.e. IDOCINVOIC), what is the best
way to retrieve<o:p></o:p></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoListParagraph style='margin-left:.75in;text-indent:-.25in'>-<span
style='font-size:7.0pt;font-family:"Times New Roman","serif"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span>The document number, company code and fiscal year of the accounting
document (after successful posting)?<o:p></o:p></p>

<p class=MsoListParagraph style='margin-left:.75in;text-indent:-.25in'>-<span
style='font-size:7.0pt;font-family:"Times New Roman","serif"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span>How can I get the values of the IDOC segments, which were imported
previously (i.e. the data we received from the suppliers)?<o:p></o:p></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal>I was looking around, but I couldn&#8217;t find any promising
concept. Any help would be highly appreciated!<o:p></o:p></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal>Thanks a lot,<o:p></o:p></p>

<p class=MsoNormal>Torsten Schnorpfeil<o:p></o:p></p>

</div>

</body>

</html>