Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

QUERY JUST DISPLAYS ONE ITEM GROUP CODE

Former Member
0 Likes
725
  • SAP Managed Tags

I initially wanted to create a query to search existing orders containing specific items using their brand and model, unfortunately, when I tried to execute what I've created, it only displayed one item group code - WHEELS. I need to see ALL items regardless of the item group code.

Please see the code I created below. Please help me find out what's wrong. Thank you very much!

SELECT T2.[DocNum], T2.[CardCode], T2.[CardName], T2.[CreateDate], T2.[DocStatus], T2.[U_OrderStatus], T1.[Quantity], T1.[Dscription], T0.[ItmsGrpCod], T0.[U_Brand], T0.[U_Model],T0.[ItemCode], T0.[U_Pcd], T1.[U_Pcd] as "Drill PCD", T1.[U_Offset] as "Mach Offset", T0.[U_WheelSize], T0.[U_WheelColourDesc], T0.[U_TyreSize], T2.U_Comments, T2.[U_CustomerName], T2.[U_ReceiverPhone], T2.[U_ReceiverEmail], T2.[U_Make], T2.[U_Model], T2.[U_Year], T3.ZipCodeS

FROM OITM T0 INNER JOIN RDR1 T1 ON T0.[ItemCode] = T1.[ItemCode] INNER JOIN ORDR T2 ON T1.[DocEntry] = T2.[DocEntry] INNER JOIN RDR12 T3 ON T1.[DocEntry] = T3.[DocEntry]

WHERE ((t1.DocDate >= '[%0]' or '[%0]'='') and (t1.DocDate <= '[%1]' OR '[%1]'=''))

AND (T2.[CardName] like '%[%2]%' OR '%[%2]%' IS NULL) AND (T0.[U_Model] like '%[%3]%' OR '%[%3]%' IS NULL) AND (T0.[U_Brand] like '%[%4]%' OR '%[%4]%' IS NULL) AND (T2.[U_OrderStatus] like '%[%5]%' OR '%[%5]%' IS NULL) AND (T0.[ItemCode] like '%[%6]%' OR '%[%6]%' IS NULL) AND (T1.[Dscription] like '%[%7]%' OR '%[%7]%' IS NULL) AND (T0.[U_Pcd] like '%[%8]%' OR '%[%8]%' IS NULL) AND (T0.[U_WheelSize] like '%[%9]%' OR '%[%9]%' IS NULL)

I initially wanted to create a query to search existing orders containing specific items using their brand and model, unfortunately, when I tried to execute what I've created, it only displayed one item group code - WHEELS. I need to see ALL items regardless of the item group code.

Please see the code I created below. Please help me find out what's wrong. Thank you very much!

SELECT T2.[DocNum], T2.[CardCode], T2.[CardName], T2.[CreateDate], T2.[DocStatus], T2.[U_OrderStatus], T1.[Quantity], T1.[Dscription], T0.[ItmsGrpCod], T0.[U_Brand], T0.[U_Model],T0.[ItemCode], T0.[U_Pcd], T1.[U_Pcd] as "Drill PCD", T1.[U_Offset] as "Mach Offset", T0.[U_WheelSize], T0.[U_WheelColourDesc], T0.[U_TyreSize], T2.U_Comments, T2.[U_CustomerName], T2.[U_ReceiverPhone], T2.[U_ReceiverEmail], T2.[U_Make], T2.[U_Model], T2.[U_Year], T3.ZipCodeS

FROM OITM T0 INNER JOIN RDR1 T1 ON T0.[ItemCode] = T1.[ItemCode] INNER JOIN ORDR T2 ON T1.[DocEntry] = T2.[DocEntry] INNER JOIN RDR12 T3 ON T1.[DocEntry] = T3.[DocEntry]

WHERE ((t1.DocDate >= '[%0]' or '[%0]'='') and (t1.DocDate <= '[%1]' OR '[%1]'=''))

AND (T2.[CardName] like '%[%2]%' OR '%[%2]%' IS NULL) AND (T0.[U_Model] like '%[%3]%' OR '%[%3]%' IS NULL) AND (T0.[U_Brand] like '%[%4]%' OR '%[%4]%' IS NULL) AND (T2.[U_OrderStatus] like '%[%5]%' OR '%[%5]%' IS NULL) AND (T0.[ItemCode] like '%[%6]%' OR '%[%6]%' IS NULL) AND (T1.[Dscription] like '%[%7]%' OR '%[%7]%' IS NULL) AND (T0.[U_Pcd] like '%[%8]%' OR '%[%8]%' IS NULL) AND (T0.[U_WheelSize] like '%[%9]%' OR '%[%9]%' IS NULL)

1 REPLY 1
Read only

lenastodal
Product and Topic Expert
Product and Topic Expert
0 Likes
676
  • SAP Managed Tags

Hi and welcome to the SAP Community!

Thank you for visiting SAP Community to get answers to your questions. Since you're asking a question here for the first time, I recommend that you familiarize yourself with https://community.sap.com/resources/questions-and-answers (if you haven't already), as it provides tips for preparing questions that draw responses from our members. For example, you can outline what steps you took to find answers (and why they weren't helpful) and share screenshots of what you've seen/done. The more details you provide, the more likely it is that members will be able to assist you.
Should you wish, you can revise your question by selecting Actions, then Edit (although once someone answers your question, you'll lose the ability to edit the question -- but if that happens, you can leave more details in a comment).

Finally, if you're hoping to connect with readers, please consider adding a picture to your profile as it encourages readers to respond to you. Here's how you do it: https://www.youtube.com/watch?v=F5JdUbyjfMA&list=PLpQebylHrdh5s3gwy-h6RtymfDpoz3vDS.

Best,
Lena
SAP Community Moderator


Join or subscribe to SAP Community Groups to stay up-to-date, including SAP TechEd Group.