Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics GP (Archived)

SOP transaction in History, but missing distributions and not in GL

(0) ShareShare
ReportReport
Posted on by

The user clicked post on the batch, the batch screen went away, but no screen print out displayed.  When the user went to verify the batch posted to the GL it was missing.

If I go to Inquiry >> Sales >> Sales Documents and search using history and the invoice number in the batch, the invoice shows up. Looking at the SOP invoice details, the invoice looks correct except there is NO distribution information.

I verified that the GL2000 table does not have the invoice listed, Verified that the sales history header and line items does have the invoice, and the distribution table (work history) does not have the data.

Wondering what I should do. I am thinking use SQL and remove the SOP history records, but wish there was a GUI way to do this, or move the SOP invoice back to work tables and allow gui to try again.

Not sure on the cause, but suspect the PC had issues and interrupted the batch posting.

SQL

--Work -Showed no results
SELECT * FROM NET.dbo.SOP10100 WHERE SOPNUMBE = '00402825'
SELECT * FROM NET.dbo.SOP10200 WHERE SOPNUMBE = '00402825'

--History - Showd header and 
SELECT * FROM NET.dbo.SOP30200 WHERE SOPNUMBE = '00402825'
SELECT * FROM NET.dbo.SOP30300 WHERE SOPNUMBE = '00402825'

--Distribution work and history -  Shows no information on invoice
SELECT * FROM NET.dbo.SOP10102 WHERE SOPNUMBE = '00402825'

*This post is locked for comments

  • RE: SOP transaction in History, but missing distributions and not in GL

    Double post, Sorry 

  • RE: SOP transaction in History, but missing distributions and not in GL

    My 2015 SOP tables have Workflow Added in. I was able to edit and get the query working.

  • KirkLivermont Profile Picture
    KirkLivermont 5,985 on at
    RE: SOP transaction in History, but missing distributions and not in GL

    I don't have an updated version but glancing through I didn't notice any tables I thought were changed. Do you have a test environment you can run this against? I can test on GP 2013 R2 tomorrow.

    Kirk

  • RE: SOP transaction in History, but missing distributions and not in GL

    Does anyone have an updated version of this script for 2015? If not I am going to be working on it shortly.

  • Suggested answer
    RE: SOP transaction in History, but missing distributions and not in GL

    I updated this script one more time. Added some transaction and error checks. Plus I forgot a couple update fields which make the SOP invoice not show as already posted even though in the work tables.

    --If I move the Invoice from History back to Work I was going to use this below SQL

    /**

    References

    victoriayudin.com/.../sop-tables

    community.dynamics.com/.../105575.aspx

    Script Purpose

    If something  happens during a posting of a batch, an invoices distributions can disapear. NOT sure how or why.

    Make sure to check the distributions table to see if the SQL relationship is broken, or the distribution has truly disapeared (Dexterity black box artifact)

    **/

    --Set the Invoice to Move

    BEGIN TRANSACTION;

    DECLARE @SOPID as varchar(55)

    SET @SOPID = '00418351'

    --Set the Temp SOP Number

    DECLARE @SOPIDTemp as varchar(55)

    SET @SOPIDTemp = @SOPID + '!'--Temporary ! sysmbol so there is no primary key conflict

    Print @SOPIDTemp

    ----Receivables Management, check to see if there are receivables, you will have to delete these if you are moving invoice to work from history

    SELECT * FROM NET.dbo.RM00401 WHERE DOCNUMBR =  @SOPID

    --Whats in the Distributions table for this invoice, if nothing than run script, and repair open invoice re adding distributions. Then re post

    SELECT * FROM NET.dbo.SOP10102 WHERE SOPNUMBE=@SOPID

    --Get the Dex Row ID for the Header

    DECLARE @DEX_ROW_ID_Header as int

    SELECT @DEX_ROW_ID_Header= DEX_ROW_ID FROM NET.dbo.SOP30200 WHERE SOPNUMBE = @SOPID--Header Detail

    SELECT DEX_ROW_ID FROM NET.dbo.SOP30300 WHERE SOPNUMBE = @SOPID--Line Detail

    BEGIN TRY

    --Clone history Invoice to work table

    INSERT INTO NET.dbo.SOP10100

    SELECT SOPTYPE, @SOPIDTemp, ORIGTYPE, ORIGNUMB, DOCID, DOCDATE, GLPOSTDT, QUOTEDAT, QUOEXPDA, ORDRDATE, INVODATE, BACKDATE, RETUDATE, ReqShipDate, FUFILDAT, ACTLSHIP, DISCDATE, DUEDATE, REPTING, TRXFREQU, TIMEREPD, TIMETREP, DYSTINCR, DTLSTREP, DSTBTCH1, DSTBTCH2, USDOCID1, USDOCID2, DISCFRGT, ORDAVFRT, DISCMISC, ORDAVMSC, DISAVAMT, ORDAVAMT, DISCRTND, ORDISRTD, DISTKNAM, ORDISTKN, DSCPCTAM, DSCDLRAM, ORDDLRAT, DISAVTKN, ORDATKN, PYMTRMID, PRCLEVEL, LOCNCODE, BCHSOURC, BACHNUMB, CUSTNMBR, CUSTNAME, CSTPONBR, PROSPECT, MSTRNUMB, PCKSLPNO, PICTICNU, MRKDNAMT, ORMRKDAM, PRBTADCD, PRSTADCD, CNTCPRSN, ShipToName, ADDRESS1, ADDRESS2, ADDRESS3, CITY, STATE, ZIPCODE, CCode, COUNTRY, PHNUMBR1, PHNUMBR2, PHONE3, FAXNUMBR, COMAPPTO, COMMAMNT, OCOMMAMT, CMMSLAMT, ORCOSAMT, NCOMAMNT, ORNCMAMT, SHIPMTHD, TRDISAMT, ORTDISAM, TRDISPCT, SUBTOTAL, ORSUBTOT, REMSUBTO, OREMSUBT, EXTDCOST, OREXTCST, FRTAMNT, ORFRTAMT, MISCAMNT, ORMISCAMT, TXENGCLD, TAXEXMT1, TAXEXMT2, TXRGNNUM, TAXSCHID, TXSCHSRC, BSIVCTTL, FRTSCHID, FRTTXAMT, ORFRTTAX, FRGTTXBL, MSCSCHID, MSCTXAMT, ORMSCTAX, MISCTXBL, BKTFRTAM, ORBKTFRT, BKTMSCAM, ORBKTMSC, BCKTXAMT, OBTAXAMT, TXBTXAMT, OTAXTAMT, TAXAMNT, ORTAXAMT, ECTRX, DOCAMNT, ORDOCAMT, PYMTRCVD, ORPMTRVD, DEPRECVD, ORDEPRVD, CODAMNT, ORCODAMT, ACCTAMNT, ORACTAMT, SALSTERR, SLPRSNID, UPSZONE, TIMESPRT, PSTGSTUS, VOIDSTTS, ALLOCABY, NOTEINDX, CURNCYID, CURRNIDX, RATETPID, EXGTBLID, XCHGRATE, DENXRATE, EXCHDATE, TIME1, RTCLCMTD, MCTRXSTT, TRXSORCE, SOPHDRE1, SOPHDRE2, SOPLNERR, SOPHDRFL, 0 as SOPMCERR, COMMNTID, REFRENCE, POSTEDDT, PTDUSRID, USER2ENT, CREATDDT, MODIFDT, Tax_Date, APLYWITH, WITHHAMT, SHPPGDOC, CORRCTN, SIMPLIFD, '' as CORRNXST, DOCNCORR, SEQNCORR, SALEDATE, 0 as SOPHDRE3, EXCEPTIONALDEMAND, Flags, 0 as BackoutTradeDisc, 0 as OrigBackoutTradeDisc, '' as GPSFOINTEGRATIONID, 0 as INTEGRATIONSOURCE, '' as INTEGRATIONID, SOPSTATUS, SHIPCOMPLETE, DIRECTDEBIT

    FROM NET.dbo.SOP30200 WHERE SOPNUMBE = @SOPID

    --Clone history lines to work table

    INSERT INTO NET.dbo.SOP10200

    SELECT SOPTYPE, @SOPIDTemp, LNITMSEQ, CMPNTSEQ, ITEMNMBR, ITEMDESC, NONINVEN, DROPSHIP, UOFM, LOCNCODE, UNITCOST, ORUNTCST, UNITPRCE, ORUNTPRC, XTNDPRCE, OXTNDPRC, REMPRICE, OREPRICE, EXTDCOST, OREXTCST, MRKDNAMT, ORMRKDAM, MRKDNPCT, MRKDNTYP, INVINDX, CSLSINDX, SLSINDX, MKDNINDX, RTNSINDX, INUSINDX, INSRINDX, DMGDINDX, ITMTSHID, IVITMTXB, BKTSLSAM, ORBKTSLS, TAXAMNT, ORTAXAMT, TXBTXAMT, OTAXTAMT, BSIVCTTL, TRDISAMT, ORTDISAM, DISCSALE, ORDAVSLS, QUANTITY, ATYALLOC, QTYINSVC, QTYINUSE, QTYDMGED, QTYRTRND, QTYONHND, QTYCANCE, QTYCANOT, 0 as QTYONPO, QTYORDER, QTYPRBAC, QTYPRBOO, QTYPRINV, QTYPRORD, QTYPRVRECVD, QTYRECVD, QTYREMAI, QTYREMBO, QTYTBAOR, QTYTOINV, QTYTORDR, QTYFULFI, QTYSLCTD, QTYBSUOM, EXTQTYAL, EXTQTYSEL, ReqShipDate, FUFILDAT, ACTLSHIP, SHIPMTHD, SALSTERR, SLPRSNID, PRCLEVEL, COMMNTID, BRKFLD1, BRKFLD2, BRKFLD3, CURRNIDX, TRXSORCE, SOPLNERR, ORGSEQNM, ITEMCODE, PURCHSTAT, DECPLQTY, DECPLCUR, ODECPLCU, 0 as QTYTOSHP, 0 as XFRSHDOC, EXCEPTIONALDEMAND, TAXSCHID, TXSCHSRC, PRSTADCD, ShipToName, CNTCPRSN, ADDRESS1, ADDRESS2, ADDRESS3, CITY, STATE, ZIPCODE, CCode, COUNTRY, PHONE1, PHONE2, PHONE3, FAXNUMBR, Flags, 0 as BackoutTradeDisc, 0 as OrigBackoutTradeDisc, '' as GPSFOINTEGRATIONID, 0 as INTEGRATIONSOURCE, '' as INTEGRATIONID, CONTNBR, CONTLNSEQNBR, CONTSTARTDTE, CONTENDDTE, CONTITEMNBR, CONTSERIALNBR, 0 as BULKPICKPRNT, 0 as INDPICKPRNT, ISLINEINTRA, '' as SOFULFILLMENTBIN, 0 as MULTIPLEBINS

    FROM NET.dbo.SOP30300 WHERE SOPNUMBE = @SOPID

    IF @@ERROR = 0

    BEGIN

    --Delete History Header

    DELETE FROM NET.dbo.SOP30200 WHERE DEX_ROW_ID=@DEX_ROW_ID_Header

    --Delete History Line Items

    DELETE FROM NET.dbo.SOP30300 WHERE  SOPNUMBE = @SOPID

    --Remove Temporary ! sysmbol from Invoice ID in work tables

    Update  NET.dbo.SOP10100 SET SOPNUMBE=REPLACE(SOPNUMBE,'!',''),PSTGSTUS=0, TRXSORCE='',REFRENCE='',PTDUSRID='',POSTEDDT='2013-11-13 00:00:00.000' WHERE SOPNUMBE = @SOPIDTemp

    Update  NET.dbo.SOP10200 SET SOPNUMBE=REPLACE(SOPNUMBE,'!','') WHERE SOPNUMBE = @SOPIDTemp

    --Remove Receivables Management Data

    DELETE FROM NET.dbo.RM00401 WHERE DOCNUMBR =  @SOPID

    --NOTE This does nothing for distributions. Script written for when a work invoice has been posted partially

    --Distributions where never moded.

    --SOP10102 – GL Distributions Work and History

    END

    END TRY

    BEGIN CATCH

    Print 'There was an error in cloning the work and history table'

    END CATCH

    If @@TRANCOUNT > 0

    COMMIT TRANSACTION;

    GO

  • Suggested answer
    RE: SOP transaction in History, but missing distributions and not in GL

    --If I move the Invoice from History back to Work I was going to use this below SQL

    /**

    References

    victoriayudin.com/.../sop-tables

    community.dynamics.com/.../105575.aspx

    Script Purpose

    If something  happens during a posting of a batch, an invoices distributions can disapear. NOT sure how or why.

    Make sure to check the distributions table to see if the SQL relationship is broken, or the distribution has truly disapeared (Dexterity black box artifact)

    **/

    --Set the Invoice to Move

    DECLARE @SOPID as varchar(55)

    SET @SOPID = '00418351'

    --Set the Temp SOP Number

    DECLARE @SOPIDTemp as varchar(55)

    SET @SOPIDTemp = @SOPID + '!'--Temporary ! sysmbol so there is no primary key conflict

    Print @SOPIDTemp

    ----Receivables Management, check to see if there are receivables, you will have to delete these if you are moving invoice to work from history

    SELECT * FROM NET.dbo.RM00401 WHERE DOCNUMBR =  @SOPID

    --Whats in the Distributions table for this invoice, if nothing than run script, and repair open invoice re adding distributions. Then re post

    SELECT * FROM NET.dbo.SOP10102 WHERE SOPNUMBE=@SOPID

    --Get the Dex Row ID for the Header

    DECLARE @DEX_ROW_ID_Header as int

    SELECT @DEX_ROW_ID_Header= DEX_ROW_ID FROM NET.dbo.SOP30200 WHERE SOPNUMBE = @SOPID--Header Detail

    SELECT DEX_ROW_ID FROM NET.dbo.SOP30300 WHERE SOPNUMBE = @SOPID--Line Detail

    --Clone history Invoice to work table

    INSERT INTO NET.dbo.SOP10100

    SELECT SOPTYPE, @SOPIDTemp, ORIGTYPE, ORIGNUMB, DOCID, DOCDATE, GLPOSTDT, QUOTEDAT, QUOEXPDA, ORDRDATE, INVODATE, BACKDATE, RETUDATE, ReqShipDate, FUFILDAT, ACTLSHIP, DISCDATE, DUEDATE, REPTING, TRXFREQU, TIMEREPD, TIMETREP, DYSTINCR, DTLSTREP, DSTBTCH1, DSTBTCH2, USDOCID1, USDOCID2, DISCFRGT, ORDAVFRT, DISCMISC, ORDAVMSC, DISAVAMT, ORDAVAMT, DISCRTND, ORDISRTD, DISTKNAM, ORDISTKN, DSCPCTAM, DSCDLRAM, ORDDLRAT, DISAVTKN, ORDATKN, PYMTRMID, PRCLEVEL, LOCNCODE, BCHSOURC, BACHNUMB, CUSTNMBR, CUSTNAME, CSTPONBR, PROSPECT, MSTRNUMB, PCKSLPNO, PICTICNU, MRKDNAMT, ORMRKDAM, PRBTADCD, PRSTADCD, CNTCPRSN, ShipToName, ADDRESS1, ADDRESS2, ADDRESS3, CITY, STATE, ZIPCODE, CCode, COUNTRY, PHNUMBR1, PHNUMBR2, PHONE3, FAXNUMBR, COMAPPTO, COMMAMNT, OCOMMAMT, CMMSLAMT, ORCOSAMT, NCOMAMNT, ORNCMAMT, SHIPMTHD, TRDISAMT, ORTDISAM, TRDISPCT, SUBTOTAL, ORSUBTOT, REMSUBTO, OREMSUBT, EXTDCOST, OREXTCST, FRTAMNT, ORFRTAMT, MISCAMNT, ORMISCAMT, TXENGCLD, TAXEXMT1, TAXEXMT2, TXRGNNUM, TAXSCHID, TXSCHSRC, BSIVCTTL, FRTSCHID, FRTTXAMT, ORFRTTAX, FRGTTXBL, MSCSCHID, MSCTXAMT, ORMSCTAX, MISCTXBL, BKTFRTAM, ORBKTFRT, BKTMSCAM, ORBKTMSC, BCKTXAMT, OBTAXAMT, TXBTXAMT, OTAXTAMT, TAXAMNT, ORTAXAMT, ECTRX, DOCAMNT, ORDOCAMT, PYMTRCVD, ORPMTRVD, DEPRECVD, ORDEPRVD, CODAMNT, ORCODAMT, ACCTAMNT, ORACTAMT, SALSTERR, SLPRSNID, UPSZONE, TIMESPRT, PSTGSTUS, VOIDSTTS, ALLOCABY, NOTEINDX, CURNCYID, CURRNIDX, RATETPID, EXGTBLID, XCHGRATE, DENXRATE, EXCHDATE, TIME1, RTCLCMTD, MCTRXSTT, TRXSORCE, SOPHDRE1, SOPHDRE2, SOPLNERR, SOPHDRFL,  COMMNTID, REFRENCE, POSTEDDT, PTDUSRID, USER2ENT, CREATDDT, MODIFDT, Tax_Date, APLYWITH, WITHHAMT, SHPPGDOC, CORRCTN, SIMPLIFD,  DOCNCORR, SEQNCORR, SALEDATE,  EXCEPTIONALDEMAND, Flags,      SOPSTATUS, SHIPCOMPLETE, DIRECTDEBIT

    FROM NET.dbo.SOP30200 WHERE SOPNUMBE = @SOPID

    --Clone history lines to work table

    INSERT INTO NET.dbo.SOP10200

    SELECT SOPTYPE, @SOPIDTemp, LNITMSEQ, CMPNTSEQ, ITEMNMBR, ITEMDESC, NONINVEN, DROPSHIP, UOFM, LOCNCODE, UNITCOST, ORUNTCST, UNITPRCE, ORUNTPRC, XTNDPRCE, OXTNDPRC, REMPRICE, OREPRICE, EXTDCOST, OREXTCST, MRKDNAMT, ORMRKDAM, MRKDNPCT, MRKDNTYP, INVINDX, CSLSINDX, SLSINDX, MKDNINDX, RTNSINDX, INUSINDX, INSRINDX, DMGDINDX, ITMTSHID, IVITMTXB, BKTSLSAM, ORBKTSLS, TAXAMNT, ORTAXAMT, TXBTXAMT, OTAXTAMT, BSIVCTTL, TRDISAMT, ORTDISAM, DISCSALE, ORDAVSLS, QUANTITY, ATYALLOC, QTYINSVC, QTYINUSE, QTYDMGED, QTYRTRND, QTYONHND, QTYCANCE, QTYCANOT, QTYORDER, QTYPRBAC, QTYPRBOO, QTYPRINV, QTYPRORD, QTYPRVRECVD, QTYRECVD, QTYREMAI, QTYREMBO, QTYTBAOR, QTYTOINV, QTYTORDR, QTYFULFI, QTYSLCTD, QTYBSUOM, EXTQTYAL, EXTQTYSEL, ReqShipDate, FUFILDAT, ACTLSHIP, SHIPMTHD, SALSTERR, SLPRSNID, PRCLEVEL, COMMNTID, BRKFLD1, BRKFLD2, BRKFLD3, CURRNIDX, TRXSORCE, SOPLNERR, DOCNCORR, ORGSEQNM, ITEMCODE, PURCHSTAT, DECPLQTY, DECPLCUR, ODECPLCU, EXCEPTIONALDEMAND, TAXSCHID, TXSCHSRC, PRSTADCD, ShipToName, CNTCPRSN, ADDRESS1, ADDRESS2, ADDRESS3, CITY, STATE, ZIPCODE, CCode, COUNTRY, PHONE1, PHONE2, PHONE3, FAXNUMBR, Flags, CONTNBR, CONTLNSEQNBR, CONTSTARTDTE, CONTENDDTE, CONTITEMNBR, CONTSERIALNBR, ISLINEINTRA

    FROM NET.dbo.SOP30300 WHERE SOPNUMBE = @SOPID

    --Delete History Header

    DELETE FROM NET.dbo.SOP30200 WHERE DEX_ROW_ID=@DEX_ROW_ID_Header

    --Delete History Line Items

    DELETE FROM NET.dbo.SOP30300 WHERE  SOPNUMBE = @SOPID

    --Remove Temporary ! sysmbol from Invoice ID in work tables

    Update  NET.dbo.SOP10100 SET SOPNUMBE=REPLACE(SOPNUMBE,'!','') WHERE SOPNUMBE = @SOPIDTemp

    Update  NET.dbo.SOP10200 SET SOPNUMBE=REPLACE(SOPNUMBE,'!','') WHERE SOPNUMBE = @SOPIDTemp

    --Remove Receivables Management Data

    DELETE FROM NET.dbo.RM00401 WHERE DOCNUMBR =  @SOPID

    --NOTE This does nothing for distributions. Script written for when a work invoice has been posted partially

    --Distributions where never moded.

    --SOP10102 – GL Distributions Work and History

  • L Vail Profile Picture
    L Vail 65,271 on at
    RE: SOP transaction in History, but missing distributions and not in GL

    Hi Jay,

    I would be very tempted to just change it with SQL and move on. I'm not usually a supporter of this sort of thing, but sometimes it's just not worth the effort. Maybe it's just too late for me and I'm tired. :)

    Leslie

  • RE: SOP transaction in History, but missing distributions and not in GL

    We thought about that, but we also use WennSoft for job costing, which links up with SOP making some reports we use not tie out, so it was important that the distributions were there.

  • L Vail Profile Picture
    L Vail 65,271 on at
    RE: SOP transaction in History, but missing distributions and not in GL

    Hi,

    I'm probably going to sound dumb here, but if your SOP records are OK (except for the missing distribution), and your A/R Trial Balance is OK, why not just make the journal entry to record it in GL?

    Kind regards,

    Leslie

  • gpyoungguns Profile Picture
    gpyoungguns 115 on at
    RE: SOP transaction in History, but missing distributions and not in GL

    Good catch! This is definitely a good script to keep handy!

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,409 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans