Hi,
I do have a question on invoice blocking and release process(MIRO/MRBR).
Our client needs to block an invoice (and items) if unplanned costs are set on an invoice. I used BAdi MRM_PAYMENT_TERMS to set the payment block key to 'R' and BADI INVOICE_UPDATE to set price blocking reason for items to 'X'.
The code is as follow:
BADI MRM_PAYMENT_TERMS
"If unplanned costs are set, block invoice
IF i_rbkpv-beznk IS NOT INITIAL.
e_zlspr = 'R'.
ENDIF.
BADI INVOICE_UPDATE
FIELD-SYMBOLS: <fs1> TYPE any,
<fs2> TYPE STANDARD TABLE,
<fs_rseg> TYPE mmcr_drseg.
* Check if the invoice has "Unplanned Costs" - Check at header level
IF s_rbkp_new-beznk IS NOT INITIAL.
* Get the invoice items
ASSIGN '(SAPLMR1M)YDRSEG[]' TO <fs1>.
ASSIGN (<fs1>) TO <fs2>.
IF <fs2> IS ASSIGNED.
* Set the "Blocking Reason: Price"
LOOP AT <fs2> ASSIGNING <fs_rseg>.
IF <fs_rseg>-kschl IS INITIAL.
<fs_rseg>-spgrp = 'X'.
ENDIF.
ENDLOOP.
ENDIF.
ENDIF.
Now, blocked items show on the MRBR report.But the problem is that the difference value is equal to 0 since unplanned costs are not taken into consideration, and when I run automatic release, these items are relaesed since the program considers this blocking as obsolete. Is there a way to change difference value of a price blocked items on the MRBR report? ie, what is the field to update on the invoice so that the calculation of the difference value takes the amount of unplanned costs into consideration?
Thank you in adavance for your help.