Skip to main content

Notifications

Microsoft Dynamics GP (Archived)

Creation of AP Voucher and batch through Code

Posted on by 1,195

I have a custom module, in which I can create a transaction and then Post to AP.

This "Post to AP" process should create a Voucher in AP module in work tables and a AP batch in which this voucher can saved.

Can any one help me on the scripts/procedures which can be used to create AP batches and vouchers by passing required parameters to the scripts.

*This post is locked for comments

  • soma Profile Picture
    soma 24,406 on at
    RE: Creation of AP Voucher and batch through Code

    I know taPMTransactionInsert this is the original Stored Procedure for creating PM transactions. But, most of them using the SP with suffix of "pre" . Each eConnect SP also has pre and post procedure. We can also use this SP to create transaction in GP. Anyway happy to hear for your problem solved.

    All the best.

  • Verified answer
    Manjunath Vemula Profile Picture
    Manjunath Vemula 1,195 on at
    RE: Creation of AP Voucher and batch through Code

    Thanks Soma, for your quick and detailed responses.

    The Procedure to be used is "taPMTransactionInsert" but not "taPMTransactionInsertPre".

    With the SP "taPMTransactionInsert", I am able to insert records in to PM Work tables.

    Appreciate your quick help and responses.

    Thanks for your time.

    Regards,

    Manjunath V

  • soma Profile Picture
    soma 24,406 on at
    RE: Creation of AP Voucher and batch through Code

    Follow below steps to create the script log file. 

    1. Locate the Dex.ini file. this file is located the under Data folder of your GP installation location.

    2. Open the Dex.ini file by using Notepad, and then add the following line:
      ScriptDebugger=TRUE
    3. Start Microsoft Dynamics GP. When you are logged on, the new Debug option appears at the right side of the toolbar.
    4. Open Payables Transaction Entry window.
    5. Click Debug, and then click LogScripts. You are prompted for the location in which you want the Script.log file to be created.
    6. Enter a new transaction and click save button.
    7. Click Debug on the toolbar, and then select LogScripts to turn off the Script.log file.

    Hope this helps!!!

  • soma Profile Picture
    soma 24,406 on at
    RE: Creation of AP Voucher and batch through Code

    In Dexterity, we have other option for creating the PM vouchers in work table. The option is calling Dexterity procedure/function. First we need to identify the what all are the procedures/functions used for creating AP vouchers in GP. Already I have tried this way to created the AP vouchers in open tables. For open records(Posted records), dexterity has a common function. So, I have used this function to create the AP vouchers in Open table. For work table, I don't about the exact procedures/functions.

    To identify the procedure/functions, you can use script debugger to find the same.

    Hope this helps!!!

  • soma Profile Picture
    soma 24,406 on at
    RE: Creation of AP Voucher and batch through Code

    Can you show us the dexterity script for calling the Stored Procedure "taPMTransactionInsertPre"?

  • Manjunath Vemula Profile Picture
    Manjunath Vemula 1,195 on at
    RE: Creation of AP Voucher and batch through Code

    I had used above mentioned  Procedures but I am unable to create records in PM work tables.

  • Manjunath Vemula Profile Picture
    Manjunath Vemula 1,195 on at
    RE: Creation of AP Voucher and batch through Code

    Hi Nataraj and Soma,

    Thanks for your suggestions.

    I cannot use Econnect in my current case.

    Any other ways to get his done?

  • soma Profile Picture
    soma 24,406 on at
    RE: Creation of AP Voucher and batch through Code

    An addition to the above Nataraj suggestion. You can create Payables Transaction with work status with help of eConnect Stored Procedures. The below are the SQL stored procedures used for creating Payables Transactions.

    taPMTransactionInsertPre - used to create Payables Transactions(Invoice, credit memo, finance charge, misc charge and return) with work status.

    taPMTransactionTaxInsertPre - used to create above Payables Transactions with custom tax details.

    taPMDistributionPre -  used to create above Payables Transactions with custom distribution accounts.

    For your case, if you want to create Payables Transactions(Vouchers) with default distribution accounts and tax details, use the SQL stored procedure taPMTransactionInsertPre.

    To identify the parameters for this procedure, go to SSMS and expand the company database--> Progarammability-->Stored Procedures then right click the stored procedure taPMTransactionInsertPre and select Script Stored Procedures As-->Create To-->New Query Editor Window.

    Hope this helps!!!

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Creation of AP Voucher and batch through Code

    Hi Manjunath,

    you can call the eConnect sql procedures such as

    taPMTransactionInsertPre/taPMTransactionTaxInsertPost.sql in your custom module/screen button by passing required fields to above sql procedures .

    note: eConnect needs to be installed.

  • Manjunath Vemula Profile Picture
    Manjunath Vemula 1,195 on at
    RE: Creation of AP Voucher and batch through Code

    Thanks for providing solution through econnect.

    I am looking for creation of AP Batch and Voucher through Dex Code. Where I have a custom module, In which I want to Post my transaction to AP.

    So once user click on "Post to AP" button in the custom screen, I want to call the dex procs or functions to create the records in SY00500 and PM work tables.

    It would be great if you can suggest me on this.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,240 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,104 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans