Dear Microsoft Dynamics GP Community,
We want to programmatically apply payables documents in Microsoft Dynamics GP. We want to do this programmatically because we are automating creating payables documents and we also want to automatically apply them to eliminate the chance for human error and because there might be a large number of these documents.
Also, during the apply process, in order to satisfy certain business rules, we want to have control over which documents are applied with each other. For example, for a given vendor, we might want to apply a credit memo to one invoice, but not to another invoice. We also want to specify the apply amount. This is the functionality that is available in the Apply Payables Documents window.
Has anyone programmatically applied payables documents? I haven't found much information on this in the GP SDK, or in web searches. I want to make sure that I'm inserting and updating tables correctly, running the correct procedures, etc. I also want to make sure that I set correct field values in the apply tables and correctly move documents to history.
We have already tried some things. We first tried to programmatically access the Apply Payables Documents window with .NET and with Modifier, but ran into difficulties when trying to interact with the scrolling window. We haven't tried this with Dexterity yet. We wanted to take this approach because we could be more sure that the correct processes would be run in the background to set field values and move documents to history. Also, this would be a more resilient solution when it comes to upgrades because there would be less customization.
We then tried to programmatically apply records by inserting into the PM20100 table and the PM10200 table, updating amounts in the PM20000 table, and then running the following script (This script runs a routine that, as I understand, is used during Check Links):
---------------------------------------------------------------
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
---------------------------------------------------------------
We are evaluating this approach, but the script didn't seem to move documents to history when we ran it. We might be able to get it to work, but in the meantime, instead of the above script, we are trying to move the applied documents to history programmatically with information from another script that we found that moves documents from PM20000 to PM30200, from PM10200 to PM30300, from PM10100 to PM30600, and updates PM00400 (tables PM10500 and PM30700 were also mentioned, but it looks like we're not using those).
This seems to be working, but were not sure that were setting the correct values in the apply work tables, or moving everything to history correctly.
Does anyone know if there is any documentation related to this?
Thank you very much for your assistance.
Sincerely,
Jacob Shukert
*This post is locked for comments