Functional Description
Purpose
This function is used to update a batch with amounts and documents.
Setup Notes and Prerequisites
This function is normally called from ER on the Ok Button Is Clicked event, however it can be called
anytime from ER or another function. This function should be called each time a transaction or
document is created or changed. This function requires a valid Override Mode to be passed (A-Add, C-Change,
D-Delete, V-Void), if not an error will be set. For transaction processing that is very repetitive,
such as updates performed by a UBE, you may wish to call this function once instead of many times for
performance reasons. If so, you may pass the total number of documents in the batch in the function's
parameter. Continue to pass the total Batch Amount in the appropriate function parameter. This will
cause the same net result of calling this function individually for each document. Normally, you
will use this function merely to update the batch. You should close the batch using the B0000008
function. You may however close the batch using this function by passing a "1" in the Form Is Exited On Add
Flag, if necessary. If you are closing the batch using this function and not the B0000008 function
then this function will send a PPAT message if Batch Control is allowed and the Batch is Out Of Balance.
It will also go through the same checks to close a batch as the B0000008 function. Don't forget
that System Constants are determined by Batch Type, if you are using a Batch Type that the function
cannot determine System Constants for, the G/L System Constants will be defaulted. Refer to the
documentation for B0000008 - Batch Revise On Exit function to understand closing a Batch.
Special Logic
If adding to a batch, you will use an "A" in the Override Mode and populate the Transaction Amount
with the amount you want added to the batch.
If changing a batch you will use a "C" in the Override Mode, populate the Transaction Amount Previous
with the amount you want subtracted from the batch and populate Transaction Amount with the amount
you want added to the batch.
If deleting a document from a batch you will use a "D" in the Override Mode, populate the Transaction
Amount Previous with the amount you want subtracted from the batch.
If voiding a document within a batch you will use a "V" in the Override Mode, populate Transaction
Amount with the amount you want added to the batch.
If you are doing heavy UBE-like processing and do not want to call the function for each transaction
you may use the Total Number Of Documents parameter. This will allow you to total the Batch Documents
and Amounts yourself and call the function once. Use the Transaction Amount and Transaction Amount
Previous parameters as you normally would and then pass the Batch Documents total in the Total Number
Of Documents parameter. (i.e. For performance reasons, a 10,000 document batch can call this function
once rather than 10,000 times)
The following logic is executed only if you are closing the batch will calling this function (Passing
a "1" in the Form Is Exited On Add parameter):
If the Batch Documents total is "0" (the batch is empty) when the batch is closed, the batch will
automatically be deleted. If you need to force an empty batch, close the batch using B0000008 and use
the Suppress Delete flag.
Batch Control can be overridden by passing a "1" in the Suppress Batch Control parameter. You should
only use this if you are positive you never want to see Batch Control (i.e. Calling this BSFN from a
UBE).
A PPAT message will be sent if Batch Control is allowed and the Batch is Out Of Balance.
If you wish to force the Batch Status or reset the Batch Status when the batch is closed, pass the
desired Batch Status in the Previous Batch Status and set the Batch Status Flag parameter to "1". If
you want to set the Batch to "Error" then pass a "2" in the Batch Status Flag parameter, the Batch will
be set to "E". If anything else is passed in the Batch Status Flag parameter, the System Constants
will determine the Batch Status.
and Entered, the the function will set the corresponding flag to a "Y", else it will set it an "N".
set the corresponding batch flag to a "Y" else, it will set to an "N".
Technical Specification
Main BSFN:
If Override Mode is not "A" or "C" or "D" or "V"
Set Error
Open F0011 table
Fetch Batch from F0011 table
Retrieve Batch Control/Management Approval Constants
If Override Mode is "A" or "V"
Add Transaction Amount to Batch Amount
If Override Mode is "C"
Subtract Transaction Amount Previous from Batch Amount
Add Transaction Amount to Batch Amount
If Override Mode is "D"
Subtract Transaction Amount Previous from Batch Amount
If Total Number Of Documents is not "0"
If Override Mode is "A"
Add Total Number Of Documents to Batch Documents
If Override Mode is "D"
Subtract Total Number Of Documents from Batch Documents
Else
If Override Mode is "A" or "V"
Add 1 to Batch Documents
If Override Mode is "D"
Subtract 1 from Batch Documents
If Form Is Exited On Add Flag is "1"
If Batch Documents is "0"
Delete Batch from F0011 table
End BSFN
If Batch Control is "ON" and Suppress Batch Control is not "1"
If Batch is Out Of Balance (Amounts or Documents are not equal)
Send PPAT Message
If Batch Status Flag is "1"
Set Batch Status to Previous Batch Status
If Batch Status Flag is "2"
Set Batch Status to "E" (Batch is In Error)
If Batch Status Flag is not "1" or "2"
If Management Approval is "ON"
Set Batch Status to " " (Batch is Pending)
Else
Set Batch Status to "A" (Batch is Approved)
If Batch Documents Entered and Expected are equal
Set Balanced Documents and Amounts Flag to "Y"
Else
Set Balanced Documents and Amounts Flag to "N"
If Transaction Is In Balance Flag is "Y" or "1"
Set Balanced Transaction Flag to "Y"
Else
Set Balanced Transaction Flag to "N"
Else
Set Batch Status to "U" (Batch is "In Use")
Update Batch F0011 table
Close F0011 table
Retrieve M & D Constants:
Open F41001 table
Fetch M & D Constant based on Batch Type
Close F41001 table
D0000007 - Batch - Revise On Transaction Commitment
Parameter Name | Data Item | Data Type | Req/Opt | I/O/Both |
---|---|---|---|---|
mnBatchNumber | ICU | MATH_NUMERIC | NONE | NONE |
Special Input Expected
| ||||
szBatchType | ICUT | char | NONE | NONE |
| ||||
mnTransactionAmount | AME | MATH_NUMERIC | NONE | NONE |
Special Input Expected
| ||||
mnTransactionAmountPrevious | AME | MATH_NUMERIC | NONE | NONE |
Special Input Expected
| ||||
cPreviousBatchStatus | EV01 | char | NONE | NONE |
Special Input Expected
| ||||
cFLAGBatchStatus | EV02 | char | NONE | NONE |
Special Input Expected
| ||||
cFLAGTransactionInBalance | EV03 | char | NONE | NONE |
Special Input Expected
| ||||
cFLAGSuppressBatchControl | EV04 | char | NONE | NONE |
Special Input Expected
| ||||
cFLAGFormExitedOnAdd | EV01 | char | NONE | NONE |
Special Input Expected
| ||||
cOverrideMode | EV05 | char | NONE | NONE |
Special Input Expected
| ||||
mnTotalNumberOfDocuments | MATH01 | MATH_NUMERIC | NONE | NONE |
Special Input Expected
|
B0100011 Error Message Processor to PPAT System | ||||
B0100025 Initialize PPAT Error Message API | ||||
BLM0015 Batch Out Of Balance PPAT Error Message |
F0011 Batch Control Records | ||||
F41001 Inventory Constants |