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

SAP Query with Date Range

Former Member
0 Likes
3,926
  • SAP Managed Tags

Hi! I am new to the query generator. How do I create a summary of all issue for production rows (IGE1) with posting date range? I tried using the query wizard, but I cannot seem to add the filter for posting date range. Thanks.

1 ACCEPTED SOLUTION
Read only

mgregur
Active Contributor
0 Likes
3,625
  • SAP Managed Tags

Hi,

the reason you cannot find the filter is because the date itself is saved in the header table (OIGE). You need to join those two tables:

SELECT *
FROM IGE1 T0
INNER JOIN OIGE T1 ON T0."DocEntry" = T1."DocEntry"
WHERE T1."DocDate" > [%0] AND  T1."DocDate" <= [%1]

BR,

Matija

Hi! I am new to the query generator. How do I create a summary of all issue for production rows (IGE1) with posting date range? I tried using the query wizard, but I cannot seem to add the filter for posting date range. Thanks.

6 REPLIES 6
Read only

former_member30
Product and Topic Expert
Product and Topic Expert
0 Likes
3,625
  • 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. Here's how you do it: https://www.youtube.com/watch?v=F5JdUbyjfMA&list=PLpQebylHrdh5s3gwy-h6RtymfDpoz3vDS. By personalizing your profile with a photo of you, you encourage readers to respond.

Cheers,

Julia SAP Community Moderator

Read only

mgregur
Active Contributor
0 Likes
3,626
  • SAP Managed Tags

Hi,

the reason you cannot find the filter is because the date itself is saved in the header table (OIGE). You need to join those two tables:

SELECT *
FROM IGE1 T0
INNER JOIN OIGE T1 ON T0."DocEntry" = T1."DocEntry"
WHERE T1."DocDate" > [%0] AND  T1."DocDate" <= [%1]

BR,

Matija

Read only

Former Member
0 Likes
3,625
  • SAP Managed Tags

Hi Matija,

Thank you! It works. 🙂 Can you also help me figure out how I can add the header details of OIGE, specifically the document number?

Read only

mgregur
Active Contributor
0 Likes
3,625
  • SAP Managed Tags

Hi,

Document Number is OIGE."DocNum" so just add it to your select.

BR,

Matija

Read only

Former Member
0 Likes
3,625
  • SAP Managed Tags

Thank you, Matija! It works.

Read only

Former Member
0 Likes
3,625
  • SAP Managed Tags

I have a simple query for that.

SELECT T1.[ItemCode], T1.[Dscription], SUM(T1.[Quantity]) FROM OIGE T0 INNER JOIN IGE1 T1 ON T0.[DocEntry] = T1.[DocEntry] WHERE T0.[DocDate] BETWEEN [%0] AND [%1] GROUP BY T1.[ItemCode], T1.[Dscription], T1.[Quantity] ORDER BY T1.[ItemCode]