teddybear
13th December 2012, 10:29
Hi,

We are on Baan Vc5 with Singale Logistics and Multi Finance environment.

I am working on a report script.

Given a range of items, I want to build a select statement that select all PO from tdpur400 where the Purchase Office (tdpur400.cofc) is belonging to the same Enterprise Unit as the item default warehouse.

I am thinking of using Enterprise Unit from tcemm but I have difficult as these tables are store in other company.

Any suggestion is appreciated.

Thank you.

mark_h
13th December 2012, 14:57
Never really tried to join tables across companies, but I think you can using the _compnr to to point to a table in another company. In the below query the user runs it in the production company and it pulls data from the simulated company. Both companies share the same VRC structure.


select sum(tipgc610.rqca):sum.hrs, tipgc610.orno, tipgc510.stat
from tipgc610, tirou001, tipgc510
where tipgc610.cwoc inrange :sub.from and :sub.to
and tipgc610.stdt < :past.due.date
and tipgc610.cwoc refers to tirou001
and tirou001.mnwc inrange :main.from and :main.to
and tipgc510._index1 = {tipgc610.ccot, tipgc610.orno}
and tipgc510.stat = tipgc.stat.simulated
and tipgc610._compnr = :simulated.comp
and tirou001._compnr = :simulated.comp
and tipgc510._compnr = :simulated.comp
group by tipgc610.orno, tipgc510.stat
selectdo


I think, but never tried(or at least not that I recall) I could do something like this:

select tisfc001.*, tiitm001.dsca
from tisfc001, tiitm001
where tisfc001.pdno >0
and tiitm001.item = tisfc001.mitm
and tiitm001._compnr = :simu.comp


You might be able to search this forum and find examples or threads on it.

teddybear
14th December 2012, 04:05
Hi Mark,

Thank you very much. Your solutions works.