cancel
Showing results for 
Search instead for 
Did you mean: 

Query for Bin wise stock on a given date

rajesh_khater
Active Participant
0 Kudos

Hi,

I am looking for a query with following output:

Item Code, Warehouse Name, Bin No., Stock on Hand

The query should accept a Date parameter and should return the stock position on that date by item, warehouse and bin.

Thanks.

Accepted Solutions (0)

Answers (2)

Answers (2)

KennedyT21
Active Contributor
0 Kudos

Hi Rajesh...

Try This

select t0.ItemCode , t5.ItemName,  t4.OnHandQty ,t2.BinCode, t2.sl1code, t2.SL2Code, t0.WhsCode

FROM  [dbo].[OITW] T0  left  JOIN [dbo].[OITM] T1  ON  T1.[ItemCode] = T0.[ItemCode] 

inner join OIBQ t4 on t0.ItemCode = t4.ItemCode and T0.WhsCode = t4.WhsCode

left JOIN [dbo].[OITW] T3  ON  T3.ItemCode = T0.ItemCode

inner  JOIN [dbo].[OBIN] T2  ON  t2.AbsEntry = t3.dftbinabs

inner join OITM t5 on t0.ItemCode = t5.ItemCode

WHERE T2.[SL1Code] Between '[%0]' AND '[%1]'

order by t2.sl1code, t2.SL2Code, t0.ItemCode

Rgds

rajesh_khater
Active Participant
0 Kudos

Hi Kennedy,

You have mentioned 4 tables in your query:

OITW, OITM, OBIN, OIBQ

OITM is for Item Master, and OBIN is for BIN master, I suppose

Can you briefly explain the other tables are for what?

Moreover how will this query give me the bin wise stock on a given date? Where is the date parameter, and where is the posting date of the document being referred in the query?

Thanks.

Former Member
0 Kudos

Hi Rajesh

OITW is for warehouse

OIBQ is for Item - Bin Accumulator

You need all these tables to fetch bin level quantity by warehouse.

Regards,

Chintan

KennedyT21
Active Contributor
0 Kudos

Ignore my previous post..

Former Member
0 Kudos

Hi Rajesh,

Check below link. It may achieve your requirement.

http://www.scn.sap.com/thread/3451574

Regards,

Chintan

rajesh_khater
Active Participant
0 Kudos

The link is not working

Former Member
0 Kudos

Hi,

Check now.

http://scn.sap.com/thread/3451574

Regards,

Cnintan

rajesh_khater
Active Participant
0 Kudos

That link does not give any information regarding what I am looking for.

Can you post the SQL query which will give me the desired result?

Can someone tell me which table contains the Bin Allocation data in the marketing documents or the Inventory documents, and how that table is linked to the main document header table which contains the Posting Date?

Thanks.