Gen. Journal Line "Line No."

Amaraa
Member Posts: 153
Hello,
I wanted to write to table 81 from other form. How can I assign the "Line No." same as the AutoSplitKey property in the form?
Any ideas appreciated,
Amaraa
I wanted to write to table 81 from other form. How can I assign the "Line No." same as the AutoSplitKey property in the form?
Any ideas appreciated,
Amaraa
0
Answers
-
Did you tried it in some way? There is only one way: assign the correct no. through code... but Your description of what you want to do is too generic to give you more info...0
-
You basically need to filter on the table you want to "write" to. See if a line no exisits using "find". If so then increment the line no to the next line no.
I've written a little code to automatically write a new line to the end of a purchase order if paid by credit card. Just focus on the setrange , find & "line no;" := "line no." + 10000;IF Status = Status::Open THEN BEGIN "Vendor Invoice No." := "No."+'-PAID'; MODIFY; CALCFIELDS("Amount Including Tax"); InvSetup.GET; Purchline.RESET; Purchline.SETRANGE(Purchline."Document Type","Document Type"); Purchline.SETRANGE(Purchline."Document No.","No."); IF Purchline.FIND('+') THEN BEGIN Purchline."Line No." := Purchline."Line No."+ 10000; Purchline.VALIDATE(Purchline."Qty. Rcd. Not Invoiced",0); Purchline.VALIDATE(Purchline."Quantity Received",0); Purchline.Type := Purchline.Type::"Account (G/L)"; Purchline.VALIDATE(Purchline."No.",InvSetup."Inventory Account (G/L)"); Purchline.VALIDATE(Purchline.Quantity,1); Purchline.VALIDATE(Purchline."Direct Unit Cost",("InvLine Amount" * -1)); Purchline.INSERT; END; END ELSE BEGIN MESSAGE('Purchase Order %1 must be open!',"No."); END;
Take it from there..Let us know if you don't understand.0 -
Savatage wrote:You basically need to filter on the table you want to "write" to. See if a line no exisits using "find". If so then increment the line no to the next line no.
I've written a little code to automatically write a new line to the end of a purchase order if paid by credit card. Just focus on the setrange , find & "line no;" := "line no." + 10000;IF Status = Status::Open THEN BEGIN "Vendor Invoice No." := "No."+'-PAID'; MODIFY; CALCFIELDS("Amount Including Tax"); InvSetup.GET; Purchline.RESET; Purchline.SETRANGE(Purchline."Document Type","Document Type"); Purchline.SETRANGE(Purchline."Document No.","No."); IF Purchline.FIND('+') THEN BEGIN Purchline."Line No." := Purchline."Line No."+ 10000; Purchline.VALIDATE(Purchline."Qty. Rcd. Not Invoiced",0); Purchline.VALIDATE(Purchline."Quantity Received",0); Purchline.Type := Purchline.Type::"Account (G/L)"; Purchline.VALIDATE(Purchline."No.",InvSetup."Inventory Account (G/L)"); Purchline.VALIDATE(Purchline.Quantity,1); Purchline.VALIDATE(Purchline."Direct Unit Cost",("InvLine Amount" * -1)); Purchline.INSERT; END; END ELSE BEGIN MESSAGE('Purchase Order %1 must be open!',"No."); END;
Take it from there..Let us know if you don't understand.0 -
I have also benefited from this post, many thanks.0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions