cancel
Showing results for 
Search instead for 
Did you mean: 

Use of DocKey@ in Crystal Reports

Former Member

Hello Experts;

I created a Crystal Report that uses a Command as follows:

SELECTT0.DocNumAS 'Sales Order Number'

-- , T0.DocEntry

-- , T1.DocEntry

-- , T2.BaseEntry

-- , T2.DocEntry

-- , T3.DocEntry

--, T0.CardCode
--, T0.CardName

, T1.ItemCodeAS 'Item Code'

-- , T2.ItemCode

, T1.DscriptionAS 'Description'
, T1.QuantityAS 'Order Quantity'

, T3.ShipToCodeAS 'Customer'
, T3.Address2AS 'Shipment Address'

, T2.ShipDate
, T3.DocNumAS 'Delivery Number'
, T3.TrackNoAS 'Tracking Number'
, T3.U_NPH_ShipmentETAAS 'Shipment ETA'
, T2.QuantityAS 'Shipment Quantity'
FROMORDR T0
LEFTJOINRDR1 T1 ON T1.DocEntry  = T0.DocEntry
LEFTJOINDLN1 T2 ON T2.BaseEntry= T1.DocEntry AND T2.ItemCode = T1.ItemCode
LEFTJOINODLN T3 ON T3.DocEntry= T2.DocEntry

WHERE T0.DocNum = {?DocKey@}

ORDER BY T0.CardCode, T3.Address2

The Crystal Reports version is 2008 and this particular report is imported into SAP Business One v8.82 as a layout with a document type of RDR2 -Order (Items).

When executed in Sales A/R ==>   Sales Order ==> Preview Layouts, the report shows but has no data on it.  Kindly advice what is wrong with this.

Thank you very much in Advance.

Warm Regards,

Noel

Accepted Solutions (1)

Accepted Solutions (1)

Former Member

You have T0.DocNum = {?DocKey@}, but the DocKey@ token reflects the current document's DocEntry. Change it to T0.DocEntry = {?DocKey@} and it should then work as you're expecting.

Former Member
0 Kudos

You are right Thomas.

I found it few minutes ago.  DocKey@ must be equated with the Primary key.  DocEntry is the primary key of ORDR table.

Thank you very much.

Noel

Answers (2)

Answers (2)

kothandaraman_nagarajan
Active Contributor
0 Kudos

Hi,

If you got answer, please close this thread.

Thanks & Regards,

Nagarajan

kothandaraman_nagarajan
Active Contributor
0 Kudos

Hi,

If you run above query in SAP B1 query generator, you can also find the problem before import crystal report.

Please close this thread by marking correct answer to Mr.Thomas.

Thanks & Regards,

Nagarajan


Former Member
0 Kudos

Thanks Nagarajan.

Warm Regards,

Noel