07-26-2017 9:57 AM
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.
07-26-2017 11: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).
07-26-2017 10:19 AM
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.
07-26-2017 10:27 AM
07-26-2017 12:03 PM
there are multiple alternatives ...(even a substitution):
e.g.
Best regards,
Pablo
08-03-2017 8:49 AM
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!
07-26-2017 11: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).
07-26-2017 11:54 AM
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!
07-26-2017 1:42 PM
INVOICE_UPDATE is a BAdI (tr. SE18) -> Create an implementation with transaction SE19 and a custom class to implement it, no sscr key.
08-03-2017 8:47 AM
10-04-2021 10:03 AM
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.