Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

MIRO/MRBR difference value

tecsap_tec
Explorer
0 Kudos


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.

2 REPLIES 2

former_member182371
Active Contributor
0 Kudos

Hi,

have you checked what is inside '(SAPLMR1M)YDRSEG-CO[]' ?

Best regards.

raymond_giuseppi
Active Contributor
0 Kudos

Did you try following BAdIs

  • MRM_RELEASE_CHECK (*) to remove your blocked invoices from listy of invoice to release
  • MRM_BLOCKREASON_DELETE_CUST to block/unblock items with your criteria

Regards,

Raymond

(*) Read first 1156325 - BAdIs in the Logistics Invoice Verification environment