Site Search:
Sign in | Join | Help
4Penny.net

Dynamics GP

Notes, Tips and Tricks on Developing in Dynamics GP

April 2007 - Posts

  • RetrieveGlobals9.dll

    Microsoft has published a dll called RETRIEVEGLOBALS.DLL that can be used to access user data from inside of Dynamics GP. I'm posting the file here, along with their documentation, so that I don't have to go looking for it. You'll find a link to the file at the very bottom of this post.

    Database Connections for Modifier with VBA or Integration Manager in Microsoft Dynamics GP

     

    Summary

     

    The RetrieveGlobals9.dll is an ActiveX dll that will return the current

    User ID, the current company logged in to, the current SQL data source as well as the current user date in Microsoft Dynamics GP.  The RetrieveGlobals9.dll will also return an ADO connection object that will allow you to connect to Microsoft Dynamics GP Data.    The RetrieveGlobals9.dll will work only with version 9.0 Microsoft Dynamics GP and will only work if one session of Microsoft Dynamics GP is running and logged into.  The RetrieveGlobals9.dll is only for use in Modifier with VBA or Integration Manager that also require Microsoft Dynamics GP to be open and running. 

     

    Installation Instructions

     

    1.   Copy the RetrieveGlobals9.dll to a folder on your machine.

     

    2.   Register the RetrieveGlobals9.dll using regsvr32.exe. Go to Start-Run and enter the path to the regsvr32.exe, followed by the path and name of the DLL. For example:

     

                C:\WINDOWS\system32\regsvr32.exe “c:\GP 90\RetrieveGlobals9.dll”

     

    If the DLL registers successfully, you should get a message box indicating so.

     

    3.  Write your application code to call the RetrieveGlobals9.dll

    Using the RetrieveGlobals9.dll

     

    The retrieveuserinfo class of RetrieveGlobals9 contains the following properties and functions:

     

    intercompany_id

     

    The intercompany_id method retrieves the Company ID that is currently logged into Microsoft Dynamics GP.  This will match with the database name in MSSQL. 

    Example: “TWO”. 

     

    Syntax: intercompany_id () as String


     

    retrieve_user

     

    The retrieve_user method retrieves the User ID that is currently logged into Microsoft Dynamics GP. 

     

    Syntax: retrieve_user() as String

     

    sql_datasourcename

     

    The sql_datasourcename method retrieves the current SQL Datasource name that is being utilized by Microsoft Dynamics GP. 

     

    Syntax: sql_datasourcename () as String

     

    user_date

     

    The user_date method retrieves the User Date from the Toolbar in Microsoft Dynamics GP. 

     

    Syntax: user_date () as Date

     

    status

     

    The status property indicates whether or not a valid connection object can be obtained from the connection property.

     

    Syntax: status As Long

     

    The status property could contain the possible values:

     

    Value                           Description

    0                                  A Microsoft Dynamics session is not open

    1                                  A connection can be created

    2                                  A connection could not be created

    3                                  The current Microsoft Dynamics session is not Version 9

    131072 (&H20000)     A COM exception occurred during the connection attempt

    262144 (&H40000)     The account is locked

    65536 (&H10000)       The user’s password has expired


     

    connection

     

    The connection property contains an ADODB.Connection to the Microsoft Dynamics GP SQL Server.  This connection uses the SQL Datasource, User ID and Password credentials of the user currently logged into Microsoft Dynamics GP. This connection does not have a default database specified.

     

    Syntax:  connection As Object

     

    * The connection property will only contain a valid connection object if a Microsoft Dynamics GP 9.0 session is open and running. It should be verified that the status property has a value of 1 prior to attempting to use the connection property.

     

    Example

     Dim cn
    Dim cmd As ADODB.Command
    Dim rst As adodb.Recordset
    dim prm as adodb.parameter

    Set userinfo = CreateObject("RetrieveGlobals9.retrieveuserinfo")

    If userinfo.Status = 1 Then
        Set cn = userinfo.connection

        luserid = userinfo.retrieve_user()
        lintercompanyid = userinfo.intercompany_id()
        lsqldatasourcename = userinfo.sql_datasourcename()
        ldate = userinfo.user_date()

        'Use the connection property to get a connection object.
        Set cn = userinfo.connection

        'set the database to the currently logged in db.
        cn.DefaultDatabase = lintercompanyid

        cmd.CommandType = 4 'stored proc
        cmd.ActiveConnection = cn
        cmd.commantText = "myStoredProc"

        'add params
        cmd.parameters.add cmd.CreateParameter ("@paramname",adVarchar,adInput,21,"steve")
     
        Set rst = cmd.Execute

        while not rst.eof
            'do something

            rst.movenext
        wend


    end if


    cn.close
    set cn = nothing

     

  • Dynamics GP Payables Management (PM) Tables

    MC020103 Multicurrency Payables Transactions MC_PM_Transactions
    MC020105 Multicurrency PM Revaluation Activity MC_PM_Revaluation
    PM00100 PM Class Master File PM_Class_MSTR
    PM00101 Vendor Class Accounts pmClassAccounts
    PM00200 PM Vendor Master File PM_Vendor_MSTR
    PM00201 PM Vendor Master Summary PM_Vendor_MSTR_SUM
    PM00202 PM Vendor Master Period Summary PM_Vendor_MSTR_Period_SUM
    PM00203 Vendor Accounts pmVendorAccounts
    PM00300 PM Address MSTR PM_Address_MSTR
    PM00400 PM Key Master File PM_Key_MSTR
    PM10000 PM Transaction WORK File PM_Transaction_WORK
    PM10100 PM Distribution WORK OPEN PM_Distribution_WORK_OPEN
    PM10200 PM Apply To WORK OPEN File PM_Apply_To_WORK_OPEN
    PM10201 PM Payment Apply To Work File PM_Payment_Apply_WORK
    PM10300 PM Payment WORK PM_Payment_WORK
    PM10400 PM Manual Payment WORK File PM_Manual_Payment_WORK
    PM10500 PM Tax Work File PM_Tax_WORK
    PM10600 PM Distribution Void WORK Temporary File PM_Distribution_Void_WORK
    PM10801 PM Payment Stub Duplicate PM_Payment_Stub_Duplicate
    PM10900 Void Payment WORK Temporary File PM_Void_Payment_WORK
    PM10901 PM Void Transaction WORK Temporary File PM_Void_Transaction_WORK
    PM10902 PM Tax Void Work Temporary File PM_Tax_Void_WORK
    PM20000 PM Transaction OPEN File PM_Transaction_OPEN
    PM20100 PM Apply To OPEN OPEN Temporary File PM_Apply_To_OPEN_OPEN
    PM20200 PM Distribution OPEN OPEN Temporary File PM_Distribution_OPEN_OPEN
    PM20400 PM Scheduled Payments Header PM_SCH_HDR
    PM20401 PM Scheduled Payment LINE PM_SCH_LINE
    PM30200 PM Paid Transaction History File PM_Paid_Transaction_HIST
    PM30300 PM Apply To History File PM_Apply_To_HIST
    PM30401 PM Scheduled Payments Header History PM_SCH_HDR_HIST
    PM30600 PM Distribution History File PM_Distribution_HIST
    PM30700 PM Tax History File PM_Tax_HIST
    PM30800 PM Tax Invoices PM_Tax_Invoices
    PM40100 PM Setup File PM_SETP
    PM40101 PM Period Setup File PM_Period_SETP
    PM40102 Payables Document Types PM_Document_Type_SETP
    PM40103 Payables Distribution Type SETP PM_Distribution_Type_SETP
    PM50100 PM History Removal Tempoary File pmHistRemovalTemp
    PM70500 Purchasing Report Options PM_Options_ROPT
    PM80100 Reprint Transaction Batch Headers PM_Reprint_Batch_Headers
    PM80200 Void Reprint Void Payment WORK PM_Reprint_Void_Payment
    PM80300 PM Reprint Void Transaction WORK PM_Reprint_Void_Transaction
    PM80500 PM Reprint Posting Journal Apply To File PM_Reprint_Apply_To
    PM80600 PM Reprint Distribution PM_Reprint_Distribution
    PM80700 PM Reprint Tax PM_Reprint_Tax
    PM80800 PM Reprint Transaction Check Register File PM_Reprint_Transaction_Check
    PM80900 PM Mass Voucher Apply Temp File PM_Mass_Voucher_TEMP
    PM80905 Payables Apply Document Browse PM_Apply_Document_Browse
    PM81000 Modified Vendor Class Accounts pmModifyAccounts
    PMV0100 PM Scheduled Payment Header View PM_SCH_HDR_VIEW

    PO Workflow located here

    POP00101 Buyer Master POP_Buyer
    POP01303 POP PA Budget IV Items View POP_PA_BudgetIVItems_View
    POP10100 Purchase Order Work POP_PO
    POP10110 Purchase Order Line POP_POLine
    POP10140 Purchasing Manufacturer Numbers POP_MFG_ITM_MSTR
    POP10150 Purchase Order Comment POP_POComment
    POP10160 Purchase Order Tax POP_PO_Tax
    POP10300 Purchasing Receipt Work POP_Receipt
    POP10306 Purchasing Receipt User-Defined POP_ReceiptUserDefined
    POP10310 Purchasing Receipt Line POP_ReceiptLine
    POP10330 Purchasing Serial Lot Work POP_SerialLot
    POP10340 Purchasing Bin Quantities Work popBinWork
    POP10360 Purchasing Tax POP_Tax
    POP10390 Purchasing Distribution Work POP_Distribution
    POP10500 Purchasing Receipt Line Quantities POP_PORcptApply
    POP10550 Purchasing Comment POP_Comment
    POP10600 Purchasing Shipment Invoice Apply POP_ShipIvcApply
    POP10700 Purchasing Landed Cost popLandedCost
    POP11100 POP PA PO View POP_PA_PO_View
    POP11110 POP PA PO Line View POP_PA_POLine_View
    POP11300 POP PA Receipt View POP_PA_Receipt_View
    POP11310 POP PA Receipt Line View POP_PA_ReceiptLine_View
    POP30000 Purchasing Batch History POP_BatchHist
    POP30100 Purchase Order History POP_POHist
    POP30110 Purchase Order Line History POP_POLineHist
    POP30160 Purchase Order Tax History POP_PO_TaxHist
    POP30300 Purchasing Receipt History POP_ReceiptHist
    POP30310 Purchasing Receipt Line History POP_ReceiptLineHist
    POP30330 Purchasing Serial Lot History POP_SerialLotHist
    POP30340 Purchasing Bin Quantities History popBinHist
    POP30360 Purchasing Tax History POP_TaxHist
    POP30390 Purchasing Distribution History POP_DistributionHist
    POP30700 Purchasing Landed Cost History popLandedCostHist
    POP31100 POP PA PO Hist View POP_PA_POHist_View
    POP31110 POP PA PO Line Hist View POP_PA_POLineHist_View
    POP31300 POP PA Receipt Hist View POP_PA_ReceiptHist_View
    POP31310 POP PA Receipt Line Hist View POP_PA_ReceiptLineHist_View
    POP40100 Purchasing Setup Table POP_Setup
    POP40400 Purchasing User-Defined List Setup POP_UserDefined_Setup
    POP40600 Purchasing Non-IV Item Currency Setup popNonIVItemCurr
    POP40800 Purchase Order Generator Site Mapping popPOGenMapSites
    POP40900 Purchase Order Document Delivery Setup popDocumentDeliverySetup
    POP70100 Purchasing Process Documents List POP_ProcDocList_TEMP
    VAT10200 PM Class Intrastat MSTR PM_Class_Intrastat_MSTR
    VAT10201 PM Vendor Intrastat MSTR PM_Vendor_Intrastat_MSTR
  • Migrating Dynamics GP from one server to another

    If you need to migrate Dynamics GP from one server to another, run this series of scripts against the database. These were provided by GP, but we can't find the documentation anymore...

    As with all information in this site, this is provided 'as is'. Only use this information on a fully backed up system.

     All the files in this article are located here

     

    How to transfer an existing Microsoft Dynamics GP, Microsoft Great Plains, Microsoft Small Business Financials, or Microsoft Small Business Manager installation to a new server that is running Microsoft SQL Server

    INTRODUCTION

    This article describes how to transfer an existing Microsoft Dynamics GP, Microsoft Business Solutions - Great Plains, Microsoft Small Business Financials, or Microsoft Small Business Manager installation to a new server that is running Microsoft SQL Server 7.0, Microsoft SQL Server 2000, or Microsoft SQL Server 2005. The article also describes how to maintain the user logins and databases.

    MORE INFORMATION

    Notes

    We strongly recommend that you perform the steps that are listed in the "Transfer instructions" section in a test environment before you perform the steps in a production environment.

    The Microsoft SQL Server installation on the old server and on the new server can be Microsoft SQL Server 7.0, Microsoft SQL Server 2000, Microsoft SQL Server Desktop Engine (also known as MSDE 2000), Microsoft SQL Server 2005, or Microsoft SQL Server 2005 Express.

    This article uses "the financial application" to refer to Microsoft Dynamics GP, Microsoft Great Plains, Microsoft Small Business Financials, and Microsoft Small Business Manager.

     

    Transfer instructions

    1.

    On the old server, copy the following Capture_Logins.sql script to the local hard disk.

    2.

    On the old server, run the Capture_Logins.sql script to capture all SQL Server logins and password information. All SQL Server logins that are used by the financial application, by Microsoft Business Solutions - FRx, by Personal Data Keeper, or by any other application that is using the SQL Server installation on the old server will be captured. Follow these steps, based on the SQL Server that tools you use:

    If you use SQL Server Management Studio, follow these steps:

    a.

    Click Start, point to All Programs, point to Microsoft SQL Server 2005, and then click SQL Server Management Studio.

    b.

    In the Connect to Server window, follow these steps:

    1.

    In the Server name box, type the name of the server that is running SQL Server.

    2.

    In the Authentication box, click SQL Authentication.

    3.

    In the Login box, type sa.

    4.

    In the Password box, type the password for the sa user, and then click Connect.

    c.

    Click File, point to Open, and then click File.

    d.

    In the Look In list, click the Capture_Logins.sql script that you copied to the local hard disk in step 1, and then click Open.

    e.

    In the Connect to Database Engine window, follow these steps:

    1.

    In the Server Name box, type the name of the old server that is running SQL Server.

    2.

    In the Authentication box, click SQL Authentication.

    3.

    In the Login box, type sa.

    4.

    In the Password box, type the password for the sa user, and then click Connect.

    f.

    Click Query, point to Results to, and then click Results to File.

    g.

    Click Query, and then click Execute.

    h.

    In the Save Results window, follow these steps:

    1.

    In the Save in list, click the location where you want to save the results of the script.

    2.

    In the File name box, type SQLLOGINS.sql, and then click Save.

    If you use Query Analyzer, follow these steps:

    a.

    Click Start, point to All Programs, point to Microsoft SQL Server, and then click Query Analyzer.

    b.

    In the Connect to SQL Server window, follow these steps:

    1.

    In the SQL Server box, type the name of the old server that is running SQL Server.

    2.

    In the Connect using area, click SQL Server Authentication.

    3.

    In the Login name box, type sa.

    4.

    In the Password box, type the password for the sa user, and then click OK.

    c.

    Click File, and then click Open.

    d.

    In the Open Query File window, in the Look In list, click the Capture_Logins.sql script that you copied to the local hard disk of the old server in step 1, and then click Open.

    e.

    Click Query, and then click Results to File.

    f.

    Click Query, and then click Execute.

    g.

    In the Save Results window, follow these steps:

    1.

    In the Save in list, click the location where you want to save the results of the script.

    2.

    In the File name box, type SQLLOGINS.sql, and then click Save.

    If you use MSDE 2000 and if no SQL Server tools are available, follow these steps:

    a.

    On the server that is running MSDE, click Start, click Run, type cmd, and then click OK.

    b.

    At the command prompt, type the following script, and then press ENTER to run the script. Replace SERVERNAME with the name of the server that is running MSDE 2000. Replace SAPASSWORD with the password for the sa user.

    OSQL –S SERVERNAME –U sa –P SAPASSWORD –i