Post multiple Line in One shot

navuser1
Member Posts: 1,334
Dear Sir,
I have created multiple Lines thru code & now I want to Post the same in a Single Shot thru code itself.
How to Do it ?
Code given below for your review.
The above code posts only the First Line. What is the issue in the above code.
Kindly reply.
Regards,
navuser1
I have created multiple Lines thru code & now I want to Post the same in a Single Shot thru code itself.
How to Do it ?
Code given below for your review.
IF RecordAVR.FINDSET THEN REPEAT GenJnlLine2.INIT .... .... .... UNTIL RecordVAR.NEXT =0; CODEUNIT.RUN(CODEUNIT::"Gen. Jnl.-Post Line", GenJnlLine2); //GenJnlLine2 has multiple Lines
The above code posts only the First Line. What is the issue in the above code.
Kindly reply.
Regards,
navuser1
Now or Never
0
Answers
-
C12 Gen. Jnl.-Post Line posts only one line. You need to call it inside the loop, or you need to call C13 Gen. Jnl.-Post BatchSlawek Guzek
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-030 -
Take a look how C90 uses GenJnlPostLine.0
-
If your loop consist GenJnlLine2.INSERT; you have to use Gen. Jnl.-Post Batch and all lines will be posted as one transaction.
You can use loop without GenJnlLine2.INSERT; (and without Template, Batch and Line No.) and post line by line. This approach can be used only if each line has Account and Balance Account part.0 -
Slawek_Guzek wrote: »C12 Gen. Jnl.-Post Line posts only one line. You need to call it inside the loop, or you need to call C13 Gen. Jnl.-Post Batch
Thanks for your reply.
If I call Gen. Jnl.-Post Line Codeunit within the loop, then it generates different "Transaction No." in the G/L Entry for the same Document No.
My goal is to achieve the single "Transaction No." for the multiple Gen. Journal Lines where all have the same "Document No."Now or Never0 -
If your loop consist GenJnlLine2.INSERT; you have to use Gen. Jnl.-Post Batch and all lines will be posted as one transaction.
Thanks for your reply. I will follow this one first then back to you.You can use loop without GenJnlLine2.INSERT; (and without Template, Batch and Line No.) and post line by line. This approach can be used only if each line has Account and Balance Account part.
Every Line is balanced ( Balancing Account is given in every Line)
Now or Never0 -
The Lines which going to be posted are given below (as a Scenario)...
Now or Never0
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