<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 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 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:#0563C1;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Times New Roman",serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri",sans-serif;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></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="#0563C1" vlink="#954F72"><div class=WordSection1><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman",serif'>Hi Wuggers,<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><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman",serif'>I have two custom workflows that send invoices out for approvals.&nbsp; When these workflows are started, they update a text field on the invoice using BAPI_INCOMINGINVOICE_GETDETAIL and BAPI_INCOMINGINVOICE_CHANGE.&nbsp; &nbsp;The same calls are done to update the invoice again after approval (updating only the text field).<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><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman",serif'>These two workflows, BTW, have been running for 14 years.&nbsp; The method to update the invoice was updated in 2008 when the above BAPIs were released for customer use.<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><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman",serif'>At some point, we recognized that we needed to handle invoices that are in process by workflow when the FY changed.&nbsp; No problem!&nbsp; The BAPI_INCOMINGINVOICE_CHANGE nicely returns <b>invoicedocnumber_new</b> and <b>fiscalyear_new</b> if the old invoice was deleted and a new one created in the background.&nbsp; I capture those new values and pass them back into the object method, where I check for a new invoice/fiscal year and execute some macros (remember them???)<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><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:"Courier New";color:black'>IF NOT new_invoice IS INITIAL.&nbsp; &quot;We have a new invoice doc<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:"Courier New";color:black'>&nbsp; CONCATENATE new_invoice new_year INTO new_key.<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:"Courier New";color:black'>&nbsp; swc_free_object self.<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:"Courier New";color:black'>&nbsp; swc_set_objectkey new_key.<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:"Courier New";color:blue'>* new object reference<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:"Courier New";color:black'>&nbsp; swc_create_object self 'BUS2081' new_key.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:9.5pt;font-family:"Courier New";color:black'>&nbsp; swc_refresh_object self.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:9.5pt;font-family:"Courier New";color:black'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:9.5pt;font-family:"Courier New";color:black'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman",serif;color:black'>This methodology worked ~most~ of the time.&nbsp; Once in a while, one of the workflows would fail on subsequent steps because the new invoice doc number and fiscal year somehow were not returned in the container.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman",serif;color:black'>Since it didn&#8217;t cause anyone except the lowly WF Admin any pain, nobody saw the need to change it!&nbsp; (I can hear Jocelyn talking to me about this&#8230;)<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman",serif;color:black'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman",serif;color:black'>Now we&#8217;ve completed an upgrade to HEC, and noticed some quirks&#8230; BAPI_INCOMINGINVOICE_GETDETAIL doesn&#8217;t always return the accountingdata sorted by serial number, which makes the BAPI_INCOMINGINVOICE_CHANGE throw up (error M8 367).&nbsp; I&#8217;ve added a sort on accountingdata between them, and that problem goes away&#8230;<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman",serif;color:black'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman",serif;color:black'>But now the WFs are all erroring out on Fiscal Year changes &#8211; in QA, and only because I made people test &#8216;pre-HANA&#8217; invoices (smiley face).&nbsp;&nbsp; When I debug the method in the BOR, the BAPI still returns the <b>invoicedocnumber_new</b> and <b>fiscalyear_new</b>, but my trusty macros are not updating the main object of the WF.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman",serif;color:black'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman",serif;color:black'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman",serif'>Sure would appreciate any insights you can share.&nbsp; And bear in mind, this stuff is O-L-D&#8230;<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman",serif'>Thanks,<br>Sue<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></body></html>