Missing Batch Headers - AP - Solution

David Tremain

Active Member
Since I could not figure out which thread to attach this to, I'm posting it as new.

Problem: In E1 8.10, we were experiencing the situation where after voucher match, the batch header would be missing in F0011 (detail records with the same batch number would be present in F0911).

SAR: 7665654 Batch Header is deleted RPT1292155000 System 43B
This SAR describes the problem, and shows how to replicate it.

Possible Solution:
In P4314 - Voucher Match; Form W4314A - Voucher Match; PROCESS:Cancel Logic (hidden button); Button Clicked event; circa line 0017 (line 19 in ER editor) there is a call to F0011 Close Batch.

If you change the last parameter of that call, cSuppressDeleteFlag, to receive VA frm_OKButtonClicked, the batch header record will be retained.

Code snippet (with change - only last line is changed):
0014 // SAR 7419525 Begin
0015 // Move this logic to End Dialog event to avoid a deadlock on F0011
0016 // for Progress Payments, for TP is enabled for F4314EndDoc.
If PO cProgressPaymentActive is not equal to "1"
0017 F0011 Close Batch
FC ICU..Batch Number -> mnBatchnumber
VA frm_BatchType -> szBatchtype
"A" -> cOverrideMode
VA frm_OKButtonClicked -> cSuppressDeleteFlag

Discussion in more detail:
VA frm_OKButtonClicked is only set to 1 in the &OK button's Post Button Clicked event, after successful completion of a call to F4314 End Doc. This indicates that the OK button was clicked, AND there is a valid batch to process.

To finalize a batch, the user must click OK (which runs a process asynchronously), and then the Cancel button (in order to call F0011 Close Batch) - closing the window with anything other than the Cancel button will skip calling F0011 Close Batch. If Close Batch is not called, the batch status stays at IN USE (U). F0011 Close Batch is called from PROCESS:Cancel Logic (hidden button) which is called via ButtonClick system function in the &Cancel button's Post Button Clicked event.

F0011 Close Batch, unless the cSuppressDelete flag is set, checks the number of items actually in the batch (value of alias DOCN in the batch header record (F0011)). If the actual number of items in the batch is zero, it deletes the header record. If the asynchronous process to finalize the batch has not yet updated the header record with the number of actual items in the batch, the value of DOCN will be zero, and thus, the header record will be deleted. If the asynch process has updated DOCN, the header record will be retained or deleted, depending on if there are any items in the batch.

Since the VA frm_OKButtonClicked variable records that the user has clicked OK to finalize a batch, passing that value in as the cSuppressDelete flag causes the header record to be retained - even if the asynch process has not yet updated the header record. In the worst case scenario, it might be possible for a batch header record to be retained when there is no detail associated with the batch.

If the above logic is incomplete or incorrect, the suggested change may not prove to be an adequate remedy to the situation.

Use at your own risk - your mileage may vary.

Please note - the Batch Control screen that appears immediately after the Cancel button is clicked may still have blanks in the actual item count and amount fields. If you OK that screen, and do a find on the following screen, you will see that the batch is complete and correct. In some cases, it may still come up as U - In Use instead of A - Approved.
 
David,

thank you very much for posting this. We have been experiencing the symptoms you described on a random / intermittent basis since going to 8.9. I'll need to follow up and see if I can replicate the problem as you described it and then check the code but your answer "feels right".

Thanks again,
 
David,

This is exactly the same problem we are experiencing since we went from JDE XE base to JDE XE Update 8.
We have missing batch headers very frequently now... Your explaination is very convincing, thanks a lot!

Best regards,
J.
 
Back
Top