Logistics invoice verification transactions like MIRO or MIR7 don’t cover the entire functionality of their FI counterparts like FB60 or FB01. That is confirmed by note 904652 – MIRO: Different from FB60 that reads:
MIRO is an independent Materials Management (MM) transaction that does not claim to be the same as the accounting transactions (such as FB60 or FB01). […]
For example, the following fields from the accounting document are not available in transaction MIRO (this list is not complete): […]
- Reference key (BSEG-XREF1, -XREF2, -XREF3)
The most annoying shortcoming is lack of reference keys in MIRO i.e. XREF1, XREF2, XREF3 fields.
The issue has been widely discussed on SAP Community pages and various blogs e.g.
- Make fields XREF1 XREF2 XREF3 on MIRO visible
- Activate MIRO Reference Key (Xref3) – Using Substitution and BADI Techniques
- Update BSEG-XREF1 from MIRO
Several solutions have been proposed. However none of them felt right to me, easy to implement and addressing the problem fully. So I’ve developed my own.
The ultimate solution
The solution consists of a simple ABAP enhancement that exhibits the fields on MIRO / MIR7 screen and couple of data dictionary enhancements to save the fields in a logistics invoice document and pass them to accounting documents.
Make the XREF1, XREF2, XREF3 editable in MIRO / MIR7
The following implicit enhancement at the end of MODIFY_FI_SCREEN form routine in LMR1MF6Q exhibits the fields on MIRO / MIR7 “Details” tab:
ENHANCEMENT 1 Z_MIRO_XREF3. "active version PERFORM modify_fi_subscreen TABLES t_acscr USING 'XREF3' 'ACTIVE' '1'. PERFORM modify_fi_subscreen TABLES t_acscr USING 'XREF2' 'ACTIVE' '1'. PERFORM modify_fi_subscreen TABLES t_acscr USING 'XREF1' 'ACTIVE' '1'. ENDENHANCEMENT.
My code looks as follows in the actual implementation:
Of course you don’t need to include all XREF* fields if you don’t need them. Adjust the enhancement to your needs.
The ABAP code enhancement gives you the access to the fields. However you’ll notice that only XREF3 will be saved to the logistics invoice document and then transferred to the accounting documents. Changes to XREF1 and XREF2 are not saved yet.
If you are only concerned about XREF3 field, you should skip the “Data dictionary enhancements” section and go directly to the “Summary”.
Data dictionary enhancements
To take over changes of XREF1 and XREF2, we need couple data dictionary enhancements. All of them are implemented with append structure technique.
Notice that you will get a warning during append structures activation as we are adding the fields without ZZ prefix. That is done on purpose!
Table RBKP enhancement
Create append structure to RBKP table with XREF1 and XREF2 fields:
Your RBKP table should look like this:
Structure ACMM_VENDOR_COMP enhancement
Create append structure to ACMM_VENDOR_COMP structure with XREF1 and XREF2 fields:
Your ACMM_VENDOR_COMP structure should look like this:
View RBKP_V enhancement
Create append structure to RBKP_V view with XREF1 and XREF2 fields:
Your RBKP_V view should look like this:
With the enhancements implemented XREF1, XREF2, XREF3 fields are editable in MIRO and MIR7 transactions:
The fields’ values are saved with the logistics invoice document when its hold, parked or saved and they are transferred to the accounting documents:
Be aware that XREF3 is used in several SAP standard functions. Therefore be cautions before making XREF3 directly editable and consider relevant SAP support notes.