Skip to main content

Notifications

Microsoft Dynamics GP (Archived)

gl TABLE AND COMPANY ID

Posted on by

Dear All,

How can I link my GL queries to CompanyID, such that if I put company id parameter I can print any report from selected company.

I don't want to create 30 reports.

Regards, 

RomRyan

*This post is locked for comments

  • Romryan Profile Picture
    Romryan on at
    RE: gl TABLE AND COMPANY ID

    Yes MICK you killed it. This has unlocked my mindset. I've got an idea now. Big up!!!!

  • Verified answer
    Mick Egan Profile Picture
    Mick Egan 3,557 on at
    RE: gl TABLE AND COMPANY ID

    Romryan,

    Something like this maybe:

    SELECT a.JRNENTRY, b.INTERID FROM TWO.dbo.GL20000 a

    CROSS JOIN

    DYNAMICS.dbo.SY01500 b WHERE b.INTERID = 'TWO'

    UNION ALL

    SELECT a.JRNENTRY, b.INTERID FROM THREE.dbo.GL20000 a

    CROSS JOIN

    DYNAMICS.dbo.SY01500 b  WHERE b.INTERID = 'THREE'

    If you installed the Analysis Cubes, you could just use the GLTransactions Table in the DynamicsGPWarehouse Database.

    Regards,

    Mick

  • Romryan Profile Picture
    Romryan on at
    RE: gl TABLE AND COMPANY ID

    How can I join sy01500 to GL tables?

    RomRyan

  • Suggested answer
    soma Profile Picture
    soma 24,406 on at
    RE: gl TABLE AND COMPANY ID

    Get the company ID from GP system database table SY01500 and pass the inter id with using parameter query in ssrs report.

    Hope this helps!!!

  • RogerRogerATX Profile Picture
    RogerRogerATX 1,515 on at
    RE: gl TABLE AND COMPANY ID

    RomRyan,

    I usually use a cursor to go through the companies* in the DYNAMICS..SY01500.   You could convert your script to an sproc that is dynamic (see the example above) that will insert the db name to the tables and execute it after it gets the dbname.

    and the dbname could be a parameter in SSRS so the user can pull that first, and then the sproc would run with that company selected.

    * our business need has multiple cursors/groups of companies so it's more complex but it still works

  • Romryan Profile Picture
    Romryan on at
    RE: gl TABLE AND COMPANY ID

    Soma,

    I just need to link my script for GL transactions to a table that has company id but on GL side I cant get cmpanyid or interid.

    RomRyan

  • Suggested answer
    soma Profile Picture
    soma 24,406 on at
    RE: gl TABLE AND COMPANY ID

    Use the code like below.

    CREATE PROCEDURE VENDOR_MSTR @INTERID VARCHAR(MAX)

    AS

    BEGIN

    DECLARE @SQLREC NVARCHAR(MAX)

    SET @SQLREC = ''

    SET @SQLREC = 'SELECT * from  '+@INTERID+'..PM00200'

    EXECUTE  sp_executesql @SQLREC

    END

    Note: Instead of table PM00200 you can use SQL view

    Hope this helps!!!

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans