Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Synchronizing Data in SAP HANA Using SAP SQL Anywhere

2,648 views

Published on

By enabling mobile and remote applications to synchronize enterprise data to and from SAP HANA, companies gain a significant competitive advantage as decisions can be made using real-time available information. In this session, attendees will learn how to design and implement a solution that acquires data from a wide range of applications (sales force automation, telematics, etc.) and synchronize that data to an SAP HANA database. Sample applications are used to demonstrate the synchronization mechanism.

Published in: Technology
  • Be the first to comment

Synchronizing Data in SAP HANA Using SAP SQL Anywhere

  1. 1. (c) 2015 Independent SAP Technical User GroupAnnual Conference, 2015 -ISUG TECH 2015-ISUG TECH 2015 ConferenceConference Synchronizing Data in SAP HANA Using SAP SQLSynchronizing Data in SAP HANA Using SAP SQL AnywhereAnywhere José RamosJosé Ramos
  2. 2. (c) 2015 Independent SAP Technical User GroupAnnual Conference, 2015 AgendaAgenda Mobile Business Applications  –Developing the Solution Using SAP HANA Interactive Education ( )SHINE Schema  / /Design Implementation Deploy ment Demo Summary  &Q A
  3. 3. (c) 2015 Independent SAP Technical User GroupAnnual Conference, 2015 MOBILE BUSINESSAPPLICATIONS
  4. 4. (c) 2015 Independent SAP Technical User GroupAnnual Conference, 2015 ’ “ ”Today s Point of Business Can Be’ “ ”Today s Point of Business Can Be AnywhereAnywhere Mobile Employees Field Workers Small Businesses Intelligent Appliances Intelligent Infrastructure  - -Point of Sale Customer Service Applications Hosted Solutions
  5. 5. (c) 2015 Independent SAP Technical User GroupAnnual Conference, 2015 Life on the EdgeLife on the Edge -Challenges for Data Driven Applications at the Point of-Challenges for Data Driven Applications at the Point of :Data Centers Squeaky clean Controlled environments IT administration on site  - - -State of the art :Remote Locations “ ”Real world  ,Weak signals dead spots No IT staff present  - ,Low cost commodity hardware vs. SAP HANA SAP SQL Anywhere
  6. 6. (c) 2015 Independent SAP Technical User GroupAnnual Conference, 2015 Data Synchronization Between SAPData Synchronization Between SAP HANA and SAP SQL AnywhereHANA and SAP SQL Anywhere SAP HANA On-Premise / On-Demand (Primary Site) Data Layer Application Layer Business intelligence On-Device (Mobile Site) Data Synchroniza Application Layer SAP SQL Anywhere or UltraLite Mobile app When synchronization succeeds, both SAP HANA and SAP SQL Anywhere (UltraLite) databases are in a mutually consistent state
  7. 7. (c) 2015 Independent SAP Technical User GroupAnnual Conference, 2015 Data SynchronizationData Synchronization Required ComponentsRequired Components ( - )Primary site on premise or cloud Data Layer  SAP HANA  , ,Can also be SAP ASE SAP IQ or any ODBC data source Application Layer  SAP HANA XS application  SAP Business Objects  Any business application   ( “ ”Data synchronization component called MobiLink )and included with SAP SQL Anywhere ( - )Mobile sites on device  ( )SAP SQL Anywhere for Windows Mobile WM  , ,UltraLite for Android iOS BlackBerry or WM Mobile application  , , ,Smartphone tablet laptop intelligent machine  →Ruggedized device Windows (. )Mobile NET  Smartphone  ( )Android Java  ( - )iPhone Objective C  ( )BlackBerry Java  Windows Mobile (. )NET  Tablet  ( )Android Java  ( - )iPad Objective C  Windows Mobile
  8. 8. (c) 2015 Independent SAP Technical User GroupAnnual Conference, 2015 Benefits and CompetitiveBenefits and Competitive AdvantagesAdvantages Benefits Competitive AdvantagesAggregate information from all mobile sites Gather complete view of business-Conduct real time analysis of gathered data Quickly analyze the incoming dataSuperior performance Make immediate and informed operational( , , .)Integrate with SAP systems BI ERP etc Leverage existing investment/Integrate with existing IT and or cloud Minimize operational expenses
  9. 9. (c) 2015 Independent SAP Technical User GroupAnnual Conference, 2015 Benefits and CompetitiveBenefits and Competitive AdvantagesAdvantages Benefits Competitive Advantages - / -Deploy small footprint resource efficient solutions Operate using economic hardware -Build feature rich applications -Enhance end user experience Minimize IT staff ’Reduce solution s total cost of ownership Capture data anywhere and anytime Safeguard against poor networks or outages Allow offline transactions -Improve end user productivity Link mobile users to enterprise data -Empower end user to make decisions Provide high reliability Keep high productivity rate Easily scale your solution Leverage your investment at no extra cost Secure information on mobile device Adhere to government or company standardsRollout any type of mobile device Freedom to deploy to any hardware
  10. 10. (c) 2015 Independent SAP Technical User GroupAnnual Conference, 2015 DEVELOPING THE SOLUTION Design
  11. 11. (c) 2015 Independent SAP Technical User GroupAnnual Conference, 2015 Design ConsiderationsDesign Considerations What is the business challenge?  -Enable mobile workforce to conduct business at end points? Capture large amounts of data for processing? Provide real-time analysis at corporate site? At mobile site? What do you already have at the corporate site? Database servers (e.g. SAP HANA) Network infrastructure (e.g. VPN, firewalls) Cloud infrastructure (private vs. public) What do you already have at the mobile sites? Device type (e.g. smartphone, tablet, ruggedized laptop) Native application vs. mobile platform
  12. 12. (c) 2015 Independent SAP Technical User GroupAnnual Conference, 2015 DesignDesign :Example Mobile SFA using SHINE:Example Mobile SFA using SHINE
  13. 13. (c) 2015 Independent SAP Technical User GroupAnnual Conference, 2015 DesignDesign ArchitectureArchitecture Primary Site SAP HANA SAP HANA XS Application On-Premise On-Demand HCP Mobile Workers MobiLink data synchronization server Mobile SFA smartphone application with SAP SQL Anywhere (UltraLite) ODBC TCP/IP, TLS or HTTP(S)
  14. 14. (c) 2015 Independent SAP Technical User GroupAnnual Conference, 2015 DesignDesign Primary Site ComponentsPrimary Site Components SAP HANA acts as consolidated database Aggregation of all ordered entered by sales person Real-time or historical analysis of information Database schema (tables) employees addresses businessPartners purchaseOrders purchaseOrderItems products texts Subset of SHINE schema employee s addresse s businessPartn er purchaseOrderIte m purchaseOrd er texts products 1n n 1 1 n n 1 1 1 n n n n 1 1
  15. 15. (c) 2015 Independent SAP Technical User GroupAnnual Conference, 2015 DesignDesign Primary Site ComponentsPrimary Site Components Remote UltraLite database schema mirrors SAP HANA database Data synchronization Download-only vs. upload-only synchronization Bi-directional synchronization Timestamp data sync → only new/updated data will be synchronized Smartphone application Written in Java and runs on Android phone Enables offline business transactions Synchronizes its data to corporate SAP HANA database  employee s addresse s businessPartn er purchaseOrderIte m purchaseOrd er texts products 1n n 1 1 n n 1 1 1 n n n n 1 1
  16. 16. (c) 2015 Independent SAP Technical User GroupAnnual Conference, 2015 DEVELOPING THE SOLUTION Implementation
  17. 17. (c) 2015 Independent SAP Technical User GroupAnnual Conference, 2015 Required ComponentsRequired Components :Primary site  - ( . .SAP HANA running on premise or on the cloud e g SAP HANA Cloud Platform) MobiLink sync server – included in SAP SQL Anywhere Business application for data analysis (e.g. SAP HANA XS Application) ODBC data source for the SAP HANA database (MobiLink server requires it) SAP HANA ODBC driver included in SAP HANA Client package Mobile sites: Native SFA application (enter and/or update customer orders) UltraLite database (store orders)
  18. 18. (c) 2015 Independent SAP Technical User GroupAnnual Conference, 2015 ImplementationImplementation Primary Site DevelopmentPrimary Site Development SAP HANA consolidated database Can use SQL statements, SAP HANA Studio, or a modeling tool (e.g. SAP PowerDesigner) Standard SQL code to create main tables  Instructions for SHINE schema: http://help.sap.com/hana/SAP_HANA_Interactive_Education_SHINE_en.p df.  “Shadow tables”: a mechanism to keep track of inserts/updates/deletes on SAP HANA tables  For inserts/updates, use to keep track of last download times  For deletes, use to record row ID  Use triggers to automatically maintain each shadow table  When writing synchronization logic, JOIN the shadow table with its corresponding main table
  19. 19. (c) 2015 Independent SAP Technical User GroupAnnual Conference, 2015 ImplementationImplementation Primary Site DevelopmentPrimary Site Development SQL code for “purchaseOrder” table: SQL code of corresponding shadow tables:CREATE COLUMN TABLE . (MYSCHEMA purchaseOrder PurchaseOrderId NVARCHAR( )10 NOT NULL, CreatedBy NVARCHAR( )10 NOT NULL, CreatedAt DAYDATE CS_DAYDATE NOT NULL, ChangedBy NVARCHAR( ),10 ,ChangedAt DAYDATE CS_DAYDATE NoteId NVARCHAR( ),10 PartnerId NVARCHAR( ),10 Currency NVARCHAR( )5 NOT NULL, GrossAmount DECIMAL( , )15 2 CS_FIXED DEFAULT 0 NOT NULL, NetAmount DECIMAL( , )15 2 CS_FIXED DEFAULT 0 NOT NULL, TaxAmount DECIMAL( , )15 2 CS_FIXED DEFAULT 0 NOT NULL, LifecycleStatus NVARCHAR( ),1 ApprovalStatus NVARCHAR( ),1 ConfirmStatus NVARCHAR( ),1 OrderingStatus NVARCHAR( ),1 InvoicingStatus NVARCHAR( ),1 PRIMARY KEY ( )PurchaseOrderId ); CREATE ROW TABLE . (MYSCHEMA purchaseOrderItem_upserted PurchaseOrderId NVARCHAR( )10 CS_STRING NOT NULL, PurchaseOrderItem NVARCHAR( )10 CS_STRING NOT NULL, upserted_timestamp LONGDATE CS_LONGDATE NOT NULL, PRIMARY KEY ( ,PurchaseOrderId )PurchaseOrderItem ) ; CREATE ROW TABLE . (MYSCHEMA purchaseOrder_deleted PurchaseOrderId NVARCHAR( )10 CS_STRING NOT NULL, deleted_timestamp LONGDATE CS_LONGDATE NOT NULL, PRIMARY KEY ( )PurchaseOrderId );
  20. 20. (c) 2015 Independent SAP Technical User GroupAnnual Conference, 2015 ImplementationImplementation Primary Site DevelopmentPrimary Site Development SQL code for triggers to maintain shadow tables: CREATE .TRIGGER MYSCHEMA purchaseOrder_update AFTER UPDATE ON .MYSCHEMA purchaseOrder REFERENCING NEW ROW UPDATED_ROW FOR EACH ROW begin update purchaseOrder_upserted set =upserted_timestamp current_timestamp where = : . ;PurchaseOrderId updated_row PurchaseOrderId end; CREATE .TRIGGER MYSCHEMA purchaseOrder_delete BEFORE DELETE ON .MYSCHEMA purchaseOrder REFERENCING OLD ROW DELETED_ROW FOR EACH ROW begin delete from purchaseOrder_upserted where = : . ;PurchaseOrderId deleted_row PurchaseOrderId insert into purchaseOrder_deleted values (: . ,deleted_row PurchaseOrderId current_timestamp); end; CREATE .TRIGGER MYSCHEMA purchaseOrder_insert AFTER INSERT ON .MYSCHEMA purchaseOrder REFERENCING NEW ROW INSERTED_ROW FOR EACH ROW begin insert into purchaseOrder_upserted values (: . ,inserted_row PurchaseOrderId current_timestamp); delete from purchaseOrder_deleted where = : . ;PurchaseOrderId inserted_row PurchaseOrderId end;
  21. 21. (c) 2015 Independent SAP Technical User GroupAnnual Conference, 2015 ImplementationImplementation Primary Site DevelopmentPrimary Site Development MobiLink server system objects Must be installed in the SAP HANA system to enable data synchronization Execute SQL script “synchana.sql” provided with the SQL Anywhere installation Data synchronization logic Stored procedures executed by the HANA server Use the “ml_add_table_script” system procedure to add/remove SQL table scripts to the HANA server: CALL (ml_add_table_script 'v1', 'purchaseOrder', ,'download_cursor' ' " "." "." ", " ", " ", " ", " ", " ", " ", " ",select MYSCHEMA purchaseOrder PurchaseOrderId CreatedBy CreatedAt ChangedBy ChangedAt NoteId PartnerId Currency " ", " ", " ", " ", " ", " ", " ", " “GrossAmount NetAmount TaxAmount LifecycleStatus ApprovalStatus ConfirmStatus OrderingStatus InvoicingStatus " "." “from MYSCHEMA purchaseOrder " "." " " "." "." " =inner join MYSCHEMA purchaseOrder_upserted on MYSCHEMA purchaseOrder_upserted PurchaseOrderId " "." "." "MYSCHEMA purchaseOrder PurchaseOrderId " "." "." " = { . } " "." "." " >= {where MYSCHEMA purchaseOrder CreatedBy ml s remote_id and MYSCHEMA purchaseOrder_upserted upserted_timestamp ml . }s last_table_download ' ); CALL (ml_add_table_script 'v1', 'purchaseOrder', 'upload_insert', ‘ " "." "( " ", " ", " ", " ", " ", " ", " ", " ",insert into MYSCHEMA purchaseOrder PurchaseOrderId CreatedBy CreatedAt ChangedBy ChangedAt NoteId PartnerId Currency " ", " ", " ", " ", " ", " ",GrossAmount NetAmount TaxAmount LifecycleStatus ApprovalStatus ConfirmStatus " ",OrderingStatus " " )InvoicingStatus ( { ." "}, { ." "}, { ." "}, { ." "}, { ." "}, { ." "}, { ." "},values ml r PurchaseOrderId ml r CreatedBy ml r CreatedAt ml r ChangedBy ml r ChangedAt ml r NoteId ml r PartnerId { ." "}, { ." "}, { ." "}, { ." "}, { ." "}, { ." "},ml r Currency ml r GrossAmount ml r NetAmount ml r TaxAmount ml r LifecycleStatus ml r ApprovalStatus { ." "}, { ." "}, { ." "} )ml r ConfirmStatus ml r OrderingStatus ml r InvoicingStatus );
  22. 22. (c) 2015 Independent SAP Technical User GroupAnnual Conference, 2015 ImplementationImplementation Mobile ApplicationMobile Application Application layer Native Android smartphone user interface (Java) Corporate information specific to the application’s user Products Customers/business partners Orders Ability to enter new orders, independent of network connectivity Secure via strong encryption of database and communication layer
  23. 23. (c) 2015 Independent SAP Technical User GroupAnnual Conference, 2015 ImplementationImplementation Mobile ApplicationMobile Application Data access layer Add UltraLite runtime to project All product, customer and order data stored in local database Standard JDBC for data management UltraLite database runs in- process with mobile application /* */Create new database connection =Connection dbConnection null; =ConfigFileAndroid config null; try { = .config DatabaseManager createConfigurationFileAndroid(" . "shine udb , );mContext = . ( );dbConnection DatabaseManager connect config } catch ( ) {ULjException ex /* */Handle exception } /* */Build SQL query =String query " , "SELECT PurchaseOrderId CompanyName FROM purchaseOrder + " . =INNER JOIN businessPartner ON purchaseOrder PartnerId . "businessPartner PartnerId + " "ORDER BY purchaseOrderId ; /* */Execute query =Vector retn null; = . ( );PreparedStatement ps dbConnection prepareStatement query try { = . ();ResultSet rs ps executeQuery =retn new ();Vector while( . () ) {rs next . ( . ( ) );retn addElement rs getString 1 } } finally { . ();ps close } /* : */TO DO Process Vector
  24. 24. (c) 2015 Independent SAP Technical User GroupAnnual Conference, 2015 ImplementationImplementation Mobile ApplicationMobile Application Data synchronization layer Synchronization launched inside smartphone application Synchronizes data to corporate SAP HANA server Sync parameters handled by SQL statements and stored inside remote database Each sales person is a separate remote client  Need a way to uniquely identify them /* */Create sync object = . ( . ,SyncParms sync _conn createSyncParms SyncParms HTTP_STREAM " "mluser , " "v2 ); . (sync setPassword " "mlpass ); = . ();StreamHTTPParms streamParms sync getStreamParms . (streamParms setHost “ "hostname ); . ( );streamParms setPort 8888 . (sync setPublications " "p2a ); . ( );dbConnection synchronize sync // SQ L com m ands to create the sync profile CR EA TE SYN CH R O N IZA TIO N SU B SCR IPTIO N "sync_m odel_shine“ TO "sync_m odel_shine" FO R "m luser“ TYPE tcpip A D D R ESS 'host= localhost;port= 2439‘ SCR IPT V ER SIO N ‘v2‘ CR EA TE O R R EPLA CE SYN CH R O N IZA TIO N PR O FILE "syncProfile2a“ ‘M obiLinkU id= m luser;M obiLinkPw d= m lpass;Stream = TCPIP{host= localhost;port= 2439}; ScriptV ersion= v2;Publication= p2a'
  25. 25. (c) 2015 Independent SAP Technical User GroupAnnual Conference, 2015 DEVELOPING THE SOLUTION Deployment
  26. 26. (c) 2015 Independent SAP Technical User GroupAnnual Conference, 2015 DeploymentDeployment Primary site components SAP HANA Cloud Platform → make sure users have access to your XS application SAP HANA → create and export a delivery unit to your production server MobiLink server binaries  Included in SQL Anywhere installation  Min 7 files totaling 10 MB ODBC data source to connect to the SAP HANA database Mobile application components Android smartphone application  UltraLite runtime and database already embedded in the application
  27. 27. (c) 2015 Independent SAP Technical User GroupAnnual Conference, 2015 DEMO
  28. 28. (c) 2015 Independent SAP Technical User GroupAnnual Conference, 2015 Final Thoughts on MobiLink SyncFinal Thoughts on MobiLink Sync ServerServer :Available functionality to take advantage of  –Data partitioning only use data specific to mobile user  , - , - , -Snapshot download only upload only or bi directional sync Automatic conflict detection and resolution Scalable to thousands of mobile users Script versioning enabling different levels of data sync Push and pull sync Strong encryption  ( - )Synchronization to any ODBC data source relational or non relational Sync logic debugging Graphical sync logic modeling Monitoring capabilities  ( )High availability load balancing
  29. 29. (c) 2015 Independent SAP Technical User GroupAnnual Conference, 2015 SUMMARY
  30. 30. (c) 2015 Independent SAP Technical User GroupAnnual Conference, 2015 SummarySummary SAP SQL Anywhere provides mechanism to synchronize data to and from SAP HANA Enables implementation of solution that provides .1 - ( )Real time analysis at corporate site SAP HANA .2 ( )Ability to perform transactions at the point of business SAP SQL Anywhere Technology used in many applications Sales force automation Inspection Mobile healthcare Telematics  .Etc
  31. 31. Annual Conference, 2015 (c) 2015 Independent SAP Technical User Group Questions and AnswersQuestions and Answers
  32. 32. Annual Conference, 2015 (c) 2015 Independent SAP Technical User Group Thank You for AttendingThank You for Attending Please complete yourPlease complete your session feedback formsession feedback form

×