Create a payment through page service in NAV 2013 R2
DeepakNair
Member Posts: 6
I am trying to integrate my system with the NAV to read the vendor ledger entries for invoices and process the payment outside the NAV. The problem that i am facing is, after reading the invoices from ledger entries table and making the payments against those invoices through my system, i want to update the payment details back to the NAV which I coudn't identify a way so far. So to summarize, i am looking a way to update the payment information in NAV, possibly through API(page web services) or by any means. I have got a vague idea, that it has to be through the payment journals but i am not very sure. Any help on this issue is much appreciated.
0
Comments
-
You need to publish Payment Journal page as web service (basically adding it in Web Service table) and insert a record through it filling the proper field, including Applies-to Doc. Type and Applies-to Doc. No. which allow to post the application between the payment and the invoice.* Daniele Rebussi * | * Rebu NAV Diary *0
-
Thanks for the reply.
So as you say, if i need to update the payment details, i need to make an entry in the payment journal table for the corresponding Document No. In that case, similar to the manual updation process of the payments through UI, we might need to post the payment journal entry as well, after which the record will be moved to vendor ledger entries table as a doc.type Payment.If this is the case, then how can we post a payment journal through web services.
Hope my understanding about the process is right, otherwise please do explain the correct process.0 -
Hi, if also the posting has to be done via web service, I suggest to use a different approach and develop a new codeunit to be exposed as WS.
A function called by your system, accepting all the necessary parameters, will perform:
- Insert of a record in Gen. Journal Line table (this method allows you also to do additional checks on value accuracy).
- Call of Gen. Jnl.-Post Batch codeunit to post the line .* Daniele Rebussi * | * Rebu NAV Diary *0 -
Hi Daniele, thanks again, i think i am kind of reaching close to the solution, need few more clarifications from your side.
As you have suggested to use code unit service for inserting Journal Line and to post the line, I am seeing two code units already available with the demo version which are
1.Gen. Jnl.-Post Line
2.Gen. Jnl.-Post Batch
So, can i use these code units to post the line and the batch ?0 -
Yes, it's possible to use Gen. Jnl.-Post Line codeunit (sorry, I meant this one in my previous post) to post the line, but you cannot expose this codeunit as web service since it receives a record variable as parameter and this is not a type of interface allowed.
Anyway as said before you can include a call to this codeunit inside a "wrapping" object which can be used by an external systems.* Daniele Rebussi * | * Rebu NAV Diary *0 -
So you mean by "wrapping" object, is to create a code unit accepting all the parameters for inserting a payment journal through the Gen. Jnl.-Post Line CU and once the line is created, then call the Gen. Jnl.-Post Batch CU to post the journal line entry.
Please let me know if my understanding is correct.
If this is the case, which are the functions that has to be called from the respective code units to Insert as well as posting the line.
Appreciate your patience in answering my questions.0 -
You just have to call the codeunit passing the journal record filled with the payment data. Here's a very rough example:
OBJECT Codeunit 50000 VendorPaymentWS { OBJECT-PROPERTIES { Date=04/28/14; Time=[ 3:46:13 PM]; Modified=Yes; Version List=; } PROPERTIES { OnRun=BEGIN END; } CODE { PROCEDURE CreateAndPostPayment@1000000000(pVendorNo@1000000000 : Code[20];pPaymAmount@1000000001 : Decimal;pPostingDate@1000000002 : Date;pDocNo@1000000003 : Code[20];pApplToDocType@1000000007 : ' ,Payment,Invoice,Credit Memo,Finance Charge Memo,Reminder,Refund';pApplToDocNo@1000000008 : Code[20]); VAR GenJnlLine@1000000004 : Record 81; LineNo@1000000005 : Integer; GenJnlPostLine@1000000006 : Codeunit 12; BEGIN GenJnlLine.SETRANGE("Journal Template Name",'PAYMENT'); GenJnlLine.SETRANGE("Journal Batch Name",'GENERAL'); IF GenJnlLine.FINDLAST THEN LineNo := GenJnlLine."Line No." + 10000 ELSE LineNo := 10000; GenJnlLine.INIT; GenJnlLine."Journal Template Name" := 'PAYMENT'; //Fill with journal used for payments GenJnlLine."Journal Batch Name" := 'GENERAL'; //Fill with journal used for payments GenJnlLine."Line No." := LineNo; GenJnlLine.VALIDATE("Account Type",GenJnlLine."Account Type"::Vendor); GenJnlLine.VALIDATE("Account No.",pVendorNo); GenJnlLine.VALIDATE(Amount,pPaymAmount); GenJnlLine.VALIDATE("Posting Date",pPostingDate); GenJnlLine.VALIDATE("Document No.",pDocNo); GenJnlLine.VALIDATE("Bal. Account Type",GenJnlLine."Bal. Account Type"::"Bank Account"); //Fill an appropriate bal. account GenJnlLine.VALIDATE("Bal. Account No.",'001'); //Fill an appropriate bal. account GenJnlLine.VALIDATE("Applies-to Doc. Type",pApplToDocType); GenJnlLine.VALIDATE("Applies-to Doc. No.",pApplToDocNo); GenJnlLine.INSERT; GenJnlPostLine.RUN(GenJnlLine); END; BEGIN END. } }* Daniele Rebussi * | * Rebu NAV Diary *0 -
That rough one will surely help me , especially being a newbie to NAV and to C/AL language.

But the problem is I dont have the permissions to create a code unit, this i figured out is for the developers license, after going through the forums .
Here i was just wondering if i need a developer's license for just creating one code unit, or is there any other options available in the terms of license.
If there are no other options, what would be the minimum version needed to create a single codeunit in NAV?0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K 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
- 328 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
