web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Microsoft Dynamics GP (Archived)

How to join POP30310 and POP10100 tables to GL10000, GL20000 , GL30000 and GL10001 tables in Dynamics GP 10

(0) ShareShare
ReportReport
Posted on by 85

Shown below are the SQL FROM statements from a VIEW I have created to show all transactions. I need to add the PO Number and Requisition number associated with the transactions.

Can someone show me the appropriate JOIN ON statements to connect to POP30310 to get the PONUMBER field and to POP10100 to get the CONFIRM1 field?

I have been able to link the tables but am getting duplicate records. I am not providing the appropriate JOIN statements and don't know which fields should be used for the JOIN. If someone could show me the appropriate JOIN statements I would be very grateful. If there is any documents showing which fields should be used to join various tables I would also be very greatful.

Thanks,

Lee

---------------------------------------------------------------------------- SQL statements follow ---------------------------------------

 

SELECT ....

FROM                      GL10001 AS [Unposted Trans] ( NOLOCK ) 

        INNER JOIN GL10000   AS [GL Work]             ( NOLOCK ) ON [GL Work].jrnentry                  = [Unposted Trans].jrnentry       

         INNER JOIN GL00105  AS IndexMSTR          ( NOLOCK ) ON [Unposted Trans].ACTINDX   = IndexMSTR.ACTINDX        

        INNER JOIN GL00100   AS AccountMSTR      ( NOLOCK ) ON IndexMSTR.ACTINDX           = AccountMSTR.ACTINDX      

        INNER JOIN GL00102   AS CategoryMSTR    ( NOLOCK ) ON AccountMSTR.ACCATNUM   = CategoryMSTR.ACCATNUM

 

UNION

 

SELECT ....

FROM                  GL20000 AS [Open Trans]        ( NOLOCK )    

       INNER JOIN GL00105 AS IndexMSTR          ( NOLOCK )  ON [Open Trans].ACTINDX        = IndexMSTR.ACTINDX       

       INNER JOIN GL00100 AS AccountMSTR      ( NOLOCK )  ON IndexMSTR.ACTINDX          = AccountMSTR.ACTINDX      

       INNER JOIN GL00102 AS CategoryMSTR    ( NOLOCK )  ON AccountMSTR.ACCATNUM = CategoryMSTR.ACCATNUM

        

UNION

 

SELECT ....

FROM                  GL30000 AS [History Trans]    ( NOLOCK )      

       INNER JOIN GL00105 AS IndexMSTR        ( NOLOCK ) ON [History Trans].ACTINDX         = IndexMSTR.ACTINDX       

       INNER JOIN GL00100 AS AccountMSTR    ( NOLOCK ) ON IndexMSTR.ACTINDX             = AccountMSTR.ACTINDX     

       INNER JOIN GL00102 AS CategoryMSTR   ( NOLOCK ) ON AccountMSTR.ACCATNUM    = CategoryMSTR.ACCATNUM

 

*This post is locked for comments

I have the same question (0)
  • Verified answer
    MG-16101311-0 Profile Picture
    26,225 on at

    with poRct as (

    select rctLine.POPRCTNM, rctLine.PONUMBER, rctLine.ITEMNMBR, rctLine.ITEMDESC, rctLine.UNITCOST, rctLine.EXTDCOST, rctLine.UOFM, poHdr.VENDORID, poHdr.CONFIRM1  from (

    select POPRCTNM, PONUMBER, ITEMNMBR, ITEMDESC, UNITCOST, EXTDCOST, UOFM  from POP30310

    union all

    select POPRCTNM, PONUMBER, ITEMNMBR, ITEMDESC, UNITCOST, EXTDCOST, UOFM  from POP10310

    ) rctLine left outer join (

    SELECT PONUMBER, VENDORID, CONFIRM1 FROM POP30100

    UNION ALL

    SELECT PONUMBER, VENDORID, CONFIRM1 FROM POP10100

    ) poHdr on (rctLine.PONUMBER = poHdr.PONUMBER)

    ),

    glTrx as (

    select 'Work' as Source, a.JRNENTRY, b.TRXDATE, a.ACTINDX, a.DEBITAMT, a.CRDTAMNT, a.ORMSTRID, a.ORDOCNUM from GL10001 a

    LEFT OUTER JOIN GL10000 b ON (a.JRNENTRY = b.JRNENTRY)

    UNION ALL

    select 'Open' as Source, JRNENTRY, TRXDATE, ACTINDX, DEBITAMT, CRDTAMNT, ORMSTRID, ORDOCNUM  FROM GL20000

    UNION ALL

    select 'Hist' as Source, JRNENTRY, TRXDATE, ACTINDX, DEBITAMT, CRDTAMNT, ORMSTRID, ORDOCNUM  FROM GL30000

    )

    SELECT gl.Source, gl.JRNENTRY, gl.TRXDATE, a.ACTNUMST, b.ACTDESCR, c.ACCATDSC, gl.DEBITAMT, gl.CRDTAMNT, gl.ORMSTRID, gl.ORDOCNUM, po.CONFIRM1

    FROM glTrx gl

    LEFT OUTER JOIN poRct po ON (gl.ORMSTRID = po.VENDORID) AND (gl.ORDOCNUM = po.POPRCTNM)

    LEFT OUTER JOIN GL00105 a ON (gl.ACTINDX = a.ACTINDX)

    LEFT OUTER JOIN GL00100 b ON (gl.ACTINDX = b.ACTINDX)

    LEFT OUTER JOIN GL00102 c ON (b.ACCATNUM = c.ACCATNUM)

    You may also want to consider restricting your GL info to the purchasing series only.

  • lbright Profile Picture
    85 on at

    Mariano,

    Your SQL helped a lot!! However, I also need to selected based on a value in  the GL10001.dscriptn field. Once a transaction is posted, where does the gl10001.dscriptn field get stored in GL10000,GL20000 and GL30000?

  • Verified answer
    MG-16101311-0 Profile Picture
    26,225 on at

    You got your terminology all mixed up. Unposted GL transactions (journal entries) remain in the GL10000 (Transaction Header) and GL10001 (transaction detail) until, well, they are posted. Once a GL journal is posted, header and detail records are left joined to produce a single entry per distribution account into the GL20000 table. The GL20000 table contains journals for all open year(s). When the year-end procedure is performed and the year is closed in GP, the records in GL20000 move to the GL30000 table (history) for the year that was closed.

    The Description column is common to GL10001, GL20000, and GL30000. So when you post a journal or close a fiscal year, the value follows through.

  • Suggested answer
    soma Profile Picture
    24,410 on at

    lbright,

    The GL10000 table contains the header details about the GL transactions and the table GL 10001 contains the work detail line records like jrnentry,dscriptn,creditamt,debitamt and etc.,

    Once a transaction is posted, the GL open transactions details will be created in GL20000 table.

    The number of records created in the table GL20000 is equal to the detail line records available from the table GL10001.

    If you post a transaction with 10 distributions, then 10 open transactions will be crated in GL20000 table.

    So, the GL10001.dscriptn field values will be stored in both GL20000 and GL30000 table.

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

News and Announcements

Season of Giving Solutions is Here!

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics GP (Archived)

#1
mtabor Profile Picture

mtabor 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans