Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics GP (Archived)

How to Remove Posted Invoices

Posted on by 2,119

Hello all,

We just upgraded to GP 10.0 to GP 9.0. The upgrade went fine, and during the test upgrade we posted some test invoices to see if everything was going allright.

However, being new to GP myself, I did a mistake that I only removed these posted invoices from table RM20101... without realizing that the test invoices put numbers into the GL and Invoice Registries.

Is there a way to completely delete these records from our GP tables? I see that I could delete the GL from GL20000 table; however is this going to affect anything else, as in the GL account balances in GL10100 or etc?

Thanks in advanced for your help! Greatly appreciate it.

 

-Elizabeth

*This post is locked for comments

  • Sunbeam De Jesus Profile Picture
    Sunbeam De Jesus 3,930 on at
    Re: Re: Re: How to Remove Posted Invoices

    hi,

    i did not create the script by myself but i found it very useful, thanks to JIVtesh / Ethel and other who has handed it down from consultant to consultant.

  • Richard Whaley Profile Picture
    Richard Whaley 25,195 on at
    Re: Re: How to Remove Posted Invoices

    Sunbeam....email me about this script.  I have an offline question for you on it.

     rwhaley@accoladepublications.com

  • Richard Whaley Profile Picture
    Richard Whaley 25,195 on at
    Re: How to Remove Posted Invoices

    Well you messed up a bit the way you started.  See the invoice would create a financial batch that would create journal entries that post to GL and, depending on the source of your transaction, one identifier will NOT follow EVERY posting or data entry through the system. You should simply post reversing transactions and annotate everything.

    I like Sunbeam's script but it may not work for everyone.

  • kuroneko1313 Profile Picture
    kuroneko1313 2,119 on at
    Re: Re: How to Remove Posted Invoices

    Mark and Sunbeam, thank you for your reply.

    Right now I'm still trying to put back the deleted rows on table RM20101, then from there we're going to void and return the invoices. Let's see if this works, otherwise I'll try the script.

    Thanks for your help, appreciate it!

     

    -Elizabeth

  • Mark Roux Profile Picture
    Mark Roux 670 on at
    Re: How to Remove Posted Invoices

    Hi Elizabeth,

    I agree that this should be done in a test environment first. If it was me, i would have voided the sales doc and let the void part hit the GL for audit trail purposes - nett affect then zero.

    The searchonalldb script provided above will be useful to establish all tables the specified string of data exists in, and deleting it from each table will do the trick - providing that Financial and Sales reconciles are run to correct period, summary and other balances.

    Thanks

    Mark

  • Sunbeam De Jesus Profile Picture
    Sunbeam De Jesus 3,930 on at
    Re: How to Remove Posted Invoices

    Hi,

    ---I assume you have a little bit of SQL background. pls back up database first or run in a test environment. 

    ---This script below will create stored proc that will enable you to find a specific field value from a database.


    CREATE PROC SearchAllTables
    (
     @SearchStr nvarchar(100)
    )
    AS
    BEGIN


     CREATE TABLE #Results (ColumnName nvarchar(370), ColumnValue nvarchar(3630))

     SET NOCOUNT ON

     DECLARE @TableName nvarchar(256), @ColumnName nvarchar(128), @SearchStr2 nvarchar(110)
     SET  @TableName = ''
     SET @SearchStr2 = QUOTENAME('%' + @SearchStr + '%','''')

     WHILE @TableName IS NOT NULL
     BEGIN
      SET @ColumnName = ''
      SET @TableName =
      (
       SELECT MIN(QUOTENAME(TABLE_SCHEMA) + '.' + QUOTENAME(TABLE_NAME))
       FROM  INFORMATION_SCHEMA.TABLES
       WHERE   TABLE_TYPE = 'BASE TABLE'
        AND QUOTENAME(TABLE_SCHEMA) + '.' + QUOTENAME(TABLE_NAME) > @TableName
        AND OBJECTPROPERTY(
          OBJECT_ID(
           QUOTENAME(TABLE_SCHEMA) + '.' + QUOTENAME(TABLE_NAME)
            ), 'IsMSShipped'
                 ) = 0
      )

      WHILE (@TableName IS NOT NULL) AND (@ColumnName IS NOT NULL)
      BEGIN
       SET @ColumnName =
       (
        SELECT MIN(QUOTENAME(COLUMN_NAME))
        FROM  INFORMATION_SCHEMA.COLUMNS
        WHERE   TABLE_SCHEMA = PARSENAME(@TableName, 2)
         AND TABLE_NAME = PARSENAME(@TableName, 1)
         AND DATA_TYPE IN ('char', 'varchar', 'nchar', 'nvarchar')
         AND QUOTENAME(COLUMN_NAME) > @ColumnName
       )
     
       IF @ColumnName IS NOT NULL
       BEGIN
        INSERT INTO #Results
        EXEC
        (
         'SELECT ''' + @TableName + '.' + @ColumnName + ''', LEFT(' + @ColumnName + ', 3630)
         FROM ' + @TableName + ' (NOLOCK) ' +
         ' WHERE ' + @ColumnName + ' LIKE ' + @SearchStr2
        )
       END
      END 
     END

     SELECT ColumnName, ColumnValue FROM #Results
    END

     

    ---After creating the stored proc above, you can now search for a specific record. by changing the variable 'RCT00000000003511' below

    EXEC SearchAllTables 'RCT00000000003511'
    GO

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