Extracting Product Attributes in XML using Web Service

Similar documents
MDM Syndicator Create Flat Syndication File

SAP GRC Access Control: Configuring compliant user provisioning (formerly Virsa Access Enforcer) into CUA Systems

Visual Composer - Task Management Application

A Step-By-Step Guide on File to File Scenario Using Xslt Mapping

Consuming Web Dynpro components in Visual Composer.

What s New / Release Notes SAP Strategy Management 10.1

How To Configure the Websocket Integration with SAP PCo in SAP MII Self Service Composition Environment Tool

Do Exception Broadcasting

Install TREX for CAF Version 1.00 March 2006

Cache Settings in Web Page Composer

How To Set up NWDI for Creating Handheld Applications in SAP NetWeaver Mobile 7.1

link SAP BPC Excel from an enterprise portal Version th of March 2009

WDA - Custom themes for Web Dynpro ABAP applications without SAP Enterprise Portal integration

SAP NetWeaver How-To Guide

Web Page Composer anonymous user access

Quick Reference Guide SAP GRC Access Control Compliant User Provisioning (formerly Virsa Access Enforcer): HR Triggers

SAP MII: Leveraging the Data Buffering Feature for Connection Error Handling.

How to Browse an Enterprise Services Registry in Visual Composer

How to Use Function Keys in Mobile Applications for Handhelds

Building a Tax Calculation Application

configure an anonymous access to KM

How to Set Up and Use the SAP OEE Custom UI Feature

How to Create a New SAPUI5 Development Component

How To... Configure Integrated Configurations in the Advanced Adapter Engine

Preview of Web Services Reliable Messaging in SAP NetWeaver Process Integration 7.1

Visual Composer Build Process

Data Validation in Visual Composer for SAP NetWeaver Composition Environment

Create Partitions in SSAS of BPC Version 1.00 Feb 2009

How to Set Up and Use the SAP OEE Custom KPI Andons Feature

Process Control 2.5 Implementation Checklist

How To... Reuse Business Objects and Override Operations of a Business Object

Enterprise Portal Logon Page Branding

How To... Promote Reports and Input Schedules Through Your System Landscape

How To Extend User Details

Simplified Configuration of Single System Update in Maintenance Optimizer

How To Recover Login Module Stack when login to NWA or Visual Administrator is impossible

How to Upgr a d e We b Dynpro Them e s from SP S 9 to SP S 1 0

How To Configure IDoc Adapters

How To...Configure Integration of CUP with SPM

How To... Master Data Governance for Material: BADI USMD_SSW_SYSTEM_METHOD_CALLER to create successor change request

How To Generate XSD Schemas from Existing MDM Repositories

Consuming Directory API in ABAP

Introducing SAP Enterprise Services Explorer for Microsoft.NET

How To...Use a Debugging Script to Easily Create a Test Environment for a SQL-Script Planning Function in PAK

How to Translate a Visual Composer Model Part I

Value Help in Web Dynpro ABAP - Tutorial.

BusinessObjects Enterprise XI 3.0 with Complex NAT Networks

Configure SSO in an SAP NetWeaver 2004s Dual Stack

SDN Contribution HOW TO CONFIGURE XMII BUILD 63 AND IIS 6.0 FOR HTTPS

How To... Master Data Governance for Material: BADI USMD_SSW_PARA_RESULT_HANDLER to merge result of parallel workflow tasks

How To Develop a Simple Web Service Application Using SAP NetWeaver Developer Studio & SAP XI 3.0

How To Troubleshoot SSL with BPC Version 1.01 May 2009

Integrate a Forum into a Collaboration Room

xmii UDS Overview and Troubleshooting

How to View Dashboards in the Self Service Composition Environment with Additional Metadata

Configure TREX 6.1 for Efficient Indexing. Document Version 1.00 January Applicable Releases: SAP NetWeaver 04

Extract Archived data from R3

Configure UD Connect on the J2EE Server for JDBC Access to External Databases

View Time Security for crystalreports.com

How To... Master Data Governance for Material: File Down- and Upload

SAP - How-To Guide MDG Custom Object Data Replication How to Configure Data Replication for MDG Custom Objects (Flex Option)

Access Control 5.3 Implementation Considerations for Superuser Privilege Management ID-Based Firefighting versus Role-Based Firefighting Applies to:

SAP NetWeaver How-To Guide

How-To... Add Sensitive Content into an Area

SAP NetWeaver How-To Guide How to use Process Execution Manager Using SAP Test Data Migration Server

Building a Composite Business Process from Scratch with SAP NetWeaver BPM Guide 2

Monitoring System Landscapes Using the DBA Cockpit

Working with Select Options in Web Dynpro for ABAP

Installation Guide Business Explorer

Create Monitor Entries from an update routine

Visual Composer for NetWeaver CE: Getting Started with a Typical Workflow

Send Multiple IDocs Within One XI Message

SAP NetWeaver 04. Unification Terminology

Building Custom Applications Using IBOM

Create Monitor Entries from a Transformation routine

JMS Clustering and Failover

Use Business Objects Planning and Consolidation (version for the Microsoft platform) BPF services in Xcelsius

How To...Custom BADI for rounding off values in SAP BUSINESSOBJECTS Planning and Consolidation, version for SAP NetWeaver.

Tutorial: Consuming Web Services in Web Dynpro Java

Using Tools to Represent Appraisal Status Flow (HR module Objectives Settings and Appraisals ) as Diagram

The test has been performed using a 64 Bit SAP NetWeaver Application Server Java 7.1 Enhancement Package 1 SP4 or greater system.

SAP Composite Application Framework. Creating a Content Package Object

Setting up Single Sign On Between xmii and Enterprise Portal

Transport in GP. How-to Guide Beginning with SAP NetWeaver 2004s SPS06. Version 2.00 January 2006

Handle. How-to Guide SAP NetWeaver 2004s. Version 1.00 Sept 2006

How to Use Other Conditions in Decision Tables in Rules Composer

Web Intelligence Caching in BusinessObjects Enterprise XI Release 2

How to Use Definitions in Rules Composer

What's New in the DBA Cockpit with SAP NetWeaver 7.0

Best Practices Using KMC Capabilities in an External Facing Portal Version 1.00 October 2006

Business Rules Framework plus Workbench

SAP BPC 5.0 & 5.1 Performance and Reliability tips

Setting Up an Environment for Testing Applications in a Federated Portal Network

Use the BI Java SDK in a Web Dynpro Application Version 1.01 July 2005

SAP NetWeaver Master Data Management 7.1 Web Service Enhancements

Resume Parsing. SAP enhancement package 3 for SAP ERP 6.0. Document Version ERECRUIT 603 RECRUIT 603

Configure Peripheral Drivers with Mobile Infrastructure

How To Customize the SAP User Interface Using Theme Editor

SAP Composite Application Framework. Creating an External Service type Callable Object in Guided Procedures

SAP NetWeaver How-To Guide. SAP NetWeaver Gateway Virtualization Guide

Transcription:

Extracting Product Attributes in XML using Web Service Applies to: SAP for Banking. For more information, visit the Web Services homepage. Summary The purpose of this document is to describe in detail on how to extract the product attributes in xml in a pre defined schema provided by the customer. In most of the cases, SAP Banking Services platform is used as a robust back end system for core banking and hence there might be lot of front end non SAP applications interacting with this platform using web services. One such scenario is to extract all the attributes of a given product in XML format on a pre defined XML Schema. Author: Joshy Thampi Pulikotil Company: SAP Global Delivery Center, Bangalore Created on: 20 November 2008 Author Bio Joshy Thampi Pulikotil is a technical consultant working in the area of SAP Financial Services. He is currently working at SAP Global Delivery Center, Bangalore as a part of the financial services team. He has got more than 6 years of experience in ABAP development. Currently his focus areas are SAP Deposit Management and Enterprise SOA. 2008 SAP AG 1

Table of Contents Purpose...3 Abstract...3 Description...3 Product and Product Attributes in Banking Services Platform...3 Definition of XML Schema using Package ixml...5 Package DOM...6 Package Stream...6 Package Renderer...7 Product Attributes Extract as XML file...7 Creation of Enterprise Services from RFC function module...8 Results...10 Related Content...11 Copyright...12 2008 SAP AG 2

Purpose The purpose of this document is to describe in detail on how to extract the product attributes in xml in a pre defined schema provided by the customer. In most of the cases, SAP Banking Services platform is used as a robust back end system for core banking and hence there might be lot of front end non SAP applications interacting with this platform using web services. One such scenario is to extract all the attributes of a given product in XML format on a pre defined XML Schema. The biggest challenge here is to align our extract to the Schema defined by the customer. We already have the transform functionality to convert ABAP to XML but it is quite tedious to transform ABAP output content to XML in a pre defined XML Schema. Thanks to SAP s XML Library and Package DOM which will help us to resolve this by simply following few steps as described in this document. Abstract This document illustrates the following topics in detail. Product and Product Attributes in Banking Services Platform Definition of XML Schema using Package ixml Package DOM Package Stream Package Renderer Product Attributes Extract as XML file Creation of Enterprises Services from RFC function module Description Product and Product Attributes in Banking Services Platform In Financial Services, Products form the basis for all business operations. Each contract is based on a product to which particular characteristics and functions are ascribed in general business transactions. An attribute offers the option of describing a characteristic or a function of a product. Fields or functions in a contract can have corresponding attributes in the product. Only contract fields and functions that can be changed need to have corresponding attributes in the product category. Fields and features of a contract specialization that cannot be changed do not need to be created as attributes of the corresponding product category. The product configurator describes all the IMG activities that must be executed in the IMG under Product Management. The attribute hierarchy consists of all attributes that are available for a product category in Account Management or Master Contract Management.. 2008 SAP AG 3

The attribute heirarchy can consists of the following attribute category Attribute Category Description Grouping attribute Grouping attributes group attributes together that belong to the same business topic, and are used for structuring. Feature attribute Feature attributes can be flagged in the attribute hierarchy as required attributes. In the product, they have a padlock that specifies whether the feature can be changed in the contract, and a traffic light that shows the attribute status. Depending on the product settings, a feature can be deactivated in the contract by a feature lock Field Attribute Field attributes control the field modification, default/fixed values, allowed input values and modification options for one field in one product instance. A field attribute can be a single value or a multiple value attribute Matrix Attribute Attributes from this category are set up as a matrix and control field values of table fields in the contract according to the two dimensions of the matrix. For eg: Term and Term Unit can form a matrix with respect to a term deposit product. List Attribute A list attribute works in the same way as a matrix attribute that has been defined with one column. The following function module will retrieve all the valid product attributes for a given product 2008 SAP AG 4

Once the attributes are retrieved from SAP system, the next biggest challenge is to create the nodes as provided in the XML Schema Definition of XML Schema using Package ixml Consider the situation where the customer demands the product attributes need to be extracted as per a pre defined XML schema. For eg: You are provided with the following XSD file and you need to extract the product attributes as per the schema. In order to achieve a hierarchy of nodes as given in the xml, schema, we use the package ixml in xml library. The ixml class is the origin from where to start with the ixml libary. It serves both as a factory for the elementary objects Document, Parser and StreamFactory and as a "handle" defining the processing context - or session - of subsequent API calls. The create method creates an instance of the ixml class and returns an interface pointer to the instance. The create document method creates a new document instance and returns an interface pointer to the newly created document instance. The ixmldocument interface represents the entire XML document. Conceptually, it is the root of the document tree, and provides the primary access to the document's data. In order to map the values correctly into XML elements, a flat structure consisting of all XML elements mentioned in the Schema are created. The elements are created under the root note using the method Create_simple_element. This method creates a simple element with the given name (and namespace) and the specified value as text content. Note that the instance returned implements the ixmlelement interface, so attributes can be specified directly on the returned object. 2008 SAP AG 5

Package DOM The DOM presents documents as hierarchy of Node objects that also implements more specialized interfaces. A node can be termed either as a root node, child node or leaf nodes, which cannot have anything below them in the document structure. The package DOM contains several useful interfaces such as if_ixml_attribute, if_ixml_element, if_ixml_document which can be used for various operations on the document tree. Package Stream Once the target tree structure is built, the next step is to create the output stream of XML. The stream package contains all definitions to handle XML stream I/O. Input and output of XML documents is handled in terms of XML streams in the ixml library. The stream package defines 3 major concepts: an XML stream factory (ixmlstreamfactory), an XML input stream (ixmlistream) and an XML output stream (ixmlostream). The stream factory is used to create XML input and output streams. Since different input sources and output destinations have to be considered, ixmlistream and ixmlostream interfaces will be implemented by different classes, each one capable of serving a particular source or destination. Each of these classes is registered or can be registered with the XML stream factory (prototype pattern) and can be queried about its capabilities. This allows the stream factory to create streams for all supported sources or destinations on request in an client application independent way. One of the advantages of this approach is the XML parsers capability to automatically resolve external entity references, as long as there is a stream type registered with the factory, which can handle the protocol defined by the URL. XML table is a table of lines with hexadecimal values as shown below. The ixmlostream interface has to be implemented by all XML output streams. Creation of XML output streams is done indirectly by calling the factory method createostream() of the client application's StreamFactory instance. The method create_ostream_itable creates a new XML output stream for the given internal table. 2008 SAP AG 6

Package Renderer The renderer package contains all definitions required for the XML renderer implemented by the ixml library. For each XML document to be rendered, a separate renderer instance is required. The package Renderer contains the interface if_ixml_renerer. The ixml Renderer interface provides access to the ixml libraries rendering functionality. This method implements the DOM-based interface to the renderer. render() returns if the complete DOM-tree has been serialized into the associated output stream Product Attributes Extract as XML file Now we are ready with the XML content which can be downloaded as an xml file. 2008 SAP AG 7

If the above result needs to be exposed as a web service which will give you an xml output string as a service interface parameter, we need to follow some additional steps as explained below. Creation of Enterprise Services from RFC function module RFC-enabled function modules, function groups that contain an RFC-enabled function module, BAPIs and XI message interfaces can be made available as Web services without any additional programming. You create a Web service using the Web Service Creation Wizard. In this case, the Web services properties are defined in a preset, selectable profile. To create or consume Web services, we need the authorizations associated with the role SAP_BC_WEBSERVICE_ADMIN. We will try to publish the product attribute extract as a web service so that the product attributes are retrieved as an XML string output by the service consumer. We will write the application logic inside a RFC enabled function module and create a web service from this RFC enabled function module using the Web Service Creation Wizard. The only difference in the application logic here is, instead of streaming the XML output to an internal table, here we are streaming it to a string variable using the Stream Factory. The RFC enabled function module has the following input and output parameters. A web service is created from the above function module using Web Service Creation Wizard. 2008 SAP AG 8

The XML content is available in the output parameter XML_String. 2008 SAP AG 9

Results The above illustrations clearly states how the product attributes can be extracted into a pre defined XML schema using the ixml library and Web Services. The extracted product attributes output in XML is as shown below. 2008 SAP AG 10

Related Content http://help.sap.com/saphelp_dm40/helpdata/en/75/eb853c5bd34414e10000000a11405d/frameset.htm http://help.sap.com/saphelp_nw04/helpdata/en/86/8280ba12d511d5991b00508b6b8b11/frameset.htm http://help.sap.com/saphelp_nw70/helpdata/en/9b/dad1ae3908ee44a5caf57e10918be9/frameset.htm For more information, visit the Web Services homepage. 2008 SAP AG 11

Copyright 2008 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, Outlook, and PowerPoint are registered trademarks of Microsoft Corporation. IBM, DB2, DB2 Universal Database, OS/2, Parallel Sysplex, MVS/ESA, AIX, S/390, AS/400, OS/390, OS/400, iseries, pseries, xseries, zseries, System i, System i5, System p, System p5, System x, System z, System z9, z/os, AFP, Intelligent Miner, WebSphere, Netfinity, Tivoli, Informix, i5/os, POWER, POWER5, POWER5+, OpenPower and PowerPC are trademarks or registered trademarks of IBM Corporation. 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. MaxDB is a trademark of MySQL AB, Sweden. SAP, R/3, mysap, mysap.com, xapps, xapp, SAP NetWeaver, 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 in several other countries all over the world. 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. These materials are provided as is without a warranty of any kind, either express or implied, including but not limited to, the implied warranties of merchantability, fitness for a particular purpose, or non-infringement. SAP shall not be liable for damages of any kind including without limitation direct, special, indirect, or consequential damages that may result from the use of these materials. SAP does not warrant the accuracy or completeness of the information, text, graphics, links or other items contained within these materials. SAP has no control over the information that you may access through the use of hot links contained in these materials and does not endorse your use of third party web pages nor provide any warranty whatsoever relating to third party web pages. Any software coding and/or code lines/strings ( Code ) included in this documentation are only examples and are not intended to be used in a productive system environment. The Code is only intended better explain and visualize the syntax and phrasing rules of certain coding. SAP does not warrant the correctness and completeness of the Code given herein, and SAP shall not be liable for errors or damages caused by the usage of the Code, except if such damages were caused by SAP intentionally or grossly negligent. 2008 SAP AG 12