The MM/FI interface has a very useful table with extreme powerful possibilities to change the FI-Document during creation.
I had in several projects the demand to have a flexible method obtaining the Recon.Account at invoice posting. The SAP-Standard picks only the account from Vendor master data but has no functionality to change this as you can do it with FI-Documents manually.
Let us have a look into Table TRWPR. The table contains a list of Function Blocks preparing and changing data of the new FI-Document.
The FB AC_DOCUMENT_CREATE uses this table to prepare the FI Document. This table provides an interface for any functionality you want to implement.
- Create a new FB with the same interface like FI_DOCUMENT_CHECK
- make a new entry (DOCUMENT / CHECK / FI) in Table TRWPR with a number beginning from 900 and put your new FB here (you might copy the FI_DOCUMENT_CHECK record and change the number to any number between 900 and 999.
Your FB will be called at creation of the FI-Document. Table T_ACCIT contails the FI-Document positions to be created.
Here you find a short example simulated with the debugger:
I start with transaction MIRO and had set a breakpoint before into LRWCLF01/Form Document_Create line 499.
Posting the document stops at the break-point now.
Here you see the first line of the FI-Document to be created. With your own FB now you can manipulate any field here and that’s the right place to change the reconciliation account.
Here I changed the SAKNR and HKONT field to the new reconciliation account 1332116000 manually with the debugger. In the final solution your program code will do that.
The resulting document has now the replaced account instead of the original account from master data.
Please be very carefully when you manipulate data. You can screw up your system very easy and it is your responsibility when you manipulate data here.
Best regards =;-) Bernhard