Вы находитесь на странице: 1из 10

SDN Contribution

Cost-Effective and Quick Communication between SAP and 3rd Party Systems using IDOC HTTP XML Interface
Summary
This Article demonstrates the Integration procedure between SAP and 3rd Party Systems using HTTP IDOC XML Interface. This article contains a walk-through for setting up the SAP Environment for such Seamless Communication to take effect. Created on: 21 April 2006

Applies To
Custom Integration between SAP Environment and 3rd Party Systems (.Net, Java etc )

Audience
Technical consultants, Architects, Developers, IT Managers

Author Bio

Arvind Kugasia is a SAP NetWeaver technical consultant working with HCL, having total experience of more than 3 years in all phases of application development with proficiency in cutting edge technologies like Java/J2EE/JCA and SAP NetWeaver technology as basic skill set.

2006 SAP AG

Table of Contents
Introduction ...................................................................................................................................... 3 Architecture...................................................................................................................................... 3 Step-by-Step Solution...................................................................................................................... 3 Receiving the IDOC at 3rd Party System ......................................................................................... 8 Conclusion ....................................................................................................................................... 9 Copyright........................................................................................................................................ 10

2006 SAP AG

Introduction
Today Enterprises are aiming to achieve interoperability by integrating their systems and processes within their organization which could fulfill the requirements corresponding to tight integration, frequent communication and high levels of data exchange. Though the communication between SAP/R3 System and 3rd Party System can also be achieved with the help of middleware like JCo (A Proxy based solution) or Adapter (Using JCA) but this has its own demerits in some business scenario where frequent communication is desired, additionally enterprises would want to avoid and save the efforts put in to develop a separate business process for communication.. The target is to reflect those scenarios where seamless business integration is desired. The steps shown below connect a 3rd Party System (Here a Java application) to SAP/R3 environment using ALE settings.

Architecture
Architecture uses Java as 3rd Party system for communicating with SAP/R3 environment using HTTP/XML format.

Fig1. Architectural Diagram

Note: SAP and 3rd Party System Server also allow the use of HTTP(S) for secure communication between the 2 different systems.

Step-by-Step Solution
For Triggering an IDOC from SAP, a distribution scenario must be configured including the port definitions and partner profiles. For the basic settings we will describe the set up of the necessary ports and logical systems. The set up of the partner profiles is described in the next section. We will mainly concentrate on the IDOC Posting from SAP side and receiving it from 3rd Party (i.e. Java Servlet here). First step is to set up a logical system. Use transaction SALE and choose Define Logical System. Note: Logical Systems represent R/3 or external systems in the SAP R/3 environment for the distribution of data

2006 SAP AG

1. Define Logical Systems

The 2 Logical systems need to be defined demonstrated as below. 1. Logical system representing SAP/R3 environment. 2. Logical system representing 3rd Party System

Fig2. View of logical systems

Next step is defining the 2 logical systems and Assign these Logical system to a valid Client/s.

Here in cases the logical system SAPHR is used for SAP/R3 system where as HTTPLOG is for a 3rd party system (say, JAVA system).

2006 SAP AG

Fig3. Assign Logical system to a client

2. Create RFC Destination

Create a new RFC Destination using the transaction code SM59; after entering the name for the RFC Destination, the Connection Type, and a Description press SAVE to persist and activate the settings for the HTTP Connection.

Configure the settings for the HTTP connection as shown in below figure. Target Host specified is the server where your 3rd Party application exists. Path Prefix is the description of your 3rd Party application

2006 SAP AG

Fig4. Defining Target Host, Service No. and Path Prefix

Once completed, test the connection by clicking TEST CONNECTION. This would be a GET Request thrown at the application above specified location.

Note: IDOC posted would be a POST Request in the real scenario. Thus in the real scenarios, IDOC needs to be handled in POST segment of the application.

3. Port Configuration for IDOC Processing

Use transaction WE21 and create a new XML HTTP Port with the following parameters:

Fig.5 Create XML HTTP Port for IDOC Processing

4. Creating Partner Profiles


Use transaction WE20 for creating partner profile.

Use F5 (Create) for creating the Partner Profile. Use the message Type as per the business requirement.

2006 SAP AG

Fig6. Create Partner Profile

Note: Message Type relates to the structure of the data called in an IDOC. Thus message types should be selected as per the requirement in an IDOC. ALE supports over 200 message types in R/3. Next, create the Outbound Parameters by clicking on the +Button and then Set the required parameters. Note: Receive Port should be specified as per the port earlier created using WE21, refer fig5.

5. Create Distribution Model

Create a new Model for distribution.

Select the Model created and add the sender, receiver and Message type for this model.

2006 SAP AG

Fig7. Create Model

The final step is to generate the Partner Profile, Use the tcode BD64 GOTO Environment --> Generate Partner Profile.

Select the Partner system as HTTPLOG and Execute to check the results.

SAP/R3 Environment is established to send the IDOC via HTTP.

Note: Any standard executable can trigger the IDOC from SAP Environment, e.g. RHALEINI or RBDMIDOC (Use HRMD_A as the Message type).

Receiving the IDOC at 3rd Party System


In order to receive the IDOC at 3rd Party System, any code for binary request receiver will be applicable to retrieve the IDOC payload.

Use below code snippet in server side program component to receive the payload of outbound IDOC.

//This would fetch the XML Payload into a Reader (BufferedReader) //The request object used is HttpServletRequest object. BufferedReader b = request.getReader (); String IDoc = b.readLine (); 2006 SAP AG 8

Conclusion
Though above solution will be a boon for those Enterprises which are increasingly looking to deliver real business benefits by integrating their systems and processes both within their organizations and between organizations to gain tight integration, frequent communication and data exchange but For high availability, one should consider load-balancing the IDOC receiver/sender tier from the message processing tier as shown below.

Fig8. Load Balancing at 3rd Party Server

2006 SAP AG

Copyright
Copyright 2006 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, z/OS, AFP, Intelligent Miner, WebSphere, Netfinity, Tivoli, and Informix are trademarks or registered trademarks of IBM Corporation 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 information 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.

2006 SAP AG

10

Вам также может понравиться