**LOCKBOX ENHANCEMENT**

**The standard SAP lockbox processing program uses**

**MICR# (Bank Key and Bank account) and invoice numbers included in bank lockboxfile to apply and clear open AR items from customer accounts. There are caseswhere the detailed remittance information is not available in the lockbox file.This enhancement is to build additional algorithms to search invoices and applycash. The following additional algorithms are needed to improve invoice**

**matching:**

**Process Flow:**

Standard SAP provides two Function exits **EXIT_RFEBLB20_001** & **EXIT_RFEBLB20_002**.

The Parameters for the function exit **EXIT_RFEBLB20_001** are.

The import parameter **I_AVIK** contains the Payment Advice Header details from file.

The export parameter **(E_AVIK)** contains the manipulated values which need to be

updated in the Payment advice header table **(AVIK). **

The table parameter will have the following tables.

The Parameters for the function exit **EXIT_RFEBLB20_002** are.

**Import Parameters:**

**Export Parameters:**

The logic for calculating the total amount is written in the function exit **EXIT_RFEBLB20_001**.

The following are the important scenarios in Lockbox.

*1) Payment advice header details (I_AVIK) are available and Payment Advice Line Itemdetails (I_AVIP) are not available.*

For the above scenario fetch all the open items form BSID table by passing the Company

code **(I_AVIK-BUKRS)**, Account number **(I_AVIK-KONTO)** and last date of previous

month.

Calculate the due date and delete the records where Baseline Date for Due Date Calculation

is less than last date of current month.

Calculate the total amount by Cumulating the Amount in document currency **(BSID-WRBTR)**

which is fetched from **BSID** table.

If the total amount is equal to the check amount **(I_AVIK-RWBTR)** then,

Move all line items with the corresponding fields from **BSID** to the table parameter**T_AVIP**.

*2) Payment advice header details (I_AVIK) are available and Payment Advice Line Itemdetails (I_AVIP) are available.*

For the above scenario fetch all the open items form **BSID** table by passing the Company

code **(I_AVIK-BUKRS)**, Account number **(I_AVIK-KONTO)** and Reference Document

Number **(T_AVIP-XBLNR)** for all the entries in **T_AVIP** table.

Check whether all the line items in **T_AVIP** table have a corresponding line item in**BSID**.

If Net Payment Amount **(NEBTR)** in the table **T_AVIP** contains value then, calculate the

total amount by Cumulating the Net Payment Amount **(T_AVIP-NEBTR)**.

Else calculate the total amount by Cumulating the Amount in document currency**(BSID-WRBTR)** which is fetched from BSID table.

If the total amount is greater than the check amount **(I_AVIK-RWBTR)** then it is

“Under-Payment”. Insert a line in **T_AVIP** with the difference of check amount**(I_AVIK-RWBTR)** from the total amount.

If the total amount is lesser than the check amount **(I_AVIK-RWBTR)** then it is

“Over-Payment”. Insert a line in **T_AVIP** with the difference amount of total

amount from check amount **(I_AVIK-RWBTR).**