Getting Document lines based on Document No.

Hi,

I have a Document Page Like

If I select Cust No. I need to filter the Invoices which belongs to that Cust No.

Then I need to select more than one invoice. I need to get all the lines of selected Invoices in the Sub page.

I’m able to filter the invoices , but I’m not able to get the lines in the sub page. please help me.

Thanks in advance.

See how page Account Schedule (104) works with G/L Account List (18) (Getselectedfilter function). I suggest to remove subpage and use only a page Like 104

You will have to write code to fulfill this requirement OR you may improvise standard functionality as suggested by Marco.

Check the Standard functionality ‘Copy Document’. You can get an idea.

Hello Srikanth,

Create a duplicate table for sales invoice line.

Try to write a code in Onlookup and Onvalidate trigger to insert that document no. lines to the duplicate table every time.

if you dont want to store lines in duplicate table clear the values before inserting.

Thank You
Mahesh U

hi,
i am a trainee Nav Devoloper and i need your help.

i do have to use the same function to use the logic of copy/past to copy lines from an existing Program Order to a new created one.

in this case :

  • I created the function on the Page Program order Card.
  • i created a Report because when i click on the function in the page i want to see a field “program No.” which i created in the request page from the report to be able to give an existing Program order No or to select one from the program order list.
  • I created a codeunit for my code and i want to call it from the function trigger in the page program order card.

i have the code but i dont know if its correct.

------CODEUNIT : i created a function calls “CopyProgramLineNew” :------------------------------------

ProgOrderLine.RESET;
ProgOrderLine.SETRANGE(“Program No.”, ProgOrderLineP.“No.”);
IF ProgOrderLine.FINDSET THEN REPEAT
ProgOrderLineP.INIT;
ToProgOrderLine := FromProgOrderLine;
ProgOrderLineP.TRANSFERFIELDS(ProgOrderLine);
ProgOrderLineP.“Program No.” := SalesProgramHeader.“No.”;
ProgOrderLineP.VALIDATE(Type, ProgOrderLine.Type);
ProgOrderLineP.VALIDATE(“No.”, ProgOrderLine.“Program No.”);
IF ProgOrderLineP.INSERT(TRUE) THEN ;
UNTIL ProgOrderLine.NEXT = 0;
EXIT(TRUE);

------REPORT : On the LOOKUP of the “Program No.” field i put : -----------------------------------------------------------

FromSalesProgramHeader.RESET;
FromSalesProgramHeader.SETRANGE(“No.”,ToSalesProgramHeader.“No.”);
IF FromSalesProgramHeader.FINDSET THEN BEGIN
IF PAGE.RUNMODAL(50452,ToSalesProgramHeader) = ACTION::LookupOK THEN
CopyOrderProgramLines := ToSalesProgramHeader.“No.”;
END;

please help, i cant fix it.
thank you and best reagards.