Hello SAP Guru's,
I need help. The lockbox program is not working properly. I have configured the following thus far:
Define House Bank
Define Control Parameters
Define Posting Data
The file format is BAI2 and the issues we are having is with posting. In the program, when it finds the invoice via RFEBBU00, it clears it regardless of the tolerance therefore it gives the status of "Applied". This is a problem because I expected it to be "On account" to allow post processing for user intervention.
Below is the code:
u2022
o
identify, check remittance information and create advice -
-
-
-
-
-
-
PERFORM identify_customer_with_micr_nr.
PERFORM open_fi_call_1.
IF febep-b1std 'X' OR febep-b2std 'X'.
DESCRIBE TABLE lavip LINES tfill_lavip.
u2022
o
identify invoice numbers
________________________________________
LOOP AT lavip.
CLEAR gjahr.
PERFORM userexit_add_prefix.
lavip-ivsta = '8'.
CASE fiinv.
WHEN 1. "FI doc#
lavip-sfeld = 'BELNR'.
PERFORM read_bkpf_with_belnr USING lavip-swert gjahr.
PERFORM READ_BSEG USING LAVIP-SWERT GJAHR ''. "hw720271
WHEN 2. "search for XBLNR
lavip-sfeld = 'XBLNR'.
IF NOT lavip-swert IS INITIAL. "46a
PERFORM read_bkpf_with_xblnr USING lavip-swert
belnr gjahr dbcnt.
ENDIF. "46a
IF NOT belnr IS INITIAL.
PERFORM READ_BSEG USING BELNR GJAHR ''. "hw720271
ENDIF.
WHEN 3. "first belnr then xblnr
LAVIP-SFELD = 'BELNR'.
PERFORM READ_BKPF_WITH_BELNR USING LAVIP-SWERT GJAHR.
PERFORM READ_BSEG USING LAVIP-SWERT GJAHR ''. "hw720271
IF lavip-ivsta = '8'.
IF NOT lavip-swert IS INITIAL. "46a
PERFORM read_bkpf_with_xblnr
USING lavip-swert belnr gjahr dbcnt.
ENDIF. "46a
IF NOT belnr IS INITIAL.
lavip-sfeld = 'XBLNR'.
PERFORM READ_BSEG USING BELNR GJAHR ''. "hw720271
ENDIF.
ENDIF.
WHEN 4. "first xblnr then belnr
lavip-sfeld = 'XBLNR'.
IF NOT lavip-swert IS INITIAL. "46a
PERFORM read_bkpf_with_xblnr
USING lavip-swert belnr gjahr dbcnt.
ENDIF. "46a
IF NOT belnr IS INITIAL.
PERFORM READ_BSEG USING BELNR GJAHR ''. "hw720271
ELSE.
PERFORM READ_BKPF_WITH_BELNR USING LAVIP-SWERT GJAHR.
PERFORM READ_BSEG USING LAVIP-SWERT GJAHR ''. "hw720271
IF NOT GJAHR IS INITIAL.
LAVIP-SFELD = 'BELNR'.
ENDIF.
ENDIF.
u2022 begin of note 720271 "hw720217
WHEN 5.
LAVIP-SFELD = 'BELNR'.
PERFORM READ_BKPF_WITH_BELNR USING LAVIP-SWERT GJAHR.
PERFORM READ_BSEG USING LAVIP-SWERT GJAHR ''.
IF LAVIP-IVSTA = '8'.
if not lavip-swert is initial.
select * from bkpf into table t_bkpf
where bukrs = lavip-bukrs
and bstat = space
and xblnr = lavip-swert
and stblg = space.
if sy-subrc = 0.
l_amount = lavip-nebtr + lavip-abbtr.
loop at t_bkpf assigning 0.
lavip-nebtr = lavip-nebtr * -1.
ENDIF.
u2022
o
u2022 add * to SWERT if invoice status (IVSTA) 8,9
________________________________________
IF lavip-ivsta CA '89'
AND NOT lavip-swert IS INITIAL.
SHIFT lavip-swert RIGHT BY 1 PLACES.
lavip-swert+0(1) = '*'.
ENDIF.
u2022
o
u2022 Modify LAVIP with new values
________________________________________
MODIFY lavip.
ENDLOOP.
u2022
o
store new bank details in table XBANK
________________________________________
IF mcsta = '8'.
PERFORM store_new_bank_details.
ENDIF.
PERFORM write_check_line.
It looks to be correct. However I suspect there is something in configuration that is wrong. Other clients would stop and clearing would not happen if there were differences outside of tolerance. I am not able to achieve Partially Applied or On Account (we are not using MICR update).
Does anyone have any idea what the program calls for amount matching per 4 record at the invoice level?
Thanks!