Consume an External Web Service in a Nutshell with good old ABAP



Similar documents
SAP Master Data Governance- Hiding fields in the change request User Interface

Business One in Action - How can we post bank fees and charges while posting Incoming or Outgoing Payment transactions?

TM111. ERP Integration for Order Management (Shipper Specific) COURSE OUTLINE. Course Version: 15 Course Duration: 2 Day(s)

Maintaining Different Addresses and Ids for a Business Partner via CRM Web UI

Alert Notification in SAP Supply Network Collaboration. SNC Extension Guide

Integrating Easy Document Management System in SAP DMS

NetWeaver Business Client (NWBC) for Incentives and Commissions Management (ICM)

Data Archiving in CRM: a Brief Overview

Table of Contents. How to Find Database Index usage per ABAP Report and Creating an Index

Enterprise Software - Applications, Technologies and Programming

Data Source Enhancement Using User Exit

Third Party Digital Asset Management Integration

R/3 and J2EE Setup for Digital Signature on Form 16 in HR Systems

Understanding HR Schema and PCR with an Example

SAPFIN. Overview of SAP ERP Financials COURSE OUTLINE. Course Version: 15 Course Duration: 2 Day(s)

Process Archiving using NetWeaver Business Process Management

Sending Additional Files from SAP Netweaver PI to third Party System

HR400 SAP ERP HCM Payroll Configuration

UI Framework Logo exchange without skin copy. SAP Enhancement Package 1 for SAP CRM 7.0

Log Analysis Tool for SAP NetWeaver AS Java

Business Requirements... 3 Analytics... 3 Typical Use Cases... 8 Related Content... 9 Copyright... 10

Budget Control by Cost Center

AC200. Basics of Customizing for Financial Accounting: General Ledger, Accounts Receivable, Accounts Payable COURSE OUTLINE

Portfolio and Project Management 5.0: Excel Integration for Financial and Capacity Planning

Variable Exit in Sap BI How to Start

How to Add an Attribute to a Case, Record and a Document in NW Folder Management (ex-records Management)

Sample Universe on Microsoft OLAP Cube

How to Create a Support Message in SAP Service Marketplace

Single Sign-On between SAP Portal and SuccessFactors

Integration of SAP Netweaver User Management with LDAP

Using User Exit for Variables in BEx Reporting

User Experience in Custom Apps

Mass Maintenance of Procurement Data in SAP

SAP NetWeaver BRM 7.3

UI Framework Simple Search in CRM WebClient based on NetWeaver Enterprise Search (ABAP) SAP Enhancement Package 1 for SAP CRM 7.0

UI Framework Task Based User Interface. SAP Enhancement Package 1 for SAP CRM 7.0

Duet Enterprise Add SAP ERP Reports and SAP BI Queries/Workbooks to Duet Enterprise Configuration

Xcelsius Dashboards on SAP NetWaver BW Implementation Best Practices

Integration of Universal Worklist into Microsoft Office SharePoint

K in Identify the differences between the universe design tool and the information design tool

How To Use the ESR Eclipse Tool with the Enterprise Service Repository

USDL XG WP3 SAP use case. Kay Kadner

How to Schedule Report Execution and Mailing

ERP Quotation and Sales Order in CRM WebClient UI Detailed View. SAP Enhancement Package 1 for SAP CRM 7.0 CRM Sales - SFA

SAP Sustainability Solutions: Achieving Customer Strategies

How-to-Guide: Middleware Settings for Download of IPC Configuration (KB) Data from R/3 to CRM System

Download and Install Crystal Reports for Eclipse via the Eclipse Software Update Manager

How To Use the BPC Mass User Management Tool in BPC 10.0 NW

BW Workspaces Use Cases

AP Integration with BRFplus VERSION V APRIL SAP AG

Quick Guide EDI/IDoc Interfacing to SAP ECC from External System

Secure MobiLink Synchronization using Microsoft IIS and the MobiLink Redirector

Compliant, Business-Driven Identity Management using. SAP NetWeaver Identity Management and SBOP Access Control. February 2010

LO Extraction Part 1: SD Application Short Overview

Business Process Change Analyzer in SAP Solution Manager 7.1

SAP DSM/BRFPlus System Architecture Considerations

Configuring Single Sign-on for SAP HANA

Supporting SAP POS Best Practices Setting Log File Sizes and Retention

Application Lifecycle Management

OData in a Nutshell. August 2011 INTERNAL

SAP Business ByDesign Reference Systems. Scenario Outline. SAP ERP Integration Scenarios

Accounts Receivable. SAP Best Practices

Project Governance The Role Of The Business Process Owner

Query, Read, Create and Update CLOUD FOR CUSTOMER ODATA SERVICE QUERY, READ, CREATE AND UPDATE

SAP Central Process Scheduling (CPS) 8.0 by Redwood

SAP Cloud Strategy - Timeless Software. Frank Stienhans on behalf of Kaj van de Loo SAP

How to Configure Access Control for Exchange using PowerShell Cmdlets A Step-by-Step guide

Installation Guide Customized Installation of SQL Server 2008 for an SAP System with SQL4SAP.VBS

SAP NetWeaver BPM Tutorial for Beginners: My Name and Age BPM Tutorial

Intelligent Business Operations Chapter 1: Overview & Strategy

Sales Planning Detailed View. SAP Enhancement Package 1 for SAP CRM 7.0 CRM Sales - SFA

LO Extraction Part 2 Database Update Logic

SAP Service Tools for Performance Analysis

SAP Portfolio and Project Management

Learning Series: SAP NetWeaver Process Orchestration, secure connectivity add-on 1c SFTP Adapter

Fixed Asset in SAP Business One 9.0

BW362. SAP BW powered by SAP HANA COURSE OUTLINE. Course Version: 10 Course Duration: 5 Day(s)

Configuring Distribution List in Compliant User Provisioning

Developing Applications for Integration between PI and SAP ERP in Different Network Domains or Landscapes

SOP through Long Term Planning Transfer to LIS/PIS/Capacity. SAP Best Practices

Unified Service Description Language Enabling the Internet of Services

SAP HANA Cloud Integration Document Version: Template Guide for SAP Sales and Operations Planning

Production Subcontracting (External Processing) SAP Best Practices

Thread Dump Viewer for SAP NetWeaver AS Java

SAP How-To Guide: Develop a Custom Master Data Object in SAP MDG (Master Data Governance)

How to Set Up an Authorization for a Business Partner in Customer Relationship Management (CRM) Internet Sales: Sample Case

Supplier Master Data Governance

Finding the Leak Access Logging for Sensitive Data. SAP Product Management Security

Ariba Network Integration to SAP ECC

RUN BETTER Become a Best-Run Business with Remote Support Platform for SAP Business One

SAP BusinessObjects Increasing Stability by Setting Limits on Max. Retrievable Cells from SAP BW into Web Intelligence using BICS

How To Configure MDM to Work with Oracle ASM-Based Products

Implementing SSO between the Enterprise Portal and the EPM Add-In

Run SAP like a Factory

Learning Series: SAP NetWeaver Process Orchestration, business to business add-on EDI Separator Adapter

Next Generation Digital Banking with SAP

Posting Messages into XI

Certificate SAP INTEGRATION CERTIFICATION

Delta Queue Demystification

Transcription:

Consume an External Web Service in a Nutshell with good old ABAP Applies to: SAP_BASIS, Release 701, SP Level 8 Summary Have you ever tried to consume an external web service out of ABAP? This document provides a detailed description which steps have to be processed to call an external web service. It is easy to reproduce and can be a basis for more complex developments using external web services. Author: Andreas Hettich Company: SAP AG Created on: 15 April 2011 Author Bio Andreas is a principal architect at SAP Custom Development and mainly focused on developments in the area of Financials. 2011 SAP AG 1

Table of Contents Consume an external web service in a nutshell... 3 Assumption... 3 Create Consumer Proxy... 3 Next step is to create a logical port... 6 ABAP Coding... 8 Related Content... 10 Copyright... 11 2011 SAP AG 2

Consume an external web service in a nutshell Goal of this instruction is to demonstrate how easy it is to consume an external web service with ABAP. This example is based on an external web service which provides quotes for stocks. Anyway, this is just an example and basically any web service which is described via WSDL (Web Service Description Language) can be used. This example will retrieve the actual quote for the SAP share. Step by step the necessary proceedings to use an external web service are described. Assumption Make sure, that the proxy configuration is ok. Otherwise, you won t have a chance to connect to an external web service. The proxy settings can be found in SM59: Create Consumer Proxy At first you have to generate a consumer proxy. A proxy class will be generated, which will be instantiated later on in the report. Generation can be triggered out of SE80: 2011 SAP AG 3

2011 SAP AG 4

In the following dialogue you have to input the WSDL, in order that the proxy settings can be retrieved automatically: The following screenshot display the consumer proxy. For our example, the default settings are o.k. 2011 SAP AG 5

Next step is to create a logical port The logical port is necessary to call the external web service. You create the logical port with transaction SOAMANAGER. Within SOAMANAGER you have to go for the Single Service Administration: 2011 SAP AG 6

Within SOAMANAGER you have to select the respective web service: After applying the selection, you just push the button for creation of logical port and use the default setting. Be sure to input the correct URL for the WSDL into the creation dialogue and write down the logical port name. This will be used in your ABAP coding. Also make sure, that the proxy settings are entered: 2011 SAP AG 7

ABAP Coding The following sample coding consumes the external web service. It uses the created consumer proxy and the logical port to request the quote for the symbol SAP. After successful calling, the structure out keeps the actual values for the SAP stock. REPORT ZZ_GET_QUOTE. DATA: LV_QUOTE TYPE REF TO CO_TEST2_QUOTESTOCK_QUOTE_SOAP, IN TYPE TEST2_QUOTEGET_QUOTE_SOAP_IN, OUT TYPE TEST2_QUOTEGET_QUOTE_SOAP_OUT, oref TYPE REF TO cx_root, text TYPE string. *http://www.webservicex.net/stockquote.asmx?wsdl TRY. CREATE OBJECT LV_QUOTE EXPORTING LOGICAL_PORT_NAME = 'TESTPORT'. CATCH CX_AI_SYSTEM_FAULT into oref. text = oref->get_text( ). ENDTRY. IF NOT text IS INITIAL. WRITE / text. ENDIF. *Fill request with to be retrieved stock symbol in-symbol = 'SAP'. *Get stock quote TRY. CALL METHOD LV_QUOTE->GET_QUOTE EXPORTING 2011 SAP AG 8

INPUT = in IMPORTING OUTPUT = out. CATCH CX_AI_SYSTEM_FAULT into oref. text = oref->get_text( ). CATCH CX_AI_APPLICATION_FAULT into oref. text = oref->get_text( ). ENDTRY. IF NOT text IS INITIAL. WRITE / text. ELSE. WRITE out-get_quote_result. ENDIF. 2011 SAP AG 9

Related Content ESR Demo Error in Webservice Call HTTP Error Note 1327511 - Limitations and common problems in ABAP WSDL processing How to consume enterprise services with Ruby on Rails 2011 SAP AG 10

Copyright Copyright 2011 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. 2011 SAP AG 11