HELP! So confused on a report

MichaelleeMichaellee Member Posts: 65
Hi all,

I am a relative newbie to Navision development and would like some help on a report I am trying to write.

Basically, the question that was given to me was this:

"I need a report which shows me all Sales orders where the item on the sales order has a field set to X. I need some of the fields from the item card, sales order and purchase order in teh report and have an option to dump this info into excel."

Does this sound familiar?

I have pasted in the code I am using from the Sales Header but it seems that the SO info placed on the variable is not working....

Code:


SL.SETRANGE("Document No.",SH."No.");
IF SL.FIND('-') THEN
BEGIN
ITEM.SETRANGE("No.", SL."No.");
IF ITEM.FIND('-') THEN
BEGIN
IF ITEM."Prep/Live Order" <> ITEM."Prep/Live Order"::Prep THEN
CurrReport.SKIP
ELSE
BEGIN
StyleName := ITEM.Description;
CustStyleCode := ITEM."Customer/Style No.";
Cloth := ITEM."Hierarchy Desc 1";
SalesID := SH."No.";
CustDelDate := SH."Shipment Date";
Cust := SH."Sell-to Customer No.";
PL.SETRANGE("No.",ITEM."No.");
IF PL.FIND('-') THEN
BEGIN
PH.SETRANGE("No.",PL."Document No.");
IF PH.FIND ('-') THEN
BEGIN
Factory := PH."Buy-from Vendor No.";
FOBLanded := PH."Shipment Method Code";
END;
StyleRefNo :=PL."No.";
END;
END;
END;
END;

Many thanks for all help provided.

Michael

Answers

  • SavatageSavatage Member Posts: 7,142
    What information do you need from the Purchase & Sales header?

    Do you have report 10158 "Sales order Status"

    It's setup as
    Dataitems
    Item
    -Sales Line


    you can copy this report and add
    Dataitems
    Item
    -Sales Line
    -Purchase Line


    more info needed from you.
    FYI from the Sales Line you can go to the sale header
    item
    -Sales line
    --Sales Header

    Note the sales line has Document No. & Sell-to Cust No. that why i was asking what you need from the header

    I'm confused too :-k
    SL.SETRANGE("Document No.",SH."No.");
    
    8)
  • MichaelleeMichaellee Member Posts: 65
    The info I need are:

    PHeader:
    Buy from vendor
    shipment method code

    SHeader:
    No.
    Shipment Date
    Sell-to Customer No.

    Item:
    No.
    Description
    No. 2 (custom field)
    Hierarchy Description 1 (custom field)
    Cust/Style No. (custom field)

    EDIT: I am using Global variables, i.e SL = Record, Sales Line etc.

    Thanks for the help.

    Michael
  • SavatageSavatage Member Posts: 7,142
    The big questions is:

    You want to select an ITEM.
    Once that Item is selected you want to find out which sales & purchase orders they are on.

    am I warm here?

    & we're talking about sales header & purch header (Pre-Post)
    - not sales invoice header or purch invoice header (Post-Post)
  • MichaelleeMichaellee Member Posts: 65
    Hi all,

    I have solved this now and just want to thank you Savatage for your help. It was due to the SETRANGE not using the correct field to filter on.... doh!
Sign In or Register to comment.