Skip to Content

SAP B1 Query Issue "Must Specify Table to Select From"

Hello,

Can any one help with the query bellow. My SQL is not very strong and I'm wanting to to have a user input variable where '51-6300' currently sits in the below statement, however when I try to use the standard [%0] SAP B1 input variable I get an error "Must specify table to select from"

SELECT
T0.DocEntry, T0.[DocNum], T0.[CardCode], T0.[CardName], T1.[ItemCode], T1.[Dscription], T1.[Quantity], T1.[OpenQty], T1.[TreeType], T1.[ShipDate]'ESD', T0.[DocDate]'Date Ordered',
CASE WHEN T1.TreeType='I' THEN (Select (Select top 1 ItemCode from RDR1 T3 where T3.docentry = T0.DocEntry and T3.TreeType = 'S' group by T3.ItemCode, T3.Visorder
Having Max(T3.Visorder) < T1.Visorder Order by T3.VisOrder desc))
ELSE T1.[ItemCode] END AS BOM 
FROM ORDR T0 INNER JOIN RDR1 T1 ON T0.DocEntry = T1.DocEntry
WHERE T1.[ItemCode]='51-6300' AND T1.[LineStatus] ='O' 
ORDER BY T1.[ItemCode], T0.[DocDate] 
Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

0 Answers

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.