Paul Roe
2014-09-16 16:38:41 UTC
I'm very new to great plains, I've been asked to create a method or stored proc to delete a payment from great plains. I hate the idea of going direct to the database but I cant seem to get econnect.deletetransaction method to work, though it's unclear from the documentation whether it's supposed to be able to delete a payment in the first place.
If I cant' get it working I need to write a stored proc to delete this data directly. From what I can tell the following tables contain records created/upated as a result of creating a payment and then applying invoices to it.
GDS.DBO.PM00201 (PM Vendor Master Summary - PM_Vendor_MSTR_SUM)
GDS.DBO.PM00400 (PM Key Master File - PM_Key_MSTR)
GDS.DBO.PM10100 (PM Distribution WORK OPEN - PM_Distribution_WORK_OPEN)
GDS.DBO.PM10200 (PM Apply To WORK OPEN File - PM_Apply_To_WORK_OPEN)
GDS.DBO.PM10400 (PM Manual Payment WORK File - PM_Manual_Payment_WORK)
GDS.DBO.PM20000 (PM Transaction OPEN File - PM_Transaction_OPEN)
GDS.DBO.PM20100 (PM Apply To OPEN OPEN Temporary File - PM_Apply_To_OPEN_OPEN)
GDS.DBO.PM40100 (PM Setup File - PM_SETP)
GDS.DBO.SY00500 (Posting Definitions Master - Batch_Headers)
I plan to do the following (psuedo):
Update PM00201 set currblnc =
(sum of CURTRXAM from PM20100 where KEYSOURC='mydocnumber')
OR (should I use PM10100.DebitAMT)?
Delete from PM00400 where docnumbr='mydocnumber'
Delete from PM10100 where vchrnmbr = 'mydocnumber'
Delete from PM10200 where VCHRNMBR = 'mydocnumber'
Delete from PM10400 where VCHRNMBR = 'mydocnumber'
Delete from PM20000 where DOCNUMBR = 'mydocnumber'
Delete from PM20100 where KEYSOURC = 'mydocnumber'
Update SY00500 set numoftrx = (numoftrx-1) -- ??
-- and yes this approach sickens me to my very core. Any sanity checking, advice, and or code review of this plan will be appreciated.
If I cant' get it working I need to write a stored proc to delete this data directly. From what I can tell the following tables contain records created/upated as a result of creating a payment and then applying invoices to it.
GDS.DBO.PM00201 (PM Vendor Master Summary - PM_Vendor_MSTR_SUM)
GDS.DBO.PM00400 (PM Key Master File - PM_Key_MSTR)
GDS.DBO.PM10100 (PM Distribution WORK OPEN - PM_Distribution_WORK_OPEN)
GDS.DBO.PM10200 (PM Apply To WORK OPEN File - PM_Apply_To_WORK_OPEN)
GDS.DBO.PM10400 (PM Manual Payment WORK File - PM_Manual_Payment_WORK)
GDS.DBO.PM20000 (PM Transaction OPEN File - PM_Transaction_OPEN)
GDS.DBO.PM20100 (PM Apply To OPEN OPEN Temporary File - PM_Apply_To_OPEN_OPEN)
GDS.DBO.PM40100 (PM Setup File - PM_SETP)
GDS.DBO.SY00500 (Posting Definitions Master - Batch_Headers)
I plan to do the following (psuedo):
Update PM00201 set currblnc =
(sum of CURTRXAM from PM20100 where KEYSOURC='mydocnumber')
OR (should I use PM10100.DebitAMT)?
Delete from PM00400 where docnumbr='mydocnumber'
Delete from PM10100 where vchrnmbr = 'mydocnumber'
Delete from PM10200 where VCHRNMBR = 'mydocnumber'
Delete from PM10400 where VCHRNMBR = 'mydocnumber'
Delete from PM20000 where DOCNUMBR = 'mydocnumber'
Delete from PM20100 where KEYSOURC = 'mydocnumber'
Update SY00500 set numoftrx = (numoftrx-1) -- ??
-- and yes this approach sickens me to my very core. Any sanity checking, advice, and or code review of this plan will be appreciated.