Upload
gotthard-martin
View
104
Download
1
Embed Size (px)
Citation preview
SAP Business One E-Commerce and Web CRM Synch Plug-in Essentials
Shane Hart, Webtools March 5, 2008
Please note that we are recording this session
© SAP 2007 / Page 2
1. Prerequisites & Introduction1.1. Objectives1.2. Required Development Skills
2. Synchronization Basics 2.1. The Synch Queues2.2. The Synch Process
3. Synch Plug-in3.1. Plug-in Architecture3.2. Plug-in Processing3.3. SBOQueueObject3.4. NPQueueObject
4. Synch Plug-in Test Project4.1. Setting up the Plug-in Test Application4.2. Import Synch Config4.3. Debug your Plug-in4.4. 624 Code Amendment4.5. Deploying the Plug-in
Agenda
© SAP 2007 / Page 3
Introduction
Objectives Understand synch architecture Understand the SynchPlugin abstract class Understand testing and deployment of the synch plug-in
© SAP 2007 / Page 4
Prerequisites
Required Software Development Knowledge Familiarity with Visual Studio .NET, C# and basic OO concepts Basic knowledge of the Webtools/Business One synchronization process Familiarity with the Business One DI API Familiarity with the Webtools API
© SAP 2007 / Page 5
1. Prerequisites & Introduction1.1. Required Development Skills1.2. Objectives
2. Synchronization Basics 2.1. PRX_Transaction_Queue2.2. TransactionQueue2.3. The Synch Process
3. Synch Plug-in3.1. The Plug-in Architecture3.2. Plug-in Processing3.3. SBOQueueObject3.4. NPQueueObject
4. Synch Plug-in Test Project4.1. Setting up the Plug-in Test Project4.2. Import Synch Config4.3. Debug Your Plug-in4.4. 624 Code Amendment4.5. Deploying the Plug-in
Agenda
© SAP 2007 / Page 6
Synchronization Basics
The Business One Queue - PRX_Transaction_Queue Queue Fields
object_type- BoObjectTypes in DI API documentation
transaction_type- [A]dd, [U]pdate, [D]elete, [C]ancel, c[L]ose
num_of_cols_in_key list_of_key_cols_tab_del list_of_cols_vals_tab_del tmstmp synchstatus syncherror
- InQueue (and null), Failed, Skip
SBO_SP_TransactionNotification Populates the queue. Documentation
Synchronization Basics
© SAP 2007 / Page 7
The Webtools Queue - TransactionQueue Queue Fields
ObjectType- Netpoint.api DAO class name.
TransactionType- [A]dd, [U]pdate, [D]elete
KeyFieldNames KeyFieldValues TimeStamp SynchStatus
- InQueue (and null), Failed, Skip
SynchError
NPBase in the netpoint.api is responsible for logging to the TransactionQueue.
Synchronization Basics
Synch Process – What happens behind the scenes Run upgrade script – runs based on NPVersion SynchVersion Create .lock file – prevents the synch from starting while another is running Load queues – load data from PRX_Transaction_Queue and TransactionQueue Run PluginExecutionLocation.BeforeSynch Synch pricelists Synch Synch inventory Run PluginExecutionLocation.AfterSynch Clear queues – delete successfully synchronized data from the queues Delete .lock file
© SAP 2007 / Page 8
© SAP 2007 / Page 9
1. Prerequisites & Introduction1.1. Required Development Skills1.2. Objectives
2. Synchronization Basics2.1. PRX_Transaction_Queue2.2. TransactionQueue2.3. Synch Process
3. Synch Plug-in3.1. The Plug-in Architecture3.2. Plug-in Processing3.3. SBOQueueObject3.4. NPQueueObject
4. Synch Plug-in Test Project4.1. Setting up the Plug-in Test Project4.2. Import Synch Config4.3. Debug You Plug-in4.4. 624 Code Amendment4.5. Deploying the Plug-in
Agenda
Synch Plug-in
Netpoint.SynchSBO.SynchPlugin Architecture Key Concepts
Synch Plug-ins must inherit the SynchPlugin abstract class The plug-in can operate on only one queue at a time The plug-in operates on one record at a time, which is passed to the plug-in from the synch
The Constructor NPSecurityTicket – Object holding information from the synchconfig.xml Company – The Business One company that this plug-in will synch to
Properties Name – The name used to identify the plug-in in the synch log SynchType – The queue type (business partner, item…) that the plug-in is requesting SynchRunTime – The plug-in code can run before or after the synch. Defaults to AfterSynch
Methods B1ToWebTools
Data is passed by the synch, one record at time in a SBOQueueObject which is a DAO wrapper to PRX_Transaction_Queue from the B1 database
WebtoolsToB1
Data is passed by the synch, one record at a time in the a NPQueueObject which is a wrapper to TransactionQueue from the WT database
© SAP 2007 / Page 10
© SAP 2007 / Page 11
Synch Plug-in
Plug-in Processing Key Concepts
The plug-in must inherit the Netpoint.SynchSBO.SynchPlugin abstract class The plug-in must be compiled into a DLL. The compiled DLL must be placed in the plug-ins directory. Typically, C:\Program Files\SAP\SAP Business One Web Tools\SynchManager\plugins Plug-ins are inefficient
How plug-ins are loaded The synch searches the plug-ins directory for any file with the .dll extension. Once the .dlls are loaded, the synch iterates every class in the assembly and creates instantiates any class that inherits the IPlugin interface
How data is passed to the plug-in The SynchType property defined by the plug-in determines which set of data will be passed to the plug-in. The specified queue will be handed to the plug-in one record at a time Data from the Business One PRX_Transaction_Queue is encapsulated in the NetPoint.SynchSBO.framework.SBOSynchObject Data from the Webtools TransactionQueue is encapsulated in the NetPoint.SynchSBO.framework.NPSynchObject
Synch Plug-in
Plug-in Processing Error handling
The plug-in should not handle errors. All errors generated by the plug-in will be recorded in the synch log.
Synch Plug-in
SBOQueueObject Namespace: NetPoint.SynchSBO.framework.SBOQueueObject Stores data for one row from the PRX_Transaction_Queue Use the DI API to get data from Business One
© SAP 2007 / Page 13
Synch Plug-in
NPQueueObject Namespace: NetPoint.SynchSBO.framework.NPQueueObject Stores data for one row from the Webtools TransactionQueue Use the netpoint.api to get data from Webtools
© SAP 2007 / Page 14
© SAP 2007 / Page 15
1. Prerequisites & Introduction1.1. Required Development Skills1.2. Objectives
2. Synchronization Basics 2.1. PRX_Transaction_Queue2.2. TransacionQueue2.3. Synch Process
3. Synch Plug-in3.1. The Plug-in Architecture3.2. Processing Plug-ins3.3. SBOQueueObject3.4. NPQueueObject
4. Synch Plug-in Test Project4.1. Setting up the Plug-in Test Project4.2. Import Synch Config4.3. Debug Your Plug-in4.4. 624 Code Amendment4.5. Deploying the Plug-in
Synch Plug-in Test Project
Synch Plug-in Test Project
Setup Plug-in Test Project The test project is provided to allow plug-in developers to step through their code prior to deployment. Copy example code to the Synch Manager directory
© SAP 2007 / Page 16
Synch Plug-in Test Project
Setup Plug-in Test Project The test project is distributed with broken references, these must be remapped to your local files to get the project to compile.
© SAP 2007 / Page 17
Synch Plug-in Test Project
Import Synch Config Copy a valid synch config file local to the project. Preferably the config file used for a previously successful synch.
Synch Plug-in Test Project
Debug Your Plug-In Select your synch profile.
Synch Plug-in Test Project
Debug Your Plug-In Select the object type that of your plug-in. Set a break point
Synch Plug-in Test Project
Debug Your Plug-In.Run the test Debug…
Synch Plug-in Test Project
Deploy the Plug-in Compile the complete plug-in Place the plug-in in the plug-ins directory of the synch manager.
C:\Program Files\SAP\SAP Business One Web Tools\Synch Manager\plugins by default
© SAP 2007 / Page 22
© SAP 2007 / Page 23
Q & A
Questions?
© SAP 2007 / Page 24
Thank you!