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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics GP (Archived)

Freight

(0) ShareShare
ReportReport
Posted on by 580

I have a task that involves obtaining freight information from Dynamics GP tables directly. I’m having some issues finding documentation on what I need… Below I have a few joins with the GL and POP tables. The first report is “Freight overview by type”, I’m having an issue finding how to distinguish between Intercompany, Purchases, returns and sales (must be a bit column). Below is what the report should look like (excuse the bad formatting), and my SQL so far… What am I missing in my join or what fields should I be referencing?

FREIGHT OVERVIEW BY TYPE

Sum of AMOUNT MONTH

SEGMENT DESC 2013_JAN 2013_FEB 2013_MAR 2013_APR Grand Total

       _________________________________________________________________

FREIGHT-INTERCOMPANY 32,406 23,394 23,550 24,200 103,550

FREIGHT-PURCHASES 110,492 108,009 101,082 93,796 413,379

FREIGHT-RETURNS 304 1,415 6,675 1,248 9,642

FREIGHT-SALES 71,870 86,254 71,763 71,624 301,511

       ________________________________________________________________

Grand Total 215,072 219,072 203,069 190,867 828,081

My SQL:

SELECT distinct

glam.ACTDESCR

FROM

 GL00105 aim--act indx mastr

INNER JOIN  

 GL00100 glam  --gl acct mstr

   ON glam.ACTINDX = aim.ACTINDX

INNER JOIN

 PM30600 glDist --DIST HIST

   ON glDist.DSTINDX = glam.ACTINDX

INNER JOIN

 PM30200 pth --PAID TRAN HIST

   ON pth.VCHRNMBR = glDist.VCHRNMBR

INNER JOIN

 POP30100 poh --po hist

   ON poh.PONUMBER = pth.PORDNMBR

INNER JOIN

 POP30310 rlh --Receipt Line Hist

   ON rlh.PONUMBER = poh.PONUMBER

WHERE

 glam.ACTDESCR like '%freight%'

 i was looking in GL00100 .ACTDESCR for the freight type... but it doesn't look like this method will work

*This post is locked for comments

I have the same question (0)
  • Donald Leary Profile Picture
    580 on at

    i may be getting somewhere... GL00100.ACTNUMBR_2 contains:

    --5260 = purchases

    --5300 = sales

    --5280 = returns

    --5225 = intercompany

    i obtained the definitions from a co-worker... now just to get the related POP/SOP tables to display figures by month...

  • Verified answer
    Victoria Yudin Profile Picture
    22,769 on at

    Donald,

    Do you need the POP and PM tables, or can you just use the GL20000 table and use the account numbers you got from your co-worker? (You might need to add in GL30000 if you need to look at historical years as well.)

    So...something like the following:

    SELECT g.Segment,
    SUM(CASE WHEN YEAR(g.TRXDATE) = 2013 AND MONTH(g.TRXDATE) = 1 THEN g.Freight ELSE 0 END) [2013_Jan],
    SUM(CASE WHEN YEAR(g.TRXDATE) = 2013 AND MONTH(g.TRXDATE) = 2 THEN g.Freight ELSE 0 END) [2013_Feb],
    SUM(CASE WHEN YEAR(g.TRXDATE) = 2013 AND MONTH(g.TRXDATE) = 3 THEN g.Freight ELSE 0 END) [2013_Mar],
    SUM(CASE WHEN YEAR(g.TRXDATE) = 2013 AND MONTH(g.TRXDATE) = 4 THEN g.Freight ELSE 0 END) [2013_Apr]
    FROM
    (SELECT gl.TRXDATE, (gl.DEBITAMT-gl.CRDTAMNT) Freight,
    CASE a.ACTNUMBR_2 -- change this to your GL segment with the natural account
    WHEN '5260' THEN 'Purchases'
    WHEN '5300' THEN 'Sales'
    WHEN '5280' THEN 'Returns'
    WHEN '5225' THEN 'Intercompany'
    END Segment
    FROM GL20000 gl
    INNER JOIN GL00100 a
    ON a.ACTINDX = gl.ACTINDX
    WHERE a.ACTNUMBR_2 -- change this to your GL segment with the natural account
    IN ('5260','5300','5280','5225')) g
    GROUP BY g.Segment

  • Donald Leary Profile Picture
    580 on at

    Hi Victoria,

    Thank you for you reply and the great tip. I'm very new to Dynamics GP (done most dev work with eConnect). I've been reading the GP SDK (10) documentation and it doesn't seem to be as informative as version 11 (i'm sure there have been changes in 11 that may be irreverent to 10, version 11 has great vizio diagrams, but doesn't show most table relationships) .  I was informed that i will need the POP tables (specifically PM30200 and PM30100, need historical data as well). I have an excel pivot table that contains the exact data along with some reporting examples if i could send that to you? Within this spreadsheet is a list of all the data i need to create this "skeleton" query, it was created by some process in GP by our accountant I'm just unaware where all this data i need is located... the accountant is also unaware of the exact tables the data resides...

  • Donald Leary Profile Picture
    580 on at

    and yes, i also need the PM tables to get vendor info

  • Victoria Yudin Profile Picture
    22,769 on at

    Donald,

    Not to be picky, but POP and PM are actually two different modules and two different sets of tables. :-)  

    Here are some links that might be helpful for the future:

    POP tables: victoriayudin.com/.../pop-tables

    PM tables: victoriayudin.com/.../pm-tables

    Also, I don't seem to have a PM30100 table in my databases, are you sure that's right? Here is a view that will give you all posted payables transactions (both open and history) - you might find a lot of what you need here: victoriayudin.com/.../sql-view-for-all-posted-payables-transactions-in-dynamics-gp

    And the SDK is definitely not the most straightforward tool to use, so don't feel bad about not finding all your answers there.

    If there are still columns of data you cannot find, can you list them in here and I will try to help you find them?

  • Donald Leary Profile Picture
    580 on at

    Yes, POP having PO info and PM having mostly vendor info ( which i originally obtained from your site :)  ).

    I'm sorry, the table is actually POP30100.

    Here is an example taken out of an excel pivot table created in GP (why doesn't excel expose the data locations? Lets blame MS...)

    Journal Entry Series TRX Date Account Number Account Description Debit Amount Credit Amount Reference Description Main Account Segment Originating Master ID Originating Master Name Originating Control Number AMOUNT MONTH SEGMENT DESC GL Account Location Main Seg Department Sub Data 1 Data 2 Data 3 P&L Category P&L Detail Desc Dept Name AP Invoice  Invoice Amt  PO /SALES QUOTE # Customer/Vendor Pieces Buyer Group Vendor ID PO # FOOTPRINT INFO Per Piece FRT
    215051 Purchasing 1/23/2013 01-2200-110-004-00 FREIGHT-SALES 119.36 0 42844 Purchases 2200 ADUIE A. DUIE PYLE, INC. 00093322 119.36 2013_JAN FREIGHT-SALES 01-2200-110-004-00 01 2200 110 4 110-004-00 004-00 00 03. Cost of Goods Sold 04. Freight 110- ELECTRICAL 224145522 119.36   A&E #N/A   A&E 42822 #N/A #N/A
  • Donald Leary Profile Picture
    580 on at

    not sure why the table gets cut off, but if you select top to bottom with your mouse you can paste in excel...

    Thank you!!

  • Victoria Yudin Profile Picture
    22,769 on at

    Donald, you know where some of these are, right? Can you let me know which ones you're missing or cannot find? :-)

  • Donald Leary Profile Picture
    580 on at

    Absolutely, sorry about that!

    I need P&L Category, P&L Detail Desc, Dept Name (this may come from our Inv DB...???),  AP Invoice, PO/Sales Qoute #, Cust/Vendor, Pieces (may come from our Inv DB), Vendoe ID and Per Piece FRT.

    Something funky was going on with my original code above, possibly bad join somewhere but the query would take forever to run...

    I really appreciate your help!!

  • Donald Leary Profile Picture
    580 on at

    Hi Victoria,

    You have been a great help! I have come quite far with the query, just missing a few fields.

    Query:

    SELECT

     LTRIM(RTRIM(gl.JRNENTRY)) 'JournalEntry',

     CASE LTRIM(RTRIM(gl.SERIES))

       WHEN 2 THEN 'Financial'

       WHEN 3 THEN 'Sales'

       WHEN 4 THEN 'Purchasing'

       END SERIES,

    gl.TRXDATE,

    LTRIM(RTRIM(a.ACTNUMBR_1)) + '-' +

     LTRIM(RTRIM(a.ACTNUMBR_2)) + '-' +

     LTRIM(RTRIM(a.ACTNUMBR_3)) + '-' +

     LTRIM(RTRIM(a.ACTNUMBR_4)) + '-' +

     LTRIM(RTRIM(a.ACTNUMBR_5)) 'AccountNumber',

    a.ACTDESCR 'AccountDescription',

    gl.DEBITAMT,

    gl.CRDTAMNT,

    gl.REFRENCE,

    gl.DSCRIPTN,

    a.ACTNUMBR_2 'MainAccountSegment',

    gl.ORMSTRID,

    gl.ORMSTRNM,

    gl.ORCTRNUM,

    gl.DEBITAMT - gl.CRDTAMNT 'Amount',

    MONTH(gl.JRNENTRY) 'Month',

    CASE LTRIM(RTRIM(a.ACTNUMBR_2))

       WHEN 5280 THEN 'FREIGHT-RETURNS'

       WHEN 5225 THEN 'FREIGHT-INTERCOMPANY'

       WHEN 5260 THEN 'FREIGHT-PURCHASES'

       WHEN 5300 THEN 'FREIGHT-SALES'

       END SegmentDesc,

     'TO DO' 'Location',

     LTRIM(RTRIM(a.ACTNUMBR_2)) 'MainSegment',

     LTRIM(RTRIM(a.ACTNUMBR_3)) 'Department',

     LTRIM(RTRIM(a.ACTNUMBR_4)) 'Sub',

     LTRIM(RTRIM(a.ACTNUMBR_3)) + '-' +

       LTRIM(RTRIM(a.ACTNUMBR_4)) + '-' +

       LTRIM(RTRIM(a.ACTNUMBR_5)) 'Data1',

     LTRIM(RTRIM(a.ACTNUMBR_4)) + '-' +

       LTRIM(RTRIM(a.ACTNUMBR_5)) 'Data2',

     LTRIM(RTRIM(a.ACTNUMBR_5)) 'Data3',

     (SELECT ACCATDSC FROM GL00102 WHERE ACCATNUM = a.ACCATNUM) 'P&L_Category'

    FROM GL20000 gl

     INNER JOIN

     GL00100 a

       ON LTRIM(RTRIM(a.ACTINDX)) = LTRIM(RTRIM(gl.ACTINDX))

    WHERE

     LTRIM(RTRIM(a.ACTNUMBR_2)) IN ('5260','5300','5280','5225') AND

     gl.SERIES IN (2, 3, 4) AND -- finan, sales, purch

     LTRIM(RTRIM(gl.JRNENTRY)) = 215051

    I was able to map the "P&L Category", which ended up being GL00100.ACCATNUM, i then mapped it from the legend table GL00102 (which i obtained from your site :)  ).  I now need to join a PM table to the GL to get "AP Invoice" and "Invoice Amount"... 

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

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