Using Default Values in Backend Adapter Applies to: SAP NetWeaver Mobile 7.1 applicable for all service packs Summary Background, concept and usage of default values in BAPI Wrapper based backend adapter in DOE. Author: M, Gunashekar Company: SAP Labs India Pvt Ltd Created on: 9 November 2010 Author Bio Working in the area of Mobile Applications Platforms. 2010 SAP AG 1
Table of Contents Pre-requisite... 3 Background... 3 Concept... 3 Usage... 4 BAPI Wrapper Development... 4 Modeling in DOE... 5 Mapping to Data Object Communication Header... 5 Mapping to Device Attribute... 5 Mapping to a Constant Value... 6 Maping to System Field... 6 Related Content... 7 Copyright... 8 2010 SAP AG 2
Pre-requisite Knowledge of NetWeaver Mobile 7.1. Preferably, knowledge of SAP Mobile Infrastructure 2.5 Background The most important reason of having the feature of Default Values is to maintain backward compatibility with the previous release, SAP MI 2.5. In SAP MI 2.5, when synchronizing client with the server, user name of the synchronizing user can be sent to the BAPI Wrappers. The backend can then use the user name: For audit trail purposes while uploading data to backend through create, modify or delete BAPI wrappers or To filter user specific data while honoring download request for Two Way SyncBOs in getlist and getdetail BAPI wrappers or For authorization purposes. Note: Sometimes SAP MI 2.5 communicates few more parameters other than user name. However, user name is the most important parameter. To keep the discussion simple, only user name is cited in this article. Concept For backward compatibility reasons, the equivalent functionality of passing user name to the backend had to be provided in the new release of SAP NetWeaver Mobile. The backend adapter Default Values not only supports the functionality of passing user name to the BAPI wrappers, but improvises too. Now, it is possible to send much more variables to the backend than just the user name. In SAP MI 2.5, the user name is part of syncbo definition. The syncbo of SAP MI 2.5 can be conceptually thought as equivalnt to combination of Data Object and Backend Adapter of SAP NetWeaver Mobile 7.1. The Data Object represents the business data and Backend Adapter defines the method of exchanging data with the backend. So the variables that are not part of business data, but have to be exchanged with backend have to be done using the default value functionality of the backend adapter. It is currently possible to pass: Constant Values: a constant value is passed to the BAPI wrappers. Consider a scenario where backend recevies updates from several sources, one of which is mobile clients serviced by DOE (the server part of NetWeaver Mobile), and the backend would like to know the origin of data. We could solve this by passing constant value MOBILE_CLIENT to the BAPI Wrappers to denote that the origin of data is a mobile client. Constant values can also be used in situations where data returned in Getlist BAPI wrapper needs to be controlled based on who is calling. When performing initial download or delta download of data from backend to DOE, backend may want to restrict the amount or type of data to be downloaded to DOE. Device Attribute: the synchronizing device s attributes values is passed to the BAPI wrappers. Existing Receiver Meta Model standard attributes can be used or Receiver Meta Model could be extended by creating a custom group and custom attributes. This type of mapping is useful when additional information about the devices or users that are not part of normal business data is required in the backend. Data Object Communication Header: values of data object communication header fields can be sent to the BAPI Wrappers. Data object communication header contains a set of fields that are exchanged between DOE and the Client Framework. Fields like synchronization user name, Data Object name, etc., which provide additional information about the data that is getting exchanged between client and DOE, form the communication header. 2010 SAP AG 3
Normally, communication header fields are mapped to Create, Modify and Delete BAPI Wrappers. In other words, when data is getting uploaded from client to backend. However, for Two Way Data Objects, Getlist and Get Detail BAPI wrapper can also be mapped since data is fetched from the backend based on the synchronization user. System Fields: SY fields like sy-uname, sy-mandt, sy-uzeit, etc, whose values are set by the ABAP runtime environment, can also be passed to backend. For example, consider a use case is where there are several instances of DOE and data to be downloaded from backend to each DOE instance is different, we can use system fields to control such configuration, by passing system id SY-SYSID or SY-HOST to the BAPI Wrapper to indicate the DOE instance. Usage BAPI Wrapper Development To pass Default Values to the backend, the BAPI wrappers should have importing parameters. These importing parameter are mapped to a Constant Values, Device Attributes, Data Object Communication Header fields or System Fields on the backend adapter design time. There is one restriction though: the importing parameters should be fields of a structure. At run time, the relevant values are passed to the BAPI Wrapper by DOE. Let us go through an example. Have a look at the screen shot of the create BAPI Wrapper shown below. Notice that the parameters USER_NAME, WORKCENTER, DOE_CLIENT and CREATED_AT. 2010 SAP AG 4
Modeling in DOE Mapping to Data Object Communication Header The parameter USER_NAME of the Create BAPI Wrapper ZSDN_DEFAULTVALUE_DEMO_CREATE is mapped to the Data Object Communication Header s USER_NAME field. Mapping to Device Attribute In Receiver Meta Model, create a custom group and create a field called WORKCENTER_ID. Next, we map WORKCENTER to the Receiver Meta Model s WORKCENTER_ID. 2010 SAP AG 5
Mapping to a Constant Value Here, we give a constant value MOBILE_CLIENT to the parameter CREATED_AT as shown below. Whenever the BAPI Wrapper ZSDN_DEFAULTVALUE_DEMO_CREATE is called, the parameter CREATED_AT will be populated with the value MOBILE_CLIENT. Maping to System Field Lastly, we map sy-mandt to DOE_CLIENT 2010 SAP AG 6
Related Content Migration Guide SAP NetWeaver Mobile 7.1 FAQ Developer's Guide 2010 SAP AG 7
Copyright Copyright 2010 SAP AG. All rights reserved. No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG. The information contained herein may be changed without prior notice. Some software products marketed by SAP AG and its distributors contain proprietary software components of other software vendors. Microsoft, Windows, Excel, Outlook, and PowerPoint are registered trademarks of Microsoft Corporation. IBM, DB2, DB2 Universal Database, System i, System i5, System p, System p5, System x, System z, System z10, System z9, z10, z9, iseries, pseries, xseries, zseries, eserver, z/vm, z/os, i5/os, S/390, OS/390, OS/400, AS/400, S/390 Parallel Enterprise Server, PowerVM, Power Architecture, POWER6+, POWER6, POWER5+, POWER5, POWER, OpenPower, PowerPC, BatchPipes, BladeCenter, System Storage, GPFS, HACMP, RETAIN, DB2 Connect, RACF, Redbooks, OS/2, Parallel Sysplex, MVS/ESA, AIX, Intelligent Miner, WebSphere, Netfinity, Tivoli and Informix are trademarks or registered trademarks of IBM Corporation. Linux is the registered trademark of Linus Torvalds in the U.S. and other countries. Adobe, the Adobe logo, Acrobat, PostScript, and Reader are either trademarks or registered trademarks of Adobe Systems Incorporated in the United States and/or other countries. Oracle is a registered trademark of Oracle Corporation. UNIX, X/Open, OSF/1, and Motif are registered trademarks of the Open Group. Citrix, ICA, Program Neighborhood, MetaFrame, WinFrame, VideoFrame, and MultiWin are trademarks or registered trademarks of Citrix Systems, Inc. HTML, XML, XHTML and W3C are trademarks or registered trademarks of W3C, World Wide Web Consortium, Massachusetts Institute of Technology. Java is a registered trademark of Sun Microsystems, Inc. JavaScript is a registered trademark of Sun Microsystems, Inc., used under license for technology invented and implemented by Netscape. SAP, R/3, SAP NetWeaver, Duet, PartnerEdge, ByDesign, SAP Business ByDesign, and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP AG in Germany and other countries. Business Objects and the Business Objects logo, BusinessObjects, Crystal Reports, Crystal Decisions, Web Intelligence, Xcelsius, and other Business Objects products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of Business Objects S.A. in the United States and in other countries. Business Objects is an SAP company. All other product and service names mentioned are the trademarks of their respective companies. Data contained in this document serves informational purposes only. National product specifications may vary. These materials are subject to change without notice. These materials are provided by SAP AG and its affiliated companies ("SAP Group") for informational purposes only, without representation or warranty of any kind, and SAP Group shall not be liable for errors or omissions with respect to the materials. The only warranties for SAP Group products and services are those that are set forth in the express warranty statements accompanying such products and services, if any. Nothing herein should be construed as constituting an additional warranty. 2010 SAP AG 8