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
Yes MICK you killed it. This has unlocked my mindset. I've got an idea now. Big up!!!!
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
How can I join sy01500 to GL tables?
RomRyan
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!!!
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
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
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!!!
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,253 Super User 2024 Season 2
Martin Dráb 230,188 Most Valuable Professional
nmaenpaa 101,156