Skip to Content

MIRO Document to have different number ranges for a particular document type

Oct 31, 2017 at 07:37 AM


avatar image
Former Member

Hi ,

I have a requirement to have a different MIRO document number series for a particular PO document Type.

The rest of the MIRO document can be posted in the current running series.

Is it possible to have a z Table with SM30 Authorization with the following columns


And in the MIRO standard program modify the BADI Invoice_update to pick the number range from the Z table when the particular PO Type ( with a distinct series) is entered and at the time of saving the MIRO to use number range from this table.



10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
avatar image
Former Member Oct 31, 2017 at 08:23 AM

Hi Kumaresh,

Check this note 1156325

Definition name: INVOICE_UPDATE

Usage: The BAdI 'INVOICE_UPDATE' was only designed to execute checks during document entry or document posting in transaction MIRO.

Therefore, it has only import parameters. There are no export parameters. This means that the data changed in the BAdI is not processed further in the standard program MIRO. More information Note that no system messages can be sent in the methods. The method CHANGE_AT_SAVE is an exception. A system message can be issued in this method if the exception ERROR_WITH_MESSAGE is triggered at the same time. DO NOT ENTER THE STATEMENTS "COMMIT-WORK" or "ROLLBACK" SINCE THIS CAN CAUSE DATA INCONSISTENCIES ON THE DATABASE. ____________________________________________________

I think you can try this user exit LMR1M003 for MIRO number range. Check note 452127.


Show 5 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Thanks KK,

For your reply.

This user exit LMR1M003 will work ? I can understand this is the user exit which is used for MIRO Document Number Ranges.

My client requirement is the on going MIRO number ranges will continue as usual. but only for one particular PO document type I need to have a different MIRO number series which has to be reset every year.

That is the reason why I am having the SM30 Table creation with the following parameters Year , From Range and To Range.

But my concern is whether this user exit will work to implement this logic whenever the particular PO Type (eg PO -AB) is used I need to have the number ranges picked from the Ztable and post the MIRO document with that series

Former Member

Hi Kumaresh,

User exit LMR1M003 will work. You need to come out the logic and get the abaper for coding.

  1. In the user exit,You can get the PO number from MMCR_TDRSEG-EBELN.
  2. With PO Number. Get the PO number range no from table NRIV, Object name = EINKBELEG
  3. Then get the PO type from table T161 with PO Number Range No from step 2.

So now. Write the logic to check if PO type = AB then get different MIRO number range from NRIV, object name = RE_BELEG

The Standard number range for RE_BELEG can be by year. So, i don't think you need a ztable for MIRO number ranges.


Former Member

Hi KK, Thanks for your valuable inputs.

In my case the documen type for MIRO will be RE always and this RE is already having a number range which also should not be disturbed and that number range will be used will posting the MIRO with other Purchase order where PO type is not equivalent to AB.

So that is the reason I am using a ztable to take the number ranges for MIRO document which is going to be posted with Purchase order = AB

Former Member

Hi Kumaresh,

You can explain your requirement and show my logic above to your abaper. Why i said you no need a z table this is because you can configure different LIV number range via OMRJ. These LIV number ranges will be stored in table NRIV, object number = RE_BELEG. If you check this table it is there is year there.

The concept is when user key-in the PO number in MIRO, there is no PO type info so,

Option 1: You can retrieve the PO type info from table NRIV, object name = EINKBELEG and table T161 or

Option 2: Retrieve the PO type info from table EKKO.

With the PO type value now. Check If PO type = AB then only overdrive the MIRO number range by picking the desired number range no from table NRIV, object name = RE_BELEG. For PO type <> AB, system won't override teh MIRO number range no. You configure MIRO number range via OMRJ. This MIRO number range is stored in table NRIV, object name = RE_BELEG. This table already has year there. So, i believe no need to has a Z table.

Example in this table there are 2 records: 01 for 1 series and 02 for 2 series. Only PO type = AB will pick the number range no 02, the rest pick 01.

This is just the high level idea. You need abaper to do the coding. During testing you may hit unexpected error. But no worry, you can further enhance the logic to eliminate the error.

Former Member

Thanks KK for your valuable contribution

It worked