ltannous
11th February 2005, 23:17
How can I get the inventory sum of an item alll companies to display on my session form.

grajenda
12th February 2005, 05:54
First of all make sure that you have permission to all those companies
then write a query like below

select tdinv001.stoc
from tdinv001
where tdinv001._compnr in {101,102,103}
selectdo
sum.qty = sum.qty + tdinv001.stoc
endselect

Assumptions :
1) You have 3 companies 101,102,103 and
2) Item code should be same in all the companies
3) All the companies should be at the same package combination level(may not be must)

regards,

ltannous
14th February 2005, 17:31
I tried it with comp1 =210 , comp2 = 250 but that doesnt work in the code above.
How can I get it to work using these variables

mark_h
14th February 2005, 18:01
Search this forum for wherebind - you should be able to use this in the query instead of hard coding the company number.

Mark

grajenda
15th February 2005, 05:42
Hi itannnous
Change the code as follows

select tdinv001.stoc
from tdinv001
where (tdinv001._compnr = :comp1
or tdinv001._compnr = :comp2)
and tdinv001.item = something

selectdo
sum.qty = sum.qty + tdinv001.stoc
endselect

Assume that comp1 and comp2 are variables which are having the values of company nos

ltannous
15th February 2005, 22:28
Thanks for your help. It works now