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 generaton

former_member765243
Discoverer
0 Likes
934
  • SAP Managed Tags

I need a query to get sales-return of all customers. For this I use the following query that shows no result

SELECT T0.[CardCode], sum(T0.[DocTotal]-T1.[DocTotal]) FROM OINV T0 INNER JOIN ORIN T1 ON T0.[DocEntry] = T1.[AnnInvDecR] WHERE T0.[CANCELED] ='n' AND T1.[CANCELED] = 'n' GROUP BY T0.[CardCode]

Then I change it to the following, it shows wrong result

SELECT T0.[CardCode], sum(T0.[DocTotal]-T1.[DocTotal]) FROM OINV T0 INNER JOIN ORIN T1 ON T0.[CardCode] = T1.[CardCode] WHERE T0.[CANCELED] ='n' AND T1.[CANCELED] = 'n' GROUP BY T0.[CardCode]

Please suggest the correction.

3 REPLIES 3
Read only

former_member688242
Participant
0 Likes
840
  • SAP Managed Tags

please share structure of table ORIN and OINV and foreign key relationship between these table Also pleasw specify sales-return data type.

relationship between table(ORIN and OINV) is one to one or realationship between table(ORIN and OINV) is one to many

Read only

former_member765243
Discoverer
0 Likes
840
  • SAP Managed Tags

Its all about SAP B1. For "Sales return" we are using "A/R Credit memo".

Read only

former_member688242
Participant
0 Likes
840
  • SAP Managed Tags

I don’t have access to bi system.please share details mentioned above