‎2022 Nov 09 11:38 AM
Hi,
I am trying to build a query to see the last order date for each customer in our system (along with the contact details for each customer file). All active and inactive customers. Currently the only way I am able to remotely get close to what I need is for it to show every invoice ever placed by each customer and I can get rid of duplicates in Excel but it doesn't leave me with the most recent doc date. I have also tried to set the doc date range to look at certain time periods of activity but that doesn't exclude customers who are more recently active. I have tried to use the Group By function but it goes into error every time. This is what I have so far, but need to just have the most recent doc per customer.
SELECT T1.[DocDate], T0.[CardCode], T0.[CardName], T0.[CntctPrsn], T0.[E_Mail], T0.[MailCountr], T0.[State2], T0.[MailCity], T0.[validFor], T0.[frozenFrom], T0.[FrozenComm] FROM OCRD T0 INNER JOIN INV1 T1 ON T0.[CardCode] = T1.[BaseCard]
I'm sure I'm missing something obvious but I'm not overly familiar with running these reports. Any help would be appreciated. Thank you.
‎2022 Nov 09 11:38 AM
Hi gbry404,
Welcome to the SAP Community! Thank you for visiting us to get answers to your questions.
Since you're asking a question here for the first time, I'd like to offer some friendly advice on how to get the most out of your community membership and experience.
First, please see https://community.sap.com/resources/questions-and-answers, as this resource page provides tips for preparing questions that draw responses from our members. Secondly, feel free to take our Q&A tutorial at https://developers.sap.com/tutorials/community-qa.html as well, as that will help you when submitting questions to the community.
Second, if you're interested in connecting with community members, please pay a visit to our new Welcome Corner. You'll need to sign up, but it's a great way to interact with peers and get to know other experts!
Third Check the Welcome Corner thread with advice from our champions: https://groups.community.sap.com/t5/welcome-corner-discussions/advice-from-sap-champions-questions-a...
Finally, I recommend that you include a profile picture. By personalizing your profile, you encourage readers to respond: https://developers.sap.com/tutorials/community-profile.html.
I hope you find this advice useful, and we're happy to have you as part of SAP Community!
Regards,
Dedi