Relate purchase header to sales line (Simple!)

amadman114amadman114 Member Posts: 36
Howdy,

I'm quite new to Navision, and I'd like to know how to find the sales line(s) that's related to the selected purchase header. I'm pretty sure you can do this with some simple SetRanges, but I can't see the trail.

I have found a subform that does this, which uses the following SetTableView:
SORTING(Document Type,Document No.,Line No.) ORDER(Descending) WHERE(Document Type=CONST(Order),Type=CONST(Item),Outstanding Quantity=FILTER(<>0))

However I don't really see how this works!

Thanks,
Dan

Comments

  • eyolfthoeyolftho Member Posts: 18
    SalesLine.setfilter("Purchase Order No.",<purchase order no.>);
    SalesLine.setrange("Document Type",SalesLine."Document Type"::Order);
    SalesLine.setrange("Type",SalesLine."Type"::item);
    SalesLine.setfilter("Outstanding Quantity",'<>0');
  • amadman114amadman114 Member Posts: 36
    This is the same as the code that I had.
    However, it returns the following error:
    There's no Sales Line within the filter.
    Filters: Document Type: Order, Type: Item, Outstanding Quantity <>0, Purchase Order No.: PO0038630

    I've just been informed that this is because the PO No. in this table is for Direct Ship POs.

    There must be another way
  • FDickschatFDickschat Member Posts: 380
    A link from PO line to SO line only exists for drop shipments or for so called special orders (in general: where a 1:1 direct link exists between a SO line and a PO line). In all other cases (POs to replenish stock) no link exists.

    What are you expecting?
    Frank Dickschat
    FD Consulting
Sign In or Register to comment.