I'm developing two different custom Dynamics GP Payables eConnect integrations for two different customers. One of the shared requirements is to validate the data for each Payables transaction before it is imported.
The import will confirm among other things, that the vendor exists in GP, the GL distribution accounts are valid, the amounts are valid, and lastly, that the transaction does not already exist in GP. So if Invoice 12345 for vendor ACME is already present in GP, the import should flag the record as a duplicate and skip it.
To check for a duplicate PM transaction, you could check the PM transaction tables directly. While definitely possible, the downside to this approach is that an invoice or credit memo may be in one of three different tables: Work, Open, and History (PM10000, PM20000, and PM30200).
All three of the tables could be queried with a single SQL statement, but there is an alternative. Instead of querying those three tables, you can query the PM00400 "PM Key Master" table instead.
PM00400 should contain every voucher number and vendor document number process by the Payables module, so you should be able to query it to determine if a transaction already exists, and the table should tell you the document status (work, open, or history).
Above is a sample transaction, with each row being a snapshot of the data in PM00400 as the invoice moved from work to open to history. Note that the CDSTATUS field changes from 1 to 2 to 3, and the TRXSOURCE value is populated once the transaction is posted.
So PM00400 can be a handy option to check whether a Payables transaction already exists in GP, and a quick way to verify the status of the document.
The Receivables module has a similar "RM Key" table, RM00401.