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: 

Substitution in MIRO

Former Member
0 Kudos

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.

    ENDIF.

  ENDIF.
1 ACCEPTED SOLUTION

raymond_giuseppi
Active Contributor

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).

9 REPLIES 9

satyapriyanka_vana
Active Participant
0 Kudos

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.

former_member182371
Active Contributor
0 Kudos

Hi,

what about BTE SAMPLE_PROCESS_00001120?

Best regards,

Pablo

0 Kudos

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

e.g.

substitution item level

Best regards,

Pablo

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!

raymond_giuseppi
Active Contributor

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).

0 Kudos

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!

0 Kudos

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!

0 Kudos

Dear All,

We had a similar required from business that, all the line items being posted (whether emerging from Finance or other modules) should have Profit Center (PRCTR) updated before posting in the General Ledgers. We tried many methods, but value from suggested approaches wasn't parsing into final tables!

Then we found a Function Module "FAGL_VALIDATE"; wherein by an enhancement we were able to substitute PRCTR and also post in the GL. Further to ensure none of the line items go w/o PRCTR we also added validation at 2 separate places, using BADI_ACC_DOCUMENT and RGGBR000.

Hope this helps others as well.