Visibility Of Other Company Data

Dear All, I wish to know various approaches of access to other companies inventory data within same database. The requirement is " I receive an order and I dont have the finished good, Next I want to see item’s availability in other companies within the same database so that an intercompany transfer can be done" Any ideas are highly appreciated.

You can use the function CHANGECOMPANY to access data from other companies in the same database. If you only read data from other companies, you shouldn’t have any issues. CalcQtyOtherCompanies(ItemNo : Code[20]) Qty : Decimal // This function will return the Total Qty On Hand in all other companies for a given Item No. // Using Company table 2000000006 Company.SETFILTER(Name, '<>%1', COMPANYNAME); // All companies, except the current IF NOT Company.FIND('-') THEN EXIT(0); Qty := 0; REPEAT Item.CHANGECOMPANY(Company.Name); IF Item.GET(ItemNo) THEN BEGIN // Here, we could filter on variants, location, etc. Item.CALCFIELDS(Inventory); Qty := Qty + Item.Inventory; // can enhance to consider items on P.O, Sales Order, etc. END; UNTIL Company.NEXT = 0; EXIT(Qty); However, if you want to write transactions into other companies, you have to be VERY CAREFUL. Please search this forum on the keywork CHANGECOMPANY.

David, I was under the impression that what you recommend does not work – especially in the case of flowfields. The CHANGECOMPANY works fine for the Item rec, but when the Inventory FlowField’s CalcFormula is run, no such CHANGECOMPANY occurs on the Item Ledger Entries being summed. The result is that the Inventory quantity calculated comes from the base company each time… Am I wrong?

My apologies, David – I just tried your code in v3.60A and v4.00 and it seems to work just fine… My bad – I think I picked up my (mis)impression from other posts on CHANGECOMPANY here – but then didn’t test. Shame on me!

Hi, I would try to use a “global item ledger entry table”, where the primay key is a code (or faster int) for the Company plus the entry no. of the “local” item ledger entry. C22 should be modified with some lines of code , that all “local” item ledger entries are copied to the “global” item ledger entry table. With this modifications it should be possible to see inventory from other companies. May be it will be necessary to make “global value entries” too. Best regards, /Karl

I was also doubtful about calculating flowfields in other companies, since we know a VALIDATE would use other tables in the current company. That’s why I wrote this piece of code to test it. After testing, it seems that flowfields are giving accurate results, even after calling a CHANGECOMPANY on a record.

quote:

My apologies, David – I just tried your code in v3.60A and v4.00 and it seems to work just fine… My bad – I think I picked up my (mis)impression from other posts on CHANGECOMPANY here – but then didn’t test. Shame on me!
Originally posted by fbrande - 2004 Dec 22 : 14:19:27