Skip to Content
Technical Articles
Author's profile photo Dominik Tylczynski

XREF1, XREF2, XREF3 in MIRO – the ultimate solution

Problem statement

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.

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:

 

Summary

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 cautious before making XREF3 directly editable and consider relevant SAP support notes.

Assigned Tags

      11 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Dan Goodhart
      Dan Goodhart

      Thank you for sharing the this brief but very descriptive solution to adding extra fields to the MIRO transaction.

       

      Dan Goodhart

      Author's profile photo S Abinath
      S Abinath

      Thanks for sharing its very useful content...

      Author's profile photo Marek Kamiński
      Marek Kamiński

      Hi Dominik, thank you for a very good and useful blog! I loved your blogs. I think that SAP should implement your solution as a standard e.g. within the SAP customer influence project. Good job! I must share your solution to the SAP support team in my company:)

      Thank you!

      Author's profile photo Zoey Pinto
      Zoey Pinto

      such a nice blog and so much information I got through your blog, thanks for sharing!!!

      Author's profile photo sidda sairam
      sidda sairam

      Hi Dominik,

      I have a scenario where in T/Code MIR7, before the user click on Stimulate option system has to validated Ref. key 3 should not be initial.

      I see the REF KEY3 field is available in RKBP table and the ref when I check from MIR7 using F1 is INVFO-XREF3.

      Please suggest on where to implement this validation..

      Author's profile photo KASIGARI SIVAIAH
      KASIGARI SIVAIAH

      Hi Dominik,

      In MIR7 transaction XREF1 & XREF2 fields are invisible after when i given the po number in line item and click on enter.

      please suggest the solution for this problem.

      Author's profile photo Dominik Tylczynski
      Dominik Tylczynski
      Blog Post Author

      Have you implemented all the enhancement described in the blog article above?

      Author's profile photo KASIGARI SIVAIAH
      KASIGARI SIVAIAH

      Yes all Enhancements are implemented. please refer to the screen shot.

      Author's profile photo Dominik Tylczynski
      Dominik Tylczynski
      Blog Post Author

      The XREF1, XREF2, XREF3 fields are made visible and editable on the "Details" tab by the following enhancement:

      Is it implemented in your system?

      Author's profile photo KASIGARI SIVAIAH
      KASIGARI SIVAIAH

      yes implemented in my system please refer attachment.

      Author's profile photo KASIGARI SIVAIAH
      KASIGARI SIVAIAH

      Implemented as blog content.