Sunday, March 23, 2008

Removing Child Records from a National Account

This is an actual problem I faced at an actual customer of mine a few months aback and posted today on the Google's Dynamics GP board. It seems that more often than one could assert, a customer's payment records get assigned to the wrong national account (or parent account). This can cause problems down the road when incorrect statements or aging reports are submitted to the corporate customer.

In light of this issue, I developed a two fold solution:

1) The following query identifies the credit documents posted and applied by the parent customer on behalf of the child account.


-- Created by Mariano Gomez, MVP
-- This code is licensed under the Creative Commons 
-- Attribution-NonCommercial-ShareAlike 3.0 Unported License.
-- http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode

DECLARE @CUSTNMBR CHAR(21), @PARENT CHAR(21);
SET @CUSTNMBR = 'YOUR_CHILD_CUSTOMER';
SET @PARENT = 'YOUR_PARENT_CUSTOMER';

SELECT DISTINCT APTODCNM FROM
( SELECT APTODCNM FROM RM30201 WHERE CUSTNMBR = @CUSTNMBR AND APFRDCNM IN
  ( SELECT DOCNUMBR FROM RM20101 WHERE CUSTNMBR = @PARENT AND RMDTYPAL = 9
    UNION
    SELECT DOCNUMBR FROM RM30101 WHERE CUSTNMBR = @PARENT AND RMDTYPAL = 9
  )
  UNION
  SELECT APTODCNM FROM RM20201 WHERE CUSTNMBR = @CUSTNMBR AND APFRDCNM IN
  ( SELECT DOCNUMBR FROM RM20101 WHERE CUSTNMBR = @PARENT AND RMDTYPAL = 9
    UNION
    SELECT DOCNUMBR FROM RM30101 WHERE CUSTNMBR = @PARENT AND RMDTYPAL = 9
  )
) UNAPPLY;
GO 


2) You will then need to use Dynamics GP's Professional Services Tools Library (PSTL) to unapply the invoices associated to the child record, which in turn will unapply the credit documents posted under the national account. Make sure you print all reports generated by Professional Tools as you will need them to reapply the credit documents.

Well, hope this helps in solving a major headache faced by many AR departments around the globe.

Until next post!

MG.-
Mariano Gomez, MVP
IntellPartners, LLC
http://www.IntellPartners.com/

1 comment:

Mariano Gomez said...

NOTE: This method can also be used to remove child accounts from a parent account.