Hi Form, I have a rather puzzling problem. I have been asked by a client to show the Sell To Name and But From Name on the GL Entries table so they can see who the Customer or Vendor was when they drill down on the GL Accounts. I have got this to work pefectly for Sales but only 50% working for Purchases.
My Problem is that when I post a Purchase 4 G/L entries are generated. Two show the Vendor Name on the new field I created but two of them dont. The two that dont show the Vendor name have a Source Code of INVTPCOST which is the Post Inventory Costs to G/L. My questions is…where on earth is this code that is creating these 2 entries. I have looked in CU90 but cannot find it and I have looked in CU12 to no avail. Does anyone know where the code is that creates these entries so that I can amend it.
I hope someone knows…Paul [:(]
All inventory postings goes through
22 Item Jnl.-Post Line
Thank you Phenomenon, that solved it completely, just have to figure out how to get the Purchase Header Buy-from Name in to it but thats the easy bit (I think). The funny thing is Ive amended CU22 before with Thomas’s help but had forgotten about it.
It all depends on which level do you want to modify posted item entries.
CU22, Post inventory lines (ILE’s, Value entries…)
CU5802 checks what account schema will be used in posting to G/L (and creates and run CU12, post GenJnlLine).
IN CU22, there is Function:
PostInventoryToGL(VAR ValueEntry : Record "Value Entry")
WITH ValueEntry DO BEGIN
IF (NOT "Expected Cost") AND ("Entry Type" = "Entry Type"::"Direct Cost") AND
("Item Charge No." = '')
BalanceInterimPostToGL("Posting Date","Item Ledger Entry No.");
IF InvtPost.BufferInvtPosting(ValueEntry) THEN
Here, InvtPost is, CU5802, which means:
First, Cu22 does all inventory stuff (what should be posted, amounts, ILEs, VEs) and than it runs CU5802 which manage g/l accounts, and he runs CU12 to post lines to G/L).
You could of course have the information delivered into the G/L Entry tables by making the extra field a flow-field; sourcing the data from diferent tables depending upon the Source Type, Source No, Document No or other.
Basically there is no need to write code to do this. Definitely you should not be modifying the posting routines for this.
(I think Jonathan was hinting to this, but not sure).
What you do is create two flow field in the Gl entry table these will be lookup fields, to a primary key, so will not have any significant performance issues involved. The fields should look at the Customer ledger entry and Vendor ledger entry, and get the customer and vendor numbers for the entries. Then use those codes for another flow field to find the customer/vendor name. If you want to make it a bit cleaner, you can put a bit of code in the GL Entry table to do all this, but both ways work.
No matter what, the couple of lookups onthe flow fields will have far less performance impact than adding 30 byte text fields to the GL entry table.
I have done this quite a lot, and it works very nicely, if you need more help, just holler.