cancel
Showing results for 
Search instead for 
Did you mean: 

Shipped vs Lead Time Query

RahF
Participant
0 Kudos

Hello Experts

I have written a query to check for order that have been shipped against lead time

When I use only one card code to check with a date range, it works

but as soon as I added it to check a range of card code with a date range, it didn't work and I don't get any results

Where am I going wrong?

Please help

SELECT 
T0.[DocNum] as 'Sales Order No', 
T0.[CardName] as 'Sales Partner', 
T0.[NumAtCard] as 'Cust Ord No', 
T1.[U_Prod_Order_No] as 'Prodn Ord No', 
T1.[ItemCode] as 'Stock Code', 
T1.[Dscription] as 'Stock Description', 
T1.[Quantity], 
T1.[U_DelDate] as 'Lead Time', 
T1.[ShipDate] as 'Actual Delivery Date' 

FROM ORDR T0  INNER JOIN RDR1 T1 ON T0.[DocEntry] = T1.[DocEntry] 

WHERE 
T0.[CardCode] =[%0] AND 
T0.[CardCode] =[%1] AND 
T0.[DocStatus] = 'c' AND  
T0.[DocStatus]  !=  'L' AND   
T1.[ShipDate]  >=[%2] AND   
T1.[ShipDate]  <=[%3] 

ORDER BY T1.[ShipDate]

Thanks and Regards

Rahul

Accepted Solutions (1)

Accepted Solutions (1)

former_member185682
Active Contributor
0 Kudos

Hi Rahul,

For a range of Cardcode, you need use >= for the first Cardcode parameter and <= for the second Cardcode parameter, like you did with date range.

T0.[Cardcode] >= [%0] AND T0.[Cardcode] <= [%1]

Kind Regards,
Diego Lother
RahF
Participant
0 Kudos

Hi Diego

Now I am embarrassed. That was a stupid mistake and Ishould have picked it up

Thanks for that

Rahul

RahF
Participant
0 Kudos

Hi Diego

Could you please help me with the below.

The query results in SAP display the result with the date in 16.01.2017 (dot) format, how do i get the query to display the result with the date as 16/01/2017 (Slashes)?

SELECT 
T0.[DocNum] as 'Sales Order No', 
T0.[CardName] as 'Sales Partner', 
T0.[NumAtCard] as 'Cust Ord No', 
T1.[U_Prod_Order_No] as 'Prodn Ord No', 
T1.[ItemCode] as 'Stock Code', 
T1.[Dscription] as 'Stock Description', 
T1.[Quantity], 

--(In the below two date fields SAP date format is 12.01.2017, how do I change it to display with slashes instead of dots 12/01/2017 in the query results)
T1.[U_DelDate] as 'Lead Time', 
T1.[ShipDate] as 'Actual Delivery Date' 

FROM ORDR T0  INNER JOIN RDR1 T1 ON T0.[DocEntry] = T1.[DocEntry] 

WHERE 
T0.[Cardcode] >= [%0] AND 
T0.[Cardcode] <= [%1] AND
T0.[DocStatus] = 'C' AND  
T0.[DocStatus]  != 'L' AND   
T1.[ShipDate]  >=[%2] AND   
T1.[ShipDate]  <=[%3] 

ORDER BY T1.[ShipDate]

Thanks

Rahul

former_member185682
Active Contributor
0 Kudos

Hi Rahul,

I answered in your original post.

Kind Regards,

Diego Lother

Answers (0)