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: 

BAdI or User Exit for changing document type of accounting document

Former Member
0 Kudos
4,490

Hello,
During MIGO or MIRO transaction, an accounting document is created (table

BKPF & ACCIT) with a certain document type (field BLART) and I need to change this type to 'ZB' for some of them.

I've already tried without success:

- BAdI FAGL_SET_SEGMENT => changes on document type doesn't work

- BAdI AC_DOCUMENT => no access to document type

- Some user exit (don't remember)

I've looked at those question without success:

https://archive.sap.com/discussions/thread/1037784

https://archive.sap.com/discussions/thread/1245157 (no answer...)

https://archive.sap.com/discussions/thread/1103081 (not triggered by MIGO)


I have no problem using two user exit (one for MIGO, one for MIRO), but for the moment I didn't found anything working for MIGO.

Regards,
William Mateille

4 REPLIES 4

raymond_giuseppi
Active Contributor
0 Kudos
1,423

Did you consider a substitution rule (tr. OBBH)

0 Kudos
1,423

I didn't know OBBH was a thing, I'm looking into it thanks.

0 Kudos
1,423

For the mods, I don't have any "reply" button, I tried to edit my last comment but I can't (clicking on submit don't do anything). I'm on IE maybe that is the problem but I can't use another browser, I have only the possibility to "share", "accept" or "alert moderator" for a comment.
Is there something I'm doing wrong ?

Anyway, I want to answer that to Raymond: "By creating a substitution rule I must associate an exit because I need to make this substitution only if the purchasing group of the document is in a custom table. But this does only report the problem, now which exit can I use ? If I create one, will my code be executed each time I go through MIGO & MIRO, or it depends on the exit ?"

Sorry for the unconvenience...

0 Kudos
1,423

Put a condition in OBBH, e.g. BKPF-AWTYP = 'MKPF' OR BKPF-AWTYP = 'RMRP' then execute the substitution if code required in an User Exit defined in the Substitution/Validation/Rules, it will be called if and only if MIGO OR MIRO transactions, or related BAPI, are executed.