Skip to Content

Find target ODLN given ORDR

Given an ORDR number (either the DocNum or DocEntry) how do I find the corresponding ODLN document? Where is the relationship defined?

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Feb 21 at 02:58 AM

    Hello Will,

    If you would like to find the relationship from the UI, you can try the "Relationship Map" function. You can get to a graphical diagram by right-clicking on a Sales Order then choosing "Relationship Map" from the menu.

    If you want the SQL way of finding this relationship between two types of documents, you may have to look from the line level tables (RDR1 and DLN1 in your case). There will be some "Target Entry", "Baseline" and "Target Type" columns from the line level table used for stored the relationship.

    SELECT DISTINCT

    RDR1.DocEntry as 'Sales Order Doc',

    DLN1.DocEntry as 'Delivery Doc'

    FROM

    RDR1 LEFT JOIN DLN1 ON

    RDR1.TrgetEntry = DLN1.DocEntry and RDR1.LineNum= DLN1.BaseLine and RDR1.TargetType = 15 and RDR1.itemcode=DLN1.itemcode

    WHERE RDR1.DocEntry = 'the sales order given'

    *Please note that the approaches mentioned above are based on a condition that the documents are created by the "Copy from" or "Copy to" method. For example, your Delivery is created using the "Copy From" based on a Sales Order, or from the Sales Order, you use the "Copy To" button to create the Delivery. If a Delivery is created manually from scratch, the relationship to a Sales Order will not be there.

    Hope this helps.

    Jimmy

    Add comment
    10|10000 characters needed characters exceeded