BatchReviseOnExit

Batch - Revise On Exit

Major Business Rule

Object Name: B0000008

Parent DLL: CALLBSFN

Location: Client/Server

Language: C

Functional Description

Purpose

This function is used to close a batch.


Setup Notes and Prerequisites

This function is normally called from ER on the Cancel Button Is Clicked event, however it can be 

called anytime from ER or another function.  This function should be called when you want to close a 

batch.  This function will send a PPM message if Batch Control is allowed and the Batch is Out Of Balance. 

 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.


Special Note:  Please disregard the Override Mode parameter, it is not used in this function.


Special Logic

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, pass a "1" in the Suppress Delete flag 

parameter.


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 PPM 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.


If the batch is in balance for both Batch Amounts Expected and Entered and Batch Documents Expected 
and Entered, the the function will set the corresponding flag to a "Y", else it will set it an "N".


If your transaction is in balance, set the Transaction In Balance Flag to a "Y" or a "1".  This will 

set the corresponding batch flag to a "Y" else, it will set to an "N".



Technical Specification


Main BSFN:

• Open F0011 table
• Fetch Batch from F0011 table
• Retrieve Batch Control/Management Approval Constants
• 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 Suppress Delete Flag is not "1"
• 
If Batch Documents is "0"
• 
Delete Batch from F0011 table
• End BSFN
• 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"
• Update Batch F0011 table
• Close F0011 table
'b7'b7'b7

Retrieve M & D Constants:

• Open F41001 table
• Fetch M & D Constant based on Batch Type
• Close F41001 table

Data Structure

D0000008 - Batch - Revise On Exit


^

Parameter NameData ItemData TypeReq/OptI/O/Both
mnBatchNumberICUMATH_NUMERICNONENONE

Special Input Expected
Pass the Batch Number of the batch you want to close.

^

szBatchTypeICUTcharNONENONE


^

cPreviousBatchStatusEV01charNONENONE

Special Input Expected
If you want to force or reset the Batch Status, pass the desired Batch Status in this parameter and a 

"1" in the Batch Status Flag parameter.

^

cFLAGBatchStatusEV02charNONENONE


^

cFLAGTransactionInBalanceEV03charNONENONE

Special Input Expected
If your transaction is in balance, pass a "Y" or a "1" in this parameter and the corresponding batch 

flag will be set to a "Y", else it will be set to an "N".

^

cFLAGSuppressBatchControlEV04charNONENONE

Special Input Expected
If you want to suppress Batch Control, pass a "1" in this parameter.  You should only suppress Batch 

Control if you are positive you will never use it (i.e. calling this function from a UBE).

^

cOverrideModeEV01charNONENONE

Special Input Expected
Note: Please disregard this parameter it is not being used in this function.

^

cSuppressDeleteFlagEV01charNONENONE



^

Related Functions

B0100011 Error Message Processor to PPAT System
B0100025 Initialize PPAT Error Message API
BLM0015 Batch Out Of Balance PPAT Error Message

Related Tables

F0011 Batch Control Records
F41001 Inventory Constants