cancel
Showing results for 
Search instead for 
Did you mean: 

Sales Order / Invoice Report

Former Member
0 Kudos

Hello All    

I am having troubles creating a sales order and sales invoice. For whatever reason I get duplicate records when adding "Dscription" from RDR1 to the report. The key shared between RDR1 and ORDR is "DocEntry" Unfortunately I do not have access until Friday however I would like to go into work (work experience) with a rough idea of what is going wrong.

Tables used are RDR1, ORDR, OCRD

Report contains fields from ORDR and OCRD such as CardName, DocNum, Date etc field from RDR1 is Dscription which seems to be causing the problem. I have been able to suppress the duplicates using a formula however I cannot figure out a way to sum distinct records there must be a simpler way.

Sorry for the brief question, I do work exp once a week and dont have much time to research on site

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Tried that Rafaee but it still returned duplicates. I think the reason behind this is that the Dscription could have 3 rows for a single DocEntry. I have another issue. I have moved on and am trying to do a basic Sales Order report but something is going wrong.

SELECT COUNT(DISTINCT T0.[DocNum]) AS 'Total Distinct Records Document Number' FROM  [dbo].[ORDR] T0

^^ SAP Query showing that total number of distinct docnum within ORDR = 9315

SELECT "ORDR"."DocNum"

FROM   "ACRODYNELIVE"."dbo"."ORDR" "ORDR"

^^ Crystal Query that also shows the total number or docnum being 9315

SELECT DISTINCT "OCRD"."CardCode", "ORDR"."DocNum", "ORDR"."DocDate", "ORDR"."VatSum", "ORDR"."DocTotal", "ORDR"."TotalExpns", "ORDR"."CardName"

FROM   "GENERIC"."dbo"."OCRD" "OCRD" INNER JOIN "GENERIC"."dbo"."ORDR" "ORDR" ON ("OCRD"."CardCode"="ORDR"."CardCode") AND ("OCRD"."CardName"="ORDR"."CardName")

Report I generate within Crystal. There must be something filtering records as only 7315 are appearing.

Any idea what is causing this?

Rafaee_Mustafa
Active Contributor
0 Kudos

Adam,

You want to say one doc have same item multiple time ?? Can you please share the top 10  results and a query you are executing ?

In which DB you are getting 9315 record is "ACRODYNELIVE" and which your are getting 7315 records is "GENERIC". Have you check this both DB have same records ??

Regards,

Rafaee M

Former Member
0 Kudos

Sorry I have made an error, i changed the name of the database to GENERIC as I didn't want to use the actual name. (pointless now)

Updated:

SELECT COUNT(DISTINCT T0.[DocNum]) AS 'Total Distinct Records Document Number' FROM  [dbo].[ORDR] T0

^^ SQL Query (9315)

SELECT "ORDR"."DocNum"

FROM   "GENERIC"."dbo"."ORDR" "ORDR

^^ Crystal Query (9315)

SELECT DISTINCT "OCRD"."CardCode", "ORDR"."DocNum", "ORDR"."DocDate", "ORDR"."VatSum", "ORDR"."DocTotal", "ORDR"."TotalExpns", "ORDR"."CardName"

FROM   "GENERIC"."dbo"."OCRD" "OCRD" INNER JOIN "GENERIC"."dbo"."ORDR" "ORDR" ON ("OCRD"."CardCode"="ORDR"."CardCode") AND ("OCRD"."CardName"="ORDR"."CardName")

^^ Report I want to generate with incorrect results. (7315)

Rafaee_Mustafa
Active Contributor
0 Kudos

Ok That's fine.

IF this is the full Query.  why you have used OCRD ?? AND why you have join CardName ?

Try with only

FROM   "GENERIC"."dbo"."OCRD" "OCRD" INNER JOIN "GENERIC"."dbo"."ORDR" "ORDR" ON ("OCRD"."CardCode"="ORDR"."CardCode")

abhilash_kumar
Active Contributor
0 Kudos

Hi Adam,

Check the Joins between the tables and see if that's causing the issue. Also, drag fields from all the tables to confirm if the records are really duplicate.

Just like you have suppress records when they're duplicate, there are ways to sum Distinct Records. Look for help on Running Totals in the CR designer.

-Abhilash

Rafaee_Mustafa
Active Contributor
0 Kudos

Hello Adam,

It would be great and easy if you paste your full query. And you can check is this the following joins in your query ?

ORDR INNER JOIN RDR1

ON ORDR.DocEntry = RDR1.DocEntry

INNER JOIN OCRD

ON ORDR.CardCode = OCRD.CardCode

Thanks.

Regards,

Rafaee M