概要 この記事では、Microsoft Business Solutions - Great Plains Dexterity ベースのプログラムSQLテーブルを作成する方法について説明します。詳細 :thefollowingsteps を使用して、Dexterity で記述SQL統合サード パーティ プログラムに存在するテーブルを 作成します。 これらの手順では、これらのテーブルにアクセス許可SQL付与する方法も説明します。 注意 このメソッドは、「Dexterity Programmers Guide, Volume 1」の第 41 章で説明されている amAutoGrant メソッドを置き換える方法です。1. サード パーティのプログラムに Startup という名前のグローバル プロシージャが存在しない場合は作成 します。このスクリプトは、Great Plains を起動すると実行され、通常はトリガーが登録されます。 2. スタートアップ スクリプト で、次のコードを使用して、Add_Successful_Login_Record プロシージャ トリガーを作成します。

{Name: Startup}local integer l_result; l_result = Trigger_RegisterProcedure(script Add_Successful_Login_Record, TRIGGER_AFTER_ORIGINAL, script gp_create_tables);if l_result <> SY_NOERR thenwarning "The Add_Successful_Login_Record trigger is not registered."; end if;

3. 手順 2 で作成した登録済みのトリガーは、ユーザーが Microsoft Dynamics GP にgp_create_tablesにグローバル プロシージャ を呼び出します 。 この手順は、ユーザーまたは会社が切り替えたときに、Great Plains 企業が最初に開社した場合に実行されます。4. という名前のグローバル プロシージャを作成gp_create_tables。 このスクリプトは、サード パーティ製プログラムのテーブルを適切なデータベースにSQL Serverします。 また、生成された storedprocedures (zDP procs) テーブルを作成し、テーブルとプロシージャに SQLアクセス許可を付与します。次のコードを使用します。

{Name: gp_create_tables} local boolean result,l_result,OUT_Access; {if logged in as sa, let them create the tables} if 'SQLSaUser' of globals then OUT_Access = true; else {This else statement will work only on 8.0. If logged in as a user other than sa, but they have table access permissions, let them create the tables} if syUserInRole('User ID' of globals, ROLE_SYSADMIN) or (syUserIsDBO ('User ID' of globals, 'Intercompany ID' of globals)   and syUserIsDBO ('User ID' of globals, SQL_SYSTEM_DBNAME)) then   OUT_Access = true; end if; end if; if 'SQL Server' of globals > 0 and OUT_Access then {enable table creation mode} result = Table_SetCreateMode(true); {Do not display any table errors to the user.} result = Table_DisableErrorChecks(true); {accessing the table creates it, list all your tables here, make sure to close the tables when done} get first table GPSetup; {Purchasing series table} close table GPSetup; get first table GPSetup2; {System series table} close table GPSetup2; {now set permissions, call once for the table and once for the stored procs} {GPSetup is a purchasing series table so that will be in the company dbo} l_result = GrantAccess(physicalname(table GPSetup),false,"DYNGRP",'Intercompany ID' of globals) of form 'SQL Maintenance'; l_result = GrantAccess(physicalname(table GPSetup),true,"DYNGRP",'Intercompany ID' of globals) of form 'SQL Maintenance'; {GPSetup2 is a system series table so that will be in the DYNAMICS database} l_result = GrantAccess(physicalname(table GPSetup2),false,"DYNGRP","DYNAMICS") of form 'SQL Maintenance'; l_result = GrantAccess(physicalname(table GPSetup2),true,"DYNGRP","DYNAMICS") of form 'SQL Maintenance'; {Turn off automatic table creation.} result = Table_SetCreateMode(false); {Turn table error reporting back on.} result = Table_DisableErrorChecks(false); end if; 

5. テーブルとテーブルで生成されたストアド プロシージャは、SQL Server作成SQLアクセス許可が付与されます。このスクリプトは、SA または DYNSA ユーザーに対してのみ実行され、テーブルの作成後にこのスクリプトを再度実行しても問題ありません。この記事は TechKnowledge Document ID:33429 でした

TechKnowledge コンテンツ

ヘルプを表示

その他のオプションが必要ですか?

サブスクリプションの特典の参照、トレーニング コースの閲覧、デバイスのセキュリティ保護方法などについて説明します。