Thursday, April 5, 2018

F4311FSBeginDoc 0001 Record Invalid


F4311FSBeginDoc 0001 Record  Invalid


I spent far too long today trying to solve the following response from F4311FSBeginDoc:

<error code='0001'>Error: Action Invalid</error>
<error code='1456'>Warning: Not in Original Mode of Entry    WARNING</error>

TL;DR: F4311FSBeginDoc szOrderSuffix must  always be "000", even when making change orders.  The F4311EditLine szOrderSuffix values will use the proper number, such as "001", "002" et cetera.


Our integration code in C# uses the following Master Business Functions when making a Subcontract/PO change order:

F4311FSBeginDoc
F4311EditLine (for each line)
F4311EditDoc
F4311EndDoc

They are pretty straightforward to use, especially compared to writing AP or AR invoices.

But today I was refactoring and testing some code and suddenly I could no longer make change orders!

Whenever I posted to F4311FSBeginDoc, I kept getting 0001 Action Invalid, and 1456 Not in Original Mode of Entry.

What the heck?  The code I was modifying  had been working for years, and was working fine just a few days ago.   But I was re-implementing the mappings in what I felt was a simpler structure that more clearly separated the data which is meaningful to end-users versus the "housekeeping" data such as mnJobNumber, szComputerId, and all that jazz.

After a few very frustrated hours, which included rebooting my JDE application server multiple times and diving deep into jdeDebug logs, I found the answer.  Sadly, the answer was sitting in the code which I had originally copied my new code from:

begin.Params.szOrderSuffix.Value = "000"// f4301.phSFXO; this must always be 000


Through all those hours of testing, delving, pulling my hair out, I had managed to miss this comment.  Granted, that comment could have said a lot more, but once I saw it, it was painfully obvious.

Why painfully?  Well, this particular method was written sometime in mid 2016.  Its predecessor, in yet another version of the code, was written in 2012.  And at that time I re-discovered the same issue.  "Re-discovered"?  Yes, because I know that I had implemented it before in 2008, and the original time I wrote that code and discovered that issue was probably in 2004, in Visual Basic 6.  

So - this time I'm writing it down, because while there may be a helpful comment in the code (there will be for sure), my first instinct is always to search online.  And that search can lead me down many wrong paths, and wind up wasting a day or more.

Key words like:  JDE, F4311FSBeginDoc, "1456 Not in Original Mode of  Entry", xmlinterop, BSFN.