Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics GP (Archived)

Payment Stuck in Work status but yet fully applied to an Open Invoice- PURGATORY

Posted on by Microsoft Employee

I have a payment that is still showing on the aging trial balance and historical trial balance. I am having trouble moving a payment document to history or removing it from its attached documents. I have attempted to VOID the invoice and credit memo but I obtain the “document cannot be voided, it has been partially applied or is on hold” message. None of the documents are on hold. From my understanding, an invoice should stay in open status until a payment is applied and posted, but this is not the case. A payment was applied but is not posted as if its in purgatory. The Invoice is also stuck in open status while claiming its been fully applied.

Problem:

Invoice of                            $10, INV123

Credit Memo of                $22, where $8 is applied to invoice INV123 and remaining $12 is partially applied to different posted invoices.

Payment of        $2, applied to Invoice INV123

 

At this point, the Invoice is showing as if its posted but not fully applied in OPEN status.

The credit memo is showing as if its posted but not fully applied in OPEN status.

The payment is fully applied, but still showing that it’s unposted in WORK status.

 

  1. I have also tried removing the $2 payment from the WORK and OPEN tables, ran check links, which removed the payment from the aging report but not the historical aging report.
  2. Since the $10 Invoice is still in open status, I tried re-creating a new $2payment to re-apply, but its showing that its fully applied even though its missing $2. I’m guessing this is because the prior stuck $2 payment is in purgatory land, where its not posted but is applied and cannot be voided (I’m confused).

What is another approach in resolving this?

Is there a way to push the manual payment from WORK to HISTORY? Or completely drop it from GP. This way its not outstanding on the Historical trial balance.

*This post is locked for comments

  • L Vail Profile Picture
    L Vail 65,271 on at
    RE: Manual Payment Stuck in Work status but yet fully applied to an Open Invoice- PURGATORY

    I found something else that might help you:

    This isn’t for the feint-hearted, but I had a client with a stuck payment that they couldn’t get ‘unattached’ from a document that was still in the open table. They needed that payment gone and the invoice opened back up so that they could pay it properly and clean up the books.

    My goal was to delete anything related to the stuck payments (they had two different problem children). Since I couldn’t be sure exactly which tables were affected, I searched the whole database to make sure I found all of the transactions wherever they landed. For instance, you may have records in a third-party module like Mekorma. I searched on both the document number and the voucher number of the payments and the invoice they were trying to pay. What follows are the steps I went through to find and delete the stuck payments.

    1. Once you are ready to apply your solution to production, everyone should log out of the production company and stay logged out until you’re finished. You can take the company offline if you want, but that’s not usually acceptable unless it’s absolutely necessary, like if you cannot perform your fix while anyone is logged in.

    2. In preparation, I backed up production and restored the data into a test company. This is the MOST IMPORTANT task in the entire process. (the backing up and testing the restore).

    3. After the backup, I searched all of the tables in the database for the following using the stored proc ‘spSearchOnAllDB’. I’ve included the text to create the proc and give credit to it’s authors at the end of this post.

       a. The Voucher number of the invoice.

       b. The Document number of the invoice.

       c. The Voucher number of the payment.

       d. The Document number of the payment.

    4. Next, I looked through the results of my search and deleted any record that I knew didn't have anything to do with my transaction(s). For example, if some record in a SOP table had a Master Number that matched one of my search values. It's pretty easy to scan down the search results and pick out the ones that don't relate. If you don’t know, don't delete it. You’ll discover the answer later.

    5. I ended up with a total of 41 tables that included relevant records. I copied the results to a new Excel spreadsheet. I converted the columns that would be copied over to Text. I changed them to Text so that Excel wouldn't truncate any of my values.

    6. Next, I used Excel to build a select statement that would return the table and column that contained my search values. Then I evaluated the tables to weed out irrelevant records. Some of the tables will be listed more than once if both documents are referred to in the same table. For example, if you have a record in the Apply table, you will get two hits on the same record because each search value shows up in a single record, just in different fields.

    7. I evaluated the results of my select statement and determined which records needed to be deleted or adjusted. Some of them were fine, like the general ledger transaction resulting from posting the invoice. Remember - my goal was to delete all records related to the stuck payment.

    8. My evaluation resulted in 22 records that needed to be deleted or adjusted and 18 records that were fine.

    9. I went back to my Excel spreadsheet and created a ‘delete’ query for those records needing to be deleted, and an ‘update’ statement for the records that just needed to be changed.

    10. I searched the database again to confirm the results were what I expected.

    11. In the end, only 9 unique tables were affected. I needed to delete or adjust 22 records, but they were all in just 9 tables. My client did not have any third-party modules.

    12. I then launched GP and ran Reconcile and Check Links on the modules that included any of my 9 tables. In my case, it was Finnancial and Purchasing. If your database is small enough you could run it on everything. I like to do that, but it takes too long on a large database. Run Check Links until it returns no errors.

    13. Now was the moment of truth. I went the Edit Check Batch window in Purchasing and selected the invoices impacted by stuck payments; I needed to make sure they were free to be paid. Success!

    14. I backed up my test company.

    15. I refreshed my test company with the production database once more and went through the process again.

    16. I compared the first test company’s dataset totals to the current test company’s database to make sure the data was still correct. I just compare totals in the data tables rather than print reports. It’s WAY faster than printing a bunch of reports, and it’s easier to check more tables this way.

    17. It worked again, so I moved to production and went through process on production.

    18. I compared the production dataset to the test company’s to confirm that the data was correct.

    19. Success again!

    20. I then backed up both the Test company and the Production company databases.

    21. Done!

    Arguably, I could have just restored my completed test company over production, but I don’t like doing that. It’s common for clients to be very unhappy if they are locked out of production. They swear they will only print reports and run inquires – but that’s a promise that is often forgotten by somebody.

    If I do this at night or over the weekend, I’d lock them out. That way, if somebody did try to log in they wouldn’t be able to. Don’t forget that the datasets might not be equal if an errant transaction was entered. It’s relatively easy to track down what was done, and it’s a step you have to take if your test totals do not match.

    Like Harry Lee says “it’s better to take time than chances”.

    That’s it. I’ve had to do this several times over the last 20 years, and now I’m sharing it with you all. Enjoy!

    Kind regards,

    Leslie

    /*************************************************************************/

    /*         Procedure of search of a phrase on all database               */

    /*            Originally developed by Oufimtsev Gleb, MCSE               */

    /*                                                                       */

    /*            Updated by David Musgrave, Microsoft                       */

    /*            from feedback from Eduardo Barbosa & Marc K                */

    /*                                                                       */

    /*            Last Modified: 26-Jul-2013                                 */

    /*                                                                       */

    /*  Search for spSearchOnAllDB at http://aka.ms/Dev4DynGP for more info  */

    /*                                                                       */

    /*************************************************************************/

    if exists (select * from sysobjects where id = object_id('dbo.spSearchOnAllDB') )

    drop procedure dbo.spSearchOnAllDB

    GO

    CREATE PROCEDURE spSearchOnAllDB @phrase varchar(8000), @OutFullRecords bit = 0 AS

    /*

      To apply sp:

         exec  spSearchOnAllDB 'Sugar%'

         exec  spSearchOnAllDB '%soft%'

         exec  spSearchOnAllDB '_5234_57%', 1

         exec  spSearchOnAllDB M_cro_oft

    */

    declare @sql varchar(8000)

    declare @tbl varchar(128)

    declare @col varchar(128)

    declare @id_present bit

    declare @is_char_phrase bit

    declare @min_len int

    declare @loop_idx int

    declare @loop_chr char(1)

    set nocount on

    if IsNull(@phrase, '') = '' begin

    raiserror('Phrase is absent', 16, -1)

    return

    end

    -- Handle Quotes passed in the search string

    set @phrase = replace(@phrase, '''', '''''')

    select @loop_idx = 1, @is_char_phrase = 0, @min_len = 0

    while @loop_idx <= LEN(@phrase) begin

    set @loop_chr = SUBSTRING(@phrase, @loop_idx,1)

    if @loop_chr not in ('%', '_')

    set @min_len = @min_len + 1

    if @is_char_phrase = 0 and @loop_chr not in ('%', '_', '0', '1', '2', '3', '4', '5',

    '6', '7', '8', '9', '.')  

    set @is_char_phrase = 1

    set @loop_idx = @loop_idx + 1

    end

    create table #tbl_res

    (TableName varchar(128) not NULL,

    ColumnName varchar(128) not NULL,

    Id int NULL,

    ColumnValue varchar(7500) not NULL)

    create table #tbl_res2

    (TableName varchar(128) not NULL,

    ColumnName varchar(128) not NULL,

    Id int NULL,

    ColumnValue varchar(7500) not NULL)

    declare CRR cursor local fast_forward for

    select t.name, c.name, 1

    from sysobjects t, syscolumns c

    where t.type = 'U'

    and c.id = t.id

    and c.status&0x80 = 0 -- Not IDENTITY

    and exists (select * from syscolumns c2 where t.id = c2.id and c2.status&0x80 = 0x80

    and c2.xtype in (48, 52, 56))

    and (  (@is_char_phrase = 1 and c.xtype in (175, 239, 99, 231, 35, 167) and c.length

    >= @min_len) -- char only

    or (@is_char_phrase = 0 and c.xtype not in (34, 165, 173, 189, 61, 58, 36)))

    -- char and numeric

    union

    select t.name, c.name, 0

    from sysobjects t, syscolumns c

    where t.type = 'U'

    and c.id = t.id

    and not exists (select * from syscolumns c2 where t.id=c2.id and c2.status&0x80 =

    0x80 and c2.xtype in (48, 52, 56))

    and (  (@is_char_phrase = 1 and c.xtype in (175, 239, 99, 231, 35, 167) and c.length

    >= @min_len) -- char only

    or (@is_char_phrase = 0 and c.xtype not in (34, 165, 173, 189, 61, 58, 36)))

    -- char and numeric

    order by 1, 2

    open CRR

    fetch CRR into @tbl, @col, @id_present

    while @@FETCH_STATUS = 0 begin

    if @OutFullRecords = 0 begin

    set @sql = 'insert into #tbl_res (TableName, ColumnName, Id, ColumnValue) '

    + 'select ''[' + @tbl + ']'', ''[' + @col + ']'', '

    if @id_present = 1

    set @sql = @sql + 'IDENTITYCOL, '

    else

    set @sql = @sql + 'NULL, '

    set @sql = @sql + 'convert(varchar(7500), [' + @col + ']) '

    + 'from [' + @tbl + '] (nolock) '

    + 'where convert(varchar(8000), [' + @col +

    ']) like ''' + @phrase + ''' '

    end

    if @OutFullRecords = 1 begin

    set @sql = 'if exists (select * from [' + @tbl + '] (nolock) '

    + 'where convert(varchar(8000), [' + @col + ']) like ''' +

    @phrase + ''') '

    + 'select ''[' + @tbl + ']'' TableName, ''[' + @col+ ']''

    ColumnName, * '

    + 'from [' + @tbl + '] (nolock) where convert(varchar

    (8000), [' + @col + ']) like ''' + @phrase + ''' '

    end

    exec(@sql)

    fetch CRR into @tbl, @col, @id_present

    end

    close CRR

    deallocate CRR

    if @OutFullRecords = 0 begin

    -- For the clients supporting new types:

    --exec('select * from #tbl_res order by 1,2,3')

    -- For the clients who are not supporting new types:

    INSERT #tbl_res2

    select TableName, ColumnName, Id, convert(varchar(255),ColumnValue) ColumnValue from

    #tbl_res

    /** exec('select TableName, ColumnName, Id, convert(varchar(255),ColumnValue)

    ColumnValue from #tbl_res order by 1,2,3')**/

    end

    drop table #tbl_res

    /***Select Statement to show tables***/

    select TableName, ColumnName, ColumnValue from #tbl_res2 group by TableName, ColumnName,

    ColumnValue

    order by TableName

    truncate table #tbl_res2

    drop table #tbl_res2

    RETURN

    GO

    --GRANT EXECUTE ON dbo.spSearchOnAllDB TO DYNGRP

    /* Copyright © Microsoft Corporation.  All Rights Reserved.                     */

    /* This code released under the terms of the                                    */

    /* Microsoft Public License (MS-PL, opensource.org/.../ms-pl.html.) */

    --exec  spSearchOnAllDB '100XL%', 1

    --exec  spSearchOnAllDB '%''%', 0

  • L Vail Profile Picture
    L Vail 65,271 on at
    RE: Manual Payment Stuck in Work status but yet fully applied to an Open Invoice- PURGATORY

    Hi,

    I looked through my SQL scripts and found the one below that might help you. I downloaded this a while back from a Touchstone consultant. I wish I had also recorded the author's name so that I could have posted that too. Like everything you read on the forum, backup everything and move forward at your peril. Here it is:

    /*

    Dynamics GP Fully applied payments stuck in Open

    I was on the Microsoft forums recently helping to resolve the above issue for a partner in the UK.

    Ordinarily fully applied payables documents automatically move to history, however every now and then

    they don’t and they need a little nudge.

    During the course of this forum post the standard process for forcing this move did not work and

    Jon (another Touchstone consultant) was able to offer other alternatives and I was also able

    to dig out an old script from our sql archives from version 6 days (may need the odd tweak for 2010).

    As such a wealth of advice came out I thought it was worth documenting hear.

    Standard Process;

    The standard process is to rebuild the PM master keys (Delete PM00400) and the run checklinks on the

    payables transaction and transaction history logical groups to rebuild the PM00400 table.

    It is worth noting that you can lose some drill down ability doing this. Make sure you do a back up first.

    This should do the job 9 times out of 10.

    Remittance process:

    Jon (Our Tame Dex Developer) has discovered that in some cases the transactions do not move if

    you have records in the PM20100 and they have a KEYSOURC of REMITTANCE. The assumption is that

    checklinks wont move them until the remittance is printed. Jon has found that if you delete the

    records from the PM20100 and then run the standard process the records move.

    The Move routine:

    Jon has also found that you can run the move routine indiviually with the following SQL code.

    */

    DECLARE @FuncCurr VARCHAR(15)

    DECLARE @ErrorState INT

    SELECT @FuncCurr = FUNLCURR

    FROM MC40000

    CREATE TABLE #CNTRLNUMTEMP (

    CNTRLNUM VARCHAR(21) NOT NULL

    , DOCTYPE SMALLINT NOT NULL

    , VENDORID VARCHAR(15) NOT NULL

    )

    EXEC pmclmovefullyapplied 'sa'

    , @FuncCurr

    , 'PM_Transaction_OPEN'

    , '%1'

    , @ErrorState OUTPUT

    SELECT *

    FROM SY03400

    DELETE SY03400

    --SQL Script to move open to history:

    --If all of this fails i have in my archive a SQL script to move open to History.

    --This was written for version 6 originally so may need some tweaking for 2010.

    /*

    ** Procedure Name: PM move open to history for R6

    ** Description:

    ** Script is for R6 PM transactions that show fully applied and are still in the open table.

    ** Important:

    ** There are numerous places where the Voucher Number, Document Type, Control Number, or Vendor ID

    ** must be provided. To find these locations do a search on 00000000000000001. Replace 00000000000000001

    ** with the voucher number you want to move to history.

    ** Also do a search on '??????????' and replace this with the Vendor Id of the voucher.

    ** If the invoice needs to be moved then change DOCTYPE to 1 and CTRLTYP to 0.

    ** If the payment needs to be moved then change DOCTYPE to 6 and CTRLTYP to 1.

    ** For the Distribution section, the History has a DOCTYPE but the Work does not. The script is

    ** hardcoded for invoices. If the document is a payment, in the line following the 'select' in

    ** PM30600's insert statement, replace the 1 with 6.

    **

    ** This script does not update reprint information (the PM80000's tables).

    **

    **

    ** Database:

    **

    ** Any

    **

    **

    ** Tables:

    **

    ** SQL Table Access Method

    ** --------------------- -------------

    ** PM30200 Read/Write

    ** PM20000 Read/Write

    ** PM00400 Read

    ** PM30300 Read/Write

    ** PM10200 Read/Write

    ** PM30600 Read/Write

    ** PM10100 Read/Write

    ** PM10500 Read/Write

    ** PM30700 Read/Write

    **

    **

    *****************************************************************************************

    */

    BEGIN

    INSERT INTO PM30200 (

    VCHRNMBR

    , VENDORID

    , DOCTYPE

    , DOCDATE

    , DOCNUMBR

    , DOCAMNT

    , CURTRXAM

    , DISTKNAM

    , DISCAMNT

    , DSCDLRAM

    , BACHNUMB

    , TRXSORCE

    , BCHSOURC

    , DISCDATE

    , DUEDATE

    , PORDNMBR

    , TEN99AMNT

    , WROFAMNT

    , DISAMTAV

    , TRXDSCRN

    , UN1099AM

    , BKTPURAM

    , BKTFRTAM

    , BKTMSCAM

    , VOIDED

    , HOLD

    , CHEKBKID

    , DINVPDOF

    , PPSAMDED

    , PPSTAXRT

    , PGRAMSBJ

    , GSTDSAMT

    , POSTEDDT

    , PTDUSRID

    , MODIFDT

    , MDFUSRID

    , PYENTTYP

    , CARDNAME

    , PRCHAMNT

    , TRDISAMT

    , MSCCHAMT

    , FRTAMNT

    , TAXAMNT

    , TTLPYMTS

    , CURNCYID

    , PYMTRMID

    , SHIPMTHD

    , TAXSCHID

    , PCHSCHID

    , FRTSCHID

    , MSCSCHID

    , PSTGDATE

    , DISAVTKN

    , CNTRLTYP

    , NOTEINDX

    , PRCTDISC

    , RETNAGAM

    , ICTRX

    , Tax_Date

    , PRCHDATE

    , CORRCTN

    , SIMPLIFD

    , APLYWITH

    , Electronic

    , ECTRX

    , DocPrinted

    , TaxInvReqd

    , VNDCHKNM

    )

    SELECT VCHRNMBR

    , VENDORID

    , DOCTYPE

    , DOCDATE

    , DOCNUMBR

    , DOCAMNT

    , CURTRXAM

    , DISTKNAM

    , DISCAMNT

    , DSCDLRAM

    , BACHNUMB

    , TRXSORCE

    , BCHSOURC

    , DISCDATE

    , DUEDATE

    , PORDNMBR

    , TEN99AMNT

    , WROFAMNT

    , DISAMTAV

    , TRXDSCRN

    , UN1099AM

    , BKTPURAM

    , BKTFRTAM

    , BKTMSCAM

    , VOIDED

    , HOLD

    , CHEKBKID

    , DINVPDOF

    , PPSAMDED

    , PPSTAXRT

    , PGRAMSBJ

    , GSTDSAMT

    , POSTEDDT

    , PTDUSRID

    , MODIFDT

    , MDFUSRID

    , PYENTTYP

    , CARDNAME

    , PRCHAMNT

    , TRDISAMT

    , MSCCHAMT

    , FRTAMNT

    , TAXAMNT

    , TTLPYMTS

    , CURNCYID

    , PYMTRMID

    , SHIPMTHD

    , TAXSCHID

    , PCHSCHID

    , FRTSCHID

    , MSCSCHID

    , PSTGDATE

    , DISAVTKN

    , CNTRLTYP

    , NOTEINDX

    , PRCTDISC

    , RETNAGAM

    , ICTRX

    , Tax_Date

    , PRCHDATE

    , CORRCTN

    , SIMPLIFD

    , APLYWITH

    , Electronic

    , ECTRX

    , DocPrinted

    , TaxInvReqd

    , VNDCHKNM

    FROM PM20000

    WHERE DOCTYPE = 1

    AND VCHRNMBR = '00000000000000001'

    AND VENDORID = '??????????'

    DELETE PM20000

    WHERE VCHRNMBR = '00000000000000001'

    AND DOCTYPE = 1

    AND VENDORID = '??????????'

    PRINT

    'Your insert into PM30200 is complete. Now continue with update of the PM00400 table.'

    /*This script will update the PM00400 table and flag the document from Open to History */

    /*The CTRLNUM is the voucher number. The CNTRLTYP is 0 for invoice and 1 for payment */

    UPDATE PM00400

    SET DCSTATUS = 3

    WHERE CNTRLNUM = '00000000000000001'

    AND VENDORID = '??????????'

    AND DCSTATUS = 2

    AND CNTRLTYP = 0

    PRINT

    'Your update on PM00400 is complete. Now continue with insert on the PM30300 table'

    END

    /* This script will move the apply records from Apply to Work Open to Apply to History and then

    ** delete the PM10200 records. The apply to Voucher Number must be provided, which is the

    ** invoice voucher number.

    */

    BEGIN

    INSERT PM30300 (

    VENDORID

    , DOCDATE

    , DATE1

    , GLPOSTDT

    , TIME1

    , VCHRNMBR

    , DOCTYPE

    , APFRDCNM

    , ApplyFromGLPostDate

    , FROMCURR

    , APFRMAPLYAMT

    , APFRMDISCTAKEN

    , APFRMDISCAVAIL

    , APFRMWROFAMT

    , ActualApplyToAmount

    , ActualDiscTakenAmount

    , ActualDiscAvailTaken

    , ActualWriteOffAmount

    , APFRMEXRATE

    , APFRMDENRATE

    , APFRMRTCLCMETH

    , APFRMMCTRXSTT

    , APTVCHNM

    , APTODCTY

    , APTODCNM

    , APTODCDT

    , ApplyToGLPostDate

    , CURNCYID

    , CURRNIDX

    , APPLDAMT

    , DISTKNAM

    , DISAVTKN

    , WROFAMNT

    , ORAPPAMT

    , ORDISTKN

    , ORDATKN

    , ORWROFAM

    , APTOEXRATE

    , APTODENRATE

    , APTORTCLCMETH

    , APTOMCTRXSTT

    , PPSAMDED

    , GSTDSAMT

    , TAXDTLID

    , POSTED

    , TEN99AMNT

    , RLGANLOS

    , APYFRMRNDAMT

    , APYTORNDAMT

    , APYTORNDDISC

    , OAPYFRMRNDAMT

    , OAPYTORNDAMT

    , OAPYTORNDDISC

    , Settled_Gain_CreditCurrT

    , Settled_Loss_CreditCurrT

    , Settled_Gain_DebitCurrTr

    , Settled_Loss_DebitCurrTr

    , Settled_Gain_DebitDiscAv

    , Settled_Loss_DebitDiscAv

    )

    SELECT VENDORID

    , DOCDATE

    , DATE1

    , GLPOSTDT

    , TIME1

    , VCHRNMBR

    , DOCTYPE

    , APFRDCNM

    , ApplyFromGLPostDate

    , FROMCURR

    , APFRMAPLYAMT

    , APFRMDISCTAKEN

    , APFRMDISCAVAIL

    , APFRMWROFAMT

    , ActualApplyToAmount

    , ActualDiscTakenAmount

    , ActualDiscAvailTaken

    , ActualWriteOffAmount

    , APFRMEXRATE

    , APFRMDENRATE

    , APFRMRTCLCMETH

    , APFRMMCTRXSTT

    , APTVCHNM

    , APTODCTY

    , APTODCNM

    , APTODCDT

    , ApplyToGLPostDate

    , CURNCYID

    , CURRNIDX

    , APPLDAMT

    , DISTKNAM

    , DISAVTKN

    , WROFAMNT

    , ORAPPAMT

    , ORDISTKN

    , ORDATKN

    , ORWROFAM

    , APTOEXRATE

    , APTODENRATE

    , APTORTCLCMETH

    , APTOMCTRXSTT

    , PPSAMDED

    , GSTDSAMT

    , TAXDTLID

    , POSTED

    , TEN99AMNT

    , RLGANLOS

    , APYFRMRNDAMT

    , APYTORNDAMT

    , APYTORNDDISC

    , OAPYFRMRNDAMT

    , OAPYTORNDAMT

    , OAPYTORNDDISC

    , Settled_Gain_CreditCurrT

    , Settled_Loss_CreditCurrT

    , Settled_Gain_DebitCurrTr

    , Settled_Loss_DebitCurrTr

    , Settled_Gain_DebitDiscAv

    , Settled_Loss_DebitDiscAv

    FROM PM10200

    WHERE APTVCHNM = '00000000000000001'

    AND APTODCTY = 1

    AND VENDORID = '??????????'

    DELETE PM10200

    WHERE APTVCHNM = '00000000000000001'

    AND APTODCTY = 1

    AND VENDORID = '??????????'

    PRINT

    'Your update on PM30300 is complete. Now continuing with insert on the PM30600 table'

    END

    /* This script will move the distribution records from the Distribution Work Open to Hist and

    ** then deletes the PM10100 records. The Voucher Number must be provided. The CNTRLTYP is 0

    ** for invoice and 1 for payment.

    */

    BEGIN

    INSERT INTO PM30600 (

    DOCTYPE

    , VCHRNMBR

    , DSTSQNUM

    , CNTRLTYP

    , CRDTAMNT

    , DEBITAMT

    , DSTINDX

    , DISTTYPE

    , CHANGED

    , USERID

    , PSTGSTUS

    , VENDORID

    , TRXSORCE

    , PSTGDATE

    , CURNCYID

    , CURRNIDX

    , ORCRDAMT

    , ORDBTAMT

    , APTVCHNM

    , APTODCTY

    , SPCLDIST

    , DistRef

    )

    SELECT 1

    , VCHRNMBR

    , DSTSQNUM

    , CNTRLTYP

    , CRDTAMNT

    , DEBITAMT

    , DSTINDX

    , DISTTYPE

    , CHANGED

    , USERID

    , PSTGSTUS

    , VENDORID

    , TRXSORCE

    , PSTGDATE

    , CURNCYID

    , CURRNIDX

    , ORCRDAMT

    , ORDBTAMT

    , APTVCHNM

    , APTODCTY

    , SPCLDIST

    , DistRef

    FROM PM10100

    WHERE VCHRNMBR = '00000000000000001'

    AND VENDORID = '??????????'

    AND CNTRLTYP = 0

    DELETE PM10100

    WHERE VCHRNMBR = '00000000000000001'

    AND VENDORID = '??????????'

    AND CNTRLTYP = 0

    PRINT

    'Your update on PM30600 is complete. Now continuing with insert on the PM30700 table'

    END

    /* This script will move the Tax records from Tax Work to Tax History and then deletes the

    ** PM10500 records. The apply to Voucher Number must be provided.

    */

    BEGIN

    INSERT PM30700 (

    VENDORID

    , VCHRNMBR

    , DOCTYPE

    , BACHNUMB

    , TAXDTLID

    , BKOUTTAX

    , TAXAMNT

    , ORTAXAMT

    , PCTAXAMT

    , ORPURTAX

    , FRTTXAMT

    , ORFRTTAX

    , MSCTXAMT

    , ORMSCTAX

    , ACTINDX

    , TRXSORCE

    , TDTTXPUR

    , ORTXBPUR

    , TXDTTPUR

    , ORTOTPUR

    , CURRNIDX

    )

    SELECT VENDORID

    , VCHRNMBR

    , DOCTYPE

    , BACHNUMB

    , TAXDTLID

    , BKOUTTAX

    , TAXAMNT

    , ORTAXAMT

    , PCTAXAMT

    , ORPURTAX

    , FRTTXAMT

    , ORFRTTAX

    , MSCTXAMT

    , ORMSCTAX

    , ACTINDX

    , TRXSORCE

    , TDTTXPUR

    , ORTXBPUR

    , TXDTTPUR

    , ORTOTPUR

    , CURRNIDX

    FROM PM10500

    WHERE VCHRNMBR = '00000000000000001'

    AND DOCTYPE = 1

    AND VENDORID = '??????????'

    DELETE PM10500

    WHERE VCHRNMBR = '00000000000000001'

    AND DOCTYPE = 1

    AND VENDORID = '??????????'

    PRINT 'Your update on PM30700 is complete. Move process is complete.'

    END

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!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans