Integration Framework of SAP Business One Training Solution Architects Team March 2011 How to build a DB to B1 scenario
B1if Training: How to build a DB to B1 Scenario in B1if The following training is designed to show you how to build a DB to B1 integration scenario using B1if. When you end this training you should be able to: Build a scenario to integrate a database system to an SAP Business One System. Setup the scenario and test it for running.
Agenda Case Analysis B1 Config. Integration Setup Test BPM Diagram Create Table Fill Information Integration Scenario Package Global Properties Scenario Step Inbound Outbound Processing Setup Create system landscape Steps Sender System Receiver System Timer Set Parameter Activate Check Activation Test Message Log Debugging
Agenda Case Analysis B1 Config. Integration Setup Test BPM Diagram Create Table Fill Information Integration Scenario Package Global Properties Scenario Step Inbound Outbound Processing Setup Create system landscape Steps Sender System Receiver System Timer Set Parameter Activate Check Activation Test Message Log Debugging
Case Analysis: DB 2 B1 Integration BPM Diagram
Agenda Case Analysis B1 Config. Integration Setup Test BPM Diagram Create Table Fill Information Integration Scenario Package Global Properties Scenario Step Inbound Outbound Processing Setup Create system landscape Steps Sender System Receiver System Timer Activate Check Activation Test Message Log Debugging
B1Config: Create User Defined Table In order to store the list of Business Partners to be created in the B1 company we will use a table inside our B1 database (you could use any SQL database) Create a TableName named “INDB_TBL” with your desired description.
B1Config: Fill Information The information in the UDT “INDB_TBL” will be used to create the corresponding Business Partners during processing of the message. Code Name BP01 BP Test B1if 1 BP02 BP Test B1if 2 Note: You can use B1 Tools -> User Defined Windows in order to fill the values inside the UDT.
Agenda Case Analysis B1 Config. Integration Setup Test BPM Diagram Create Table Fill Information Integration Scenario Package Global Properties Scenario Step Inbound Outbound Processing Setup Create system landscape Steps Sender System Receiver System Timer Set Parameter Activate Check Activation Test Message Log Debugging
Integration: Scenario Package Path: Scenarios/Package Design 1 Type the Scenario Package Identifier. Do not use spaces or special characters in the identifier. (DB2B1) 2 Click on Save 1 2 Optional Step! Note: No need to create a new Scenario Package per every Scenario Step, we can insert several Scenario Steps inside a single Scenario Package. B1i will add your namespace before the Scenario identifier (check“B1if Installation” session). The package will be created in design mode after save. If you want to modify the package later on, you can use the ellipsis (…) button next to the Scenario Package Identifier textbox to select your package.
Integration: Scenario Package – Global Properties Path: Scenarios/Package Design/Definitions 1 Select Global Properties 2 Click Select 3 Click Add 4 Enter the name of the Global Property (ex: DBINSysId) 5 6 Enter a default value for the Global Property 7 Click Save 8 Click Close 1 2 3 5 4 6 7 8 In our Scenario Package the input database system id will be stored in a Global Property. During the Setup, the customer can overwrite the default value based on his system identifier.
Integration: Scenario Step Path: Scenarios/Step Design 1 Click New 2 Type the Scenario Step identifier. Do not use spaces or special characters in the identifier. (DBTBL2B1BP) 3 Using the ellipsis button (…) select the Package to which you want to assign the step (XXX.DB2B1). 4 Click Save 2 3 4 1 B1i will add your namespace before the Scenario identifier. The step will be empty and a version number will be automatically assigned for version control.
Integration: Inbound (1/2) Path: Scenarios/Step Design/Working Step/[Inbound] 1 Click Channel 2 Using the ellipsis button (…) select Void as Inbound Type 3 Click Save 4 Click Close 1 2 3 4
Integration: Inbound (2/2) 1 Click on Retrieval 2 Click Save (default values for Void will be selected) 3 Click Close 1 4
Integration: Outbound Path: Scenarios/Step Design/Working Step/[Outbound] 1 Using the ellipsis button (…) select your Scenario Step 2 Using the ellipsis button (…) select SAP Business One as Outbound Channel 3 Using the ellipsis button (…) select DI Object as Outbound Format 4 Click on Details 5 Using the ellipsis button (…) select Synchronous Insert with fallback to Update as Method 6 Using the ellipsis button (…) select Business Partners (Object ID 2) as Object Identifier 7 Click on Save 8 Click on Close 9 10 1 2 3 10 9 4 5 6 8 7
Integration: Processing (1/6) Path: Scenarios/Step Design/Working Step/[Processing] The processing is the part in which B1if transforms the inbound message to the outbound message in order to get the desired results. Each processing unit inside the scenario step is called an atom and can do different actions. By default all scenario steps have one atom (called final) associated to an XSLT file to perform the last transformation.
Integration: Processing Add Call SQL atom (2/6) Path: Scenarios/Step Design/Working Step/[Processing] 1 Click the arrow button of the first element vBIU.bfd in order to add a new atom 2 Using the combo box select CallSQL as new Flow Atom 3 Click Add 4 Click Close 1 2 4 3
Integration: Processing Configure Call SQL atom (fixed database system) (3/6) Path: Scenarios/Step Design/Working Step/[Processing] 1 Click on the pencil icon at the bottom of the first sqlCall atom. 2 Write a description for the atom 3 Using the ellipsis button (…) select a specific JDBC or B1 system. 4 Using the ellipsis button (…) select true to Stop processing the Scenario if the SQL call fails 5 Using the ellipsis button (…) select Query statement as the value for Method 6 Write the SQL statement to retrieve the BP Code of the Headquarter from the UDT (#select Code, Name from [@INDB_TBL]) 7 Click Save 1 2 3 Explain # => Explicit value Not # => Xpath All fields in all screens 4 5 6 Note: Value starting with “#” => Explicit Value Value without “#” => XPath value 1
Integration: Processing Obtain XPath of a Global Property (4/6) Path: Scenarios/Step Design/Working Step/[Processing]/[Test] 1 Click Test 2 Select a B1 system as receiver 3 Click Run 4 Click Debug 5 Click the red arrow to see the input message 6 In the list of Properties we can see our DBINSysId property 1 2 3 4 5 6 /vpf:Msg/vpf:Header/vpf:Properties/vpf:prop[./@id='DBINSysId']/@value
Integration: Processing Configure Call SQL atom (XPath database system) (5/6) Path: Scenarios/Step Design/Working Step/Processing/[SQLCall Edit] 1 Using the ellipsis button (…) you can select a specific System but you can also use Xpath values (ex: /vpf:Msg/vpf:Header/vpf:Properties/vpf:prop[./@id='DBINSysId']/@value ) 2 Click Save 3 Click Close. 2 4 3 In our Scenario Package the input database system id will be the value stored in a Global Property (previously created in Scenario Package – Global Properties step, XPath calculated in previous slide).
Integration: Processing (6/6) Path: Scenarios/Step Design/Working Step/[Processing] After the configuration the Processing diagram should be showing a green light icon at the top of the sqlCall atom. The next step is to modify the XSLT file of the Final atom using your preferred XML Editor. In order to have access to the XSLT file you should give full access to the BizStore using WebDAV. For instruction please see B1if Installation guide.
Integration: Xslt final transformation Path: http://localhost:8080/B1iXcellerator/exec/dummy/com.sap.b1i.vplatform.scenarios.design/vBIU.XXX.DBTBL2B1BP/atom0.xsl Locate the transform template tag to include your code in the xsl transform file
Integration: XSLT final transformation We create the SAP Business One Business Partners DI API XML format inside our XSLT transformation based on the Code and Name field values from the INDB_TBL table. <xsl:template name="transform"> <b1im_multimsg> <xsl:for-each select="/vpf:Msg/vpf:Body/vpf:Payload[./@Role='C' and ./@id='atom1']/jdbc:ResultSet/jdbc:Row"> <b1im_msg> <B1out xmlns="" type="object"> <BusinessPartners> <row> <CardCode><xsl:value-of select="jdbc:Code/text()"/></CardCode> <CardName><xsl:value-of select="jdbc:Name/text()"/></CardName> <Notes>Created by B1if from INDB_TBL (XXX.DBTBL2B1BP)</Notes> </row> </BusinessPartners> </B1out> </b1im_msg> </xsl:for-each> </b1im_multimsg> </xsl:template> As INDB_TBL can contain several Business Partners to be created we use the <b1im_multimsg> tab (see B1if Help -> 02 Scenario Development -> 3.3.3.4 Transformation -> Multiple Outbound Messages )
Agenda Case Analysis B1 Config. Integration Setup Test BPM Diagram Create Table Fill Information Integration Scenario Package Global Properties Scenario Step Inbound Outbound Processing Setup Create system landscape Steps Sender System Receiver System Timer Set Parameter Activate Check Activation Test Message Log Debugging
Setup SLD: Create B1 system (1/2) 3 Path: SLD/Create System 4 5 1 Click Create System 2 Select System Type B1.8.8 (or your B1 version) 3 Enter a System Name 4 Click Create 5 Select the new system 6 Click Edit 6 1 2 3 4 6 5
Setup SLD: Create B1 system (2/2) 3 Path: SLD/Create System/Select the new system 4 5 1 Enter B1 server 2 Enter B1 license server 3 Enter B1 company database 4 Select Server Type 5 Enter database user and password 6 Enter B1i user name and password 7 Enter B1 DI API jcoPath (blank should work if DI Proxy correctly configured) 8 Enter B1i DI Proxy host and port 9 Enter JDBC driver, url, username and password 10 Click Save 10 6 1 2 3 4 5 6 7 8 9
Setup SLD: Create JDBC system 2 3 Path: SLD/Create System 4 5 1 Click Create System 2 Select System Type J.AnySystem 3 Enter a System Name 4 Click Create 5 Select your new system 6 Enter the JDBC driver 7 Enter the JDBC url 8/9 Enter the database user and password 10 Click Save 6 1 2 3 4 4 5 6 7 8 9
Setup: Steps Path: Scenarios/Setup 1 2 3 4 5 6 Select your Scenario Package Identifier 2 Click on Steps 3 Click on the Activate checkbox 4 Click on the Generate checkbox 5 Click on Save 6 Close the Select Scenario Steps window 6 1 2 6 5 3 4
Setup: Sender Path: Scenarios/Setup 1 2 3 Path: Scenarios/Setup 4 5 1 No need to specify a Sender system as we defined as type Void 6
Setup: Receiver Path: Scenarios/Setup 1 2 3 4 5 6 Click on Receiver Select Maintain Receiver List from the dropdown Choose document 3 Click on Select 4 Check the receiver B1 system in the list 5 Click Save 6 Click Close 6 1 2 3 4 6 5
Setup: Timer Path: Scenarios/Setup 1 2 3 4 5 Click on Timer Click Setup 3 Enter the scheduler settings (ex: every hour) 4 Click Save 5 Click Close 6 1 3 2 5 4
Setup: Set DBIN Parameter 2 3 Path: Scenarios/Setup 4 5 1 Click on 2 Click Setup 3 Enter the scheduler settings (ex: every hour) 4 Click Save 5 Click Close 6 1 3 2 5 4
Setup: Set DBINSysId Parameter 2 3 Path: Scenarios/Setup 4 5 1 Click on Data Mgt. 2 Select Properties 3 Click Select 4 Enter the ID of your JDBC system 5 Click Save 6 1 2 3 4 5
Setup: Activate Path: Scenarios/Setup 2 3 Path: Scenarios/Setup 4 5 1 Click on Activate 2 Click on Activate on the Scenario Setup Result window 3 Confirm Operation 6 1 2 After the operation is completed the status of the Package is changed from design to activate
Setup: Check activation 2 3 Path: Scenarios/Control 4 5 6 1
Agenda Case Analysis B1 Config. Integration Setup Test BPM Diagram Create Table Fill Information Integration Scenario Package Global Properties Scenario Step Inbound Outbound Processing Setup Create system landscape Steps Sender System Receiver System Timer Set Parameter Activate Check Activation Test Message Log Debugging
Test After everything is completed you can perform the following test: Just wait for your timer to be run
Test: Message Log 2 3 Path: Monitoring/Message Log 4 5 6 The result of the tests will be displayed in the message log Select the date and time you want to check. Click on Display/Refresh button to check results 2 messages should appear in the success list, one per each Business Partner to be created. For more information about debugging check the Debugging Appendix and B1if Monitoring and Debugging presentation.
Integration: Debuging (1/3) Path: Scenarios/Step Design/Working Step/[Processing] 1 Click Test button 2 Select your B1 Receiver System 3 Click Run 4 Click Debug 5 Click Save to store your debug settings 1 2 5 3 4
Integration: Debuging (2/3) Path: Scenarios/Step Design/Working Step/[Processing]/[Test] 1 Click any of the red arrows in order to see the B1if message different steps 2 You can see the “DBINSysId” property in the header 1 Xpath = /vpf:Msg/vpf:Header/vpf:Properties/vpf:prop[./@id='DBINSysId']/@value 2
Integration: Debuging (3/3) 1 Payload “C” contains the results from the SQLCall 2 Payload “R” is the result from the final transformation, ready to be sent to SAP Business One 1 1 2
Thank You! For more information visit SDN at http://sdn.sap.com