Skip to Content

Substitution in MIRO

Jul 26, 2017 at 08:57 AM


avatar image

Hi experts,

I am working on this substitution that aims to substitute the bseg-sgtxt to rbkp-sgtxt.

I add a line-item substitution using TCode OBBH and then in program ZRGGBS00 I build up a exit. It all works well, but when I use MIRO and debug I find that there is no data in table BSEG and BKPF.

Down below is the code I use in the exit. The table BSEG and BKPF is almost totally blank. bkpf-awkey is pretty weird, it only contains the gjahr like this: ' 2017'. And bseg-belnr is like this: '$ 1'.

Could anyone please tell me what the hell is wrong with this? Any help will be appreciated. Thanks!

  CHECK sy-tcode = 'MIRO' AND bseg-hkont = '0022211001'.

  IF bkpf-awkey IS NOT INITIAL.

    i_belnr = bkpf-awkey+0(10).

    i_gjahr = bkpf-awkey+10(4).

    SELECT SINGLE sgtxt INTO i_text

           FROM rbkp

           WHERE belnr = i_belnr

             AND gjahr = i_gjahr.

    IF i_text NE space.

      bseg-sgtxt = i_text.


10 |10000 characters needed characters left characters exceeded

Usually '$1' will be stored when document is not yet created. May be the field 'AWKEY' is not updated at the time of your checking.

* Please Login or Register to Answer, Follow or Comment.

2 Answers

Best Answer
Raymond Giuseppi
Jul 26, 2017 at 10:08 AM

At which level did you set the substitution? In either case, the database will not yet be committed so do not read invoice from database.

You could export some data in a MIRO BAdI like INVOICE_UPDATE and then import it in the substitution exit (or some implementation of a BAdI like AC_DOCUMENT).

Show 3 Share
10 |10000 characters needed characters left characters exceeded

Thanks for your advice.

I find INVOICE_UPDATE in MR1M but I'm not sure how to export data from the badi, its a standard program so to change it I need access key. Could you plz guide me how to export data from the badi and import data in the exit form? Thanks!


INVOICE_UPDATE is a BAdI (tr. SE18) -> Create an implementation with transaction SE19 and a custom class to implement it, no sscr key.


Problem solved thanks to your advice. Many thanks!

Pablo Casamayor Jul 26, 2017 at 09:27 AM


what about BTE SAMPLE_PROCESS_00001120?

Best regards,


Show 2 Share
10 |10000 characters needed characters left characters exceeded

there are multiple alternatives ...(even a substitution):


substitution item level

Best regards,



Hi Pablo, tried your advice but finally solved the problem with Raymond's advice.

BTE seems don't work very well in this case's situation, but still, thank you very much!