Date post: | 28-Jan-2016 |
Category: |
Documents |
Upload: | gpsingh007 |
View: | 9 times |
Download: | 1 times |
SAP R/3 Application Connector (ALE Communication)
Axway Integration Broker 2.1
Document Number: AA-1028-4 August 2004
XIB: SAP/R/3 Manual Notices 2
NOTICES Copyright © Axway Software, 2005 All rights reserved. This edition applies to Axway Integration Broker 2.0 (hereafter abbreviated as XIB) and to all subsequent releases of this product until otherwise indicated in new releases or in technical updates. No part of this publication may be reproduced, transmitted, stored in a retrieval system, or translated into any human or computer language, in any form or by any means, electronic, mechanical, magnetic, optical, chemical, manual, or otherwise, without the prior written permission of the copyright owner, Axway Software. This document, provided for informational purposes only, may be subject to significant modification. The descriptions and information in this document may not necessarily accurately represent or reflect the current or planned functionalities of this product. Axway Software may change this publication, the product described herein, or both. These changes will be incorporated in new versions of this document. Axway Software does not warrant that this document is error free. The optional component, Security Library, is not available in the United States. Note: In this manual, the screen captures/images of any XIB dialog boxes were taken on a previous version of the software (version 1.3.0 of the TradeSync Integration Broker), and the descriptions of these dialog boxes may refer to that version; however, this might not be the only version of XIB that supports this connector. Contact Axway Support for more.
Trademarks Axway Integration Broker, XIB, and Datamapper are trademarks of Axway Software. UNIX is a registered trademark in the United States and other countries, licensed exclusively through X/Open Company Limited. Microsoft and Windows are registered trademarks of Microsoft Corporation. Axway Software recognizes the rights of the holders of all trademarks used in its publications.
How to contact us Contact Axway Software Support or your local Axway Integration Broker dealer if you have questions or problems concerning Axway Integration Broker. Send comments about this manual to: ♦ Technical Documentation
Axway Software 26, rue des Pavillons Puteaux, 92807 Cedex France
XIB: SAP/R/3 Manual Contents 3
TABLE OF CONTENTS CHAPTER 1. INTRODUCING THE R/3 APPLICATION CONNECTOR .............................9
INTRODUCTION ..............................................................................................................................9 THE METADATA BROWSER............................................................................................................9 IDOC TRANSFERS AND APPLICATION LINK ENABLING (ALE) .....................................................10 ARCHITECTURE............................................................................................................................10 SOURCES OF INFORMATION..........................................................................................................12
CHAPTER 2. METADATA AND THE METADATA BROWSER.........................................13 INTRODUCTION ............................................................................................................................13 THE INITIAL DISPLAY ..................................................................................................................13 WORKING WITH METADATA IN THE SOURCE VIEW......................................................................14
Retrieving Metadata................................................................................................................14 Viewing the Properties of Metadata Items ..............................................................................15 Clearing Child Metadata Items...............................................................................................15 Starting Again from Where You Left Off: the Current Data Set..............................................15
LOGGING ON TO SAP ...................................................................................................................15 WORKING WITH METADATA TYPES .............................................................................................17 MENU OPTIONS ............................................................................................................................18
CHAPTER 3. IDOCS IN XIB ......................................................................................................20 INTRODUCTION ............................................................................................................................20 IDOC DEFINITIONS.......................................................................................................................20 IMPORTING IDOC DEFINITIONS INTO THE XIB DATAMAPPER ......................................................20
Workflow: IDoc Download – Metadata Browser – Mapping .................................................20 The Metadata Browser ............................................................................................................21
WORKING WITH IDOCS IN THE METADATA BROWSER .................................................................21 Retrieving IDoc Data Structures Interactively........................................................................21 Retrieving IDoc Data Structures Using IDoc Reports ............................................................22 The Levels of Metadata under the IDocs Symbol ....................................................................26 Copying Items from the Source to the right pane....................................................................27 Using the right pane................................................................................................................27
CHAPTER 4. BAPIS IN XIB .......................................................................................................29 INTRODUCTION ............................................................................................................................29 INVOKING BAPIS SYNCHRONOUSLY............................................................................................29 INVOKING BAPIS ASYNCHRONOUSLY .........................................................................................29 VIEWING BAPIS IN THE METADATA BROWSER ...........................................................................29
The Levels of Metadata under the BAPIs Symbol ...................................................................31 Parameters ..............................................................................................................................31
CHAPTER 5. SAP FUNCTION MODULES IN XIB................................................................32 INTRODUCTION ............................................................................................................................32 INVOKING FUNCTION MODULES IN SAP ......................................................................................32
Importing and Exporting Data to and from Function Modules...............................................32 Managing a Synchronous Dialog with SAP ............................................................................32
VIEWING FUNCTION MODULES IN THE METADATA BROWSER.....................................................33 The Levels of Metadata under the Function Modules Symbol ................................................34 Parameters ..............................................................................................................................34
CHAPTER 6. SAP TRANSACTIONS IN XIB...........................................................................36 INTRODUCTION ............................................................................................................................36 WHAT IS A SAP TRANSACTION?..................................................................................................36 INPUT TO SAP TRANSACTIONS ....................................................................................................36 TRANSACTION CODES ..................................................................................................................36 INVOKING TRANSACTIONS IN SAP...............................................................................................36
XIB: SAP/R/3 Manual Contents 4
VIEWING SAP TRANSACTIONS IN THE METADATA BROWSER .....................................................36 The Levels of Metadata under the Transactions Symbol.........................................................37
CHAPTER 7. DATA TRANSFERS IN XIB...............................................................................39 INTRODUCTION ............................................................................................................................39 CONFIGURATION..........................................................................................................................39 EXECUTION OF AN ALE RETRIEVE METHOD ...............................................................................39 EXECUTION OF AN ALE SEND METHOD ......................................................................................40 EXECUTION OF A RECEIVE OR SEND ACTIVITY ............................................................................40
Scheduling (Retrieve and Send Methods Only) .......................................................................40 Retries (Send Methods Only)...................................................................................................41 Execution of Receive Activities................................................................................................41 Execution of a Send Activity....................................................................................................41 Log Entries ..............................................................................................................................42
CHAPTER 8. TASKS ...................................................................................................................43 ALE TRANSFER ADAPTER TASK..................................................................................................43
General Tab ............................................................................................................................43 Configuration Tab...................................................................................................................44 Transfer Adapter Tab ..............................................................................................................44 Start Up Tab............................................................................................................................45
ALE TRANSFER CLASSIFIER TASK ..............................................................................................45 CHAPTER 9. CREATING ALE OBJECTS...............................................................................47
ALE MANAGER ...........................................................................................................................47 ALE GATEWAY OBJECT ..............................................................................................................47
General Tab ............................................................................................................................47 ALE LOGON OBJECT ...................................................................................................................48
General Tab ............................................................................................................................49 Preferences Tab ......................................................................................................................49
ALE NODE OBJECT .....................................................................................................................52 General Tab ............................................................................................................................52
CHAPTER 10. CREATING RETRIEVE AND RECEIVE METHODS .................................55 ALE MANAGER ...........................................................................................................................55 ALE RETRIEVE METHOD.............................................................................................................55
General Tab ............................................................................................................................55 Schedule Tab ...........................................................................................................................56 ALE - Reference Tab ...............................................................................................................57 ALE - Preferences Tab ............................................................................................................57
ALE RECEIVE METHOD...............................................................................................................58 General Tab ............................................................................................................................58 ALE Tab ..................................................................................................................................59
CHAPTER 11. CREATING SEND METHODS........................................................................60 ALE MANAGER ...........................................................................................................................60 ALE SEND METHOD ....................................................................................................................60
General Tab ............................................................................................................................60 Retry Tab.................................................................................................................................61 Schedule Tab ...........................................................................................................................62 ALE Tab ..................................................................................................................................63
CHAPTER 12. IDOC DATA CLASSIFICATION ....................................................................64 INTRODUCTION ............................................................................................................................64 INTEGRATION MANAGER .............................................................................................................64 CLASSIFICATION ACTIVITY..........................................................................................................65
General Tab ............................................................................................................................65 CHAPTER 13. IMPLEMENTING IDOC STATUS UPDATES ..............................................70
XIB: SAP/R/3 Manual Contents 5
INTRODUCTION ............................................................................................................................70 IDOC STATUS UPDATES USING A CUSTOM MBC...........................................................................70
Implementing the custom MBC ...............................................................................................70 Configuring the custom MBC..................................................................................................71 Integration Manager ...............................................................................................................71 Sequential Activity...................................................................................................................72 Stage Dialog............................................................................................................................73
CREATING ALE STATUS UPDATE METHODS ................................................................................74 ALE Manager ..........................................................................................................................75 ALE Status Update Method .....................................................................................................75
CHAPTER 14. MESSAGE LOG.................................................................................................80 SEARCH RECEIVE EVENTS ...........................................................................................................80 SEARCH SEND EVENTS.................................................................................................................81 SEARCH STATUS UPDATE EVENTS ...............................................................................................82 SEARCH IDOC DATA CLASSIFIER EVENTS ...................................................................................84 DISPLAY RECEIVE EVENT ............................................................................................................85 DISPLAY SEND EVENT .................................................................................................................90 DISPLAY STATUS UPDATE EVENT................................................................................................93 DISPLAY IDOC DATA CLASSIFIER EVENT ....................................................................................96 DISPLAY ASYNCHRONOUS IDOC STATUS UPDATE CREATOR EVENT...........................................98
CHAPTER 15. MESSAGE ATTRIBUTES ..............................................................................100 RECEIVE ATTRIBUTES................................................................................................................100 SEND ATTRIBUTES .....................................................................................................................101
CHAPTER 16. ALE AND IDOC CONFIGURATION IN SAP..............................................103 DESTINATIONS ...........................................................................................................................103 PORTS ........................................................................................................................................105 LOGICAL SYSTEM ......................................................................................................................106 PARTNER PROFILES....................................................................................................................107
Outbound Parameters ...........................................................................................................109 Inbound Parameters..............................................................................................................111
DISTRIBUTION MODEL ...............................................................................................................112 OTHER SAP MENU OPTIONS......................................................................................................113
General ALE Configuration ..................................................................................................113 Gateway Monitoring .............................................................................................................114 Transactional RFC Monitoring.............................................................................................114 IDoc Transfer Monitoring.....................................................................................................115
CHAPTER 17. GENERATING IDOC REPORTS IN SAP ....................................................118
CHAPTER 18. ABOUT THE TID VIEWER ...........................................................................121 TRANSACTION IDS (TIDS)..........................................................................................................121 LAUNCHING THE TID VIEWER...................................................................................................121 WHAT THE TID VIEWER DISPLAYS ............................................................................................121
APPENDIX A. MESSAGE BUILDER LIBRARY REFERENCE.........................................123
APPENDIX B. SAP FUNCTION MODULE IMPLEMENTATION EXAMPLE ................157
APPENDIX C. ALE LOG CLEAN UTILITY..........................................................................161 SYNTAX OF ALE LOG CLEAN ....................................................................................................161
INDEX..........................................................................................................................................162
XIB: SAP/R/3 Manual Contents 6
TABLE OF FIGURES Figure 1. From metadata to XIB conversion program.....................................................................10 Figure 2. Data transfer with RFC layer ...........................................................................................11 Figure 3. Processing layers in XIB and SAP...................................................................................11 Figure 4. Transferring data using Message Builder and Function Modules....................................12 Figure 5. From IDoc download to IDoc conversion program .........................................................21
XIB: SAP/R/3 Manual Preface 7
PREFACE
Intended Audience This manual is intended for users who want to use Axway Integration Broker (XIB) to receive or send messages via ALE. A quick introduction to setting up the R/3 Application Connector can be found in the Getting Started manual.
What’s in this manual Chapter 1. Introducing the R/3 Application Connector
introduces the R/3 Application Connector and its architecture, describes the role of the Metadata Browser, and provides an introductory discussion of the transfer of IDocs using Application Link Enabling (ALE).
Chapter 2. Metadata and the Metadata Browser
provides more detailed information about the Metadata Browser and how it is used to retrieve and work with metadata.
Chapter 3. IDocs in XIB gives detailed information on IDoc definitions, importing these definitions, and working with IDocs in the Metadata Browser.
Chapter 4. BAPIs in XIB describes how to invoke BAPIs (synchronously and asynchronously) and how to view them in the Metadata Browser.
Chapter 5. SAP Function Modules in XIB
describes how to invoke Function Modules in SAP and how to view them in the Metadata Browser.
Chapter 6. SAP Transactions in XIB
describes when and how to use SAP Transactions and how to view them in the Metadata Browser.
Chapter 7. Data transfers in XIB provides information on configuring and executing the required ALE retrieve, receive, and send methods that enable the flow of data to and from a SAP server.
Chapter 8. Tasks describes how you create ALE transfer adapter tasks and ALE transfer classifier tasks required to run ALE integrations.
Chapter 9. Creating ALE Objects describes how to create ALE objects, which are components the can be re-used in many ALE Retrieve and Send methods, thus reducing data entry time.
Chapter 10. Creating Retrieve and Receive Methods
provides information on creating the required ALE retrieve and receive methods, whose configuration and execution were are described in “Chapter 7. Data transfers in XIB”.
Chapter 11. Creating Send Methods provides information on creating the required ALE send methods, whose configuration and execution were are described in “Chapter 7. Data transfers in XIB”.
Chapter 12. IDoc Data Classification
describes the IDoc Classifier, a data classifier you can use to parse information like sender, receiver, and message type from an IDoc. This removes any dependency on the ALE Transfer Adapter and allows an IDoc file to be classified at any stage in a XIB integration.
Chapter 13. Implementing IDoc explains how to send IDoc status records back
XIB: SAP/R/3 Manual Preface 8
Status Updates to the SAP system from which the IDoc was sent, thus reporting information the sending SAP system on the processing of the IDoc at the remote system.
Chapter 14. Message Log describes the Message Log functionality specific to the R/3 Application Connector.
Chapter 15. Message Attributes How to override send and receive attributes in messages
Chapter 16. ALE and IDoc Configuration in SAP
describes basic SAP configuration related only to the R/3 Application Connector.
Chapter 17. Generating IDoc Reports in SAP
describes how to produce IDoc reports using the SAP GUI.
Chapter 18. About the TID Viewer describes the TID Viewer Appendix A. Message Builder Library Reference
describes statements and functions provided with the R/3 Application Connector.
Appendix B. SAP Function Module Implementation Example
provides a full example of the implementation of a synchronous call to a SAP Function Module.
Appendix C. ALE Log Clean Utility describes how to clean the ale logs
Document History AA-1028-4 (August 2004) Added Chapter 18. About the TID Viewer AA-1028-3 (March 2003) Minor editorial updates AA-1028-2 (September 2002) Contains the initial updates required subsequent
to the acquisition of this product by Axway Software.
AA-1028-1 (February 2002) This is the first version of this manual.
XIB: SAP/R/3 Manual 1. Introduction to R/3 AC 9
CHAPTER 1. INTRODUCING THE R/3 APPLICATION CONNECTOR
Introduction The R/3 Application Connector for SAP provides a comprehensive environment for the transfer of data between SAP systems and Axway Integration Broker systems. Note: In this document, the term “SAP” means “SAP R/3”. SAP can transfer data between systems in many ways using: ♦ IDocs ♦ BAPIs (Business Application Programming Interface) ♦ SAP Function Modules. ♦ SAP Transactions (supporting Batch Input or BDC) The R/3 Connector supports each of these methods. This manual describes how the R/3 Connector enables the transfer of data when using each of these methods.
The Metadata Browser For each of the data transfer types, the Metadata Browser may be used to retrieve data structures from SAP. These data structures may be used to simplify the implementation of data transfers with SAP. A detailed description of the Metadata Browser is given in “Chapter 2. Metadata and the Metadata Browser”. The retrieval of the metadata for different data structures is described in chapters: “Chapter 3. IDocs in XIB”, “Chapter 4. BAPIs in XIB”, “Chapter 5. SAP Function Modules in XIB”, and “Chapter 6. SAP Transactions in XIB”. For IDocs, the data structure of IDocs may be retrieved, and used to create ADF files. These ADF files are used in the XIB Datamapper to create programs for the conversion of data from one format to another. For more information on the Datamapper, refer to the Datamapper manual.
XIB: SAP/R/3 Manual 1. Introduction to R/3 AC 10
SAP R/3 Metadata
ADF file
MetadataBrowser
Datamapper
Other formats
ConversionPrograms
1 . Metadata is automatically downloadedto the Metadata Browser,where it is available foruse when you make anADF file or just browse.
2 . Mapping with the Datamapper: the Sourcefile is in the left pane, theDestination file is in theright pane.
3 . Your map is made intoa conversion program,which XIB uses to translate messages into therequired format.
Figure 1. From metadata to XIB conversion program
For SAP Function Modules, BAPIs, and SAP Transactions, the Metadata Browser can also be used to browse the data structures of these objects, but currently it cannot be used to make ADF files for them.
IDoc Transfers and Application Link Enabling (ALE) The XIB R/3 Application Connector uses Application Link Enabling (ALE) to support the transfer of IDocs to and from SAP. ALE is an asynchronous method of communication between local or remote SAP systems. ALE is SAPs preferred method of integration between SAP systems, and between SAP and other applications. ALE supports fully transactional dialogs (commit and rollback). It is possible to configure SAP to use other transfer methods such as EDI, CPI-C, and Internet to transfer IDocs, but only ALE is implemented in XIB. Note: The ALE Transfer Adapter only enables a link between XIB and IDocs within
the ALE subsystem in SAP. It is the responsibility of the XIB user to configure the ALE subsystem in SAP to send and receive IDocs, and then to enable the appropriate workflows within SAP.
Architecture For all data transfers with SAP, the technology underlying the data transfer to and from SAP is a Remote Function Call (RFC) layer (supplied by SAP), which operates over an IP network.
XIB: SAP/R/3 Manual 1. Introduction to R/3 AC 11
XIB
RFC layer RFC layer
SAP
IP
Figure 2. Data transfer with RFC layer
In each case, different layers are used to support the data transfers. These layers may be viewed in two ways. One view is processing layers. For IDocs, the ALE Transfer Adapter (ALE TA) is used to transfer data in and out of XIB, and this transfer is processed by the ALE subsystem in SAP.
SAP XIB
RFC layer RFC layer IP
ALE TA
Routing
ALE subsystem
Workflow
Figure 3. Processing layers in XIB and SAP
Each layer represents a function within the XIB and SAP systems. The RFC layer is a low-level transport mechanism, the ALE TA and subsystem are higher-level transport systems, and Routing and Workflow are involved with the processing of the data at a business level. The alternative view is a functional view. If we wish to enable BAPIs, SAP Function Modules, or SAP Transactions in XIB, then we need to manually create Message Builder programs, which are used to directly address Function Modules in SAP.
XIB: SAP/R/3 Manual 1. Introduction to R/3 AC 12
SAP XIB
RFC layer RFC layer IP
MessageBuilder Function Module
Figure 4. Transferring data using Message Builder and Function Modules
So the call to a Function Module is effectively a direct call in the Message Builder program. For all data transfers, this is what actually takes place. For example, in the ALE Transfer Adapter, a data transfer to SAP is achieved by a Message Builder program that calls a Function Module in SAP. This Function Module transfers the incoming IDoc to the ALE subsystem for processing. When we retrieve metadata from SAP, this is also achieved by a Message Builder program that calls a number of Function Modules in SAP.
Sources of Information For a description of SAP Interface Technology, refer to the free CD that is issued by SAP, the SAP Interface Advisor. This may be ordered from SAP directly (or through their Website). This CD also contains a detailed explanation of how to configure SAP to support their interfaces, including the technology that supports the link to XIB. In this manual it is described in outline form in “Chapter 16. ALE and IDoc Configuration in SAP”. For more, refer to the SAP manuals.
XIB: SAP/R/3 Manual 2. Metadata and Metadata Browser 13
CHAPTER 2. METADATA AND THE METADATA BROWSER
Introduction The Metadata Browser has been designed with two main purposes in mind: ♦ A means of displaying metadata retrieved from one or more applications. In this
manual, we describe how you use it with SAP. ♦ A method of creating XIB Datamapper ADF files, which can then be used to create
mapping programs for use in the XIB platform. Note: the Metadata Browser can be used to make ADF files for IDocs only. It can be used to browse BAPIs, Function Modules, and SAP transactions, but currently it cannot be used to make ADF files for them.
Start the Metadata Browser from the System Manager by double-clicking the Metadata Browser icon.
The Initial Display The initial display of the Metadata browser shows two panes: ♦ Left pane – this pane displays the metadata for IDocs, BAPIs, Function Modules, and
SAP Transactions. ♦ Right pane – this pane displays the output that has been selected from the metadata in
the Source View. This output can then be used to create an ADF file. The information in each pane is displayed in the form of a tree structure. In the left pane, a tree can be constructed that displays, in a hierarchical fashion, the metadata retrieved from SAP. All of this metadata, or only selected elements of the metadata, can be copied from the left pane to the right pane, where it is also displayed in a tree structure.
XIB: SAP/R/3 Manual 2. Metadata and Metadata Browser 14
Working with Metadata in the Source View You build the Metadata in the left pane by: ♦ Double-clicking an item in the tree or ♦ Highlighting an item and selecting the menu option Source / Access Site. In the case of the R/3 Connector, two items are registered at the top level of the Source View pane: ♦ SAP ♦ SAP IDoc Report The SAP item may be used to obtain metadata interactively from your SAP system. The SAP IDoc Report item may be used to retrieve metadata about IDoc data structures from IDoc reports that are downloaded manually from the SAP system. This method does not require an interactive connection to your SAP system.
Retrieving Metadata When an item in a tree has been double-clicked or an item has been selected and Source / Access Site is selected, the R/3 Connector retrieves one or more levels of metadata below the current item, and displays them in the pane. For some items, a dialog will open that prompts the user to select a subset of data for the next level. For example, if the next level under the current item is a list of IDocs, it is more sensible to be able to select one or more IDocs rather than download details for all IDocs on the SAP system.
XIB: SAP/R/3 Manual 2. Metadata and Metadata Browser 15
For some items, the R/3 Connector must retrieve a large amount of metadata. In this case, the metadata is retrieved asynchronously, so that the XIB Tools menu server is not locked by the operation. When retrieving asynchronously, a progress bar dialog is displayed. This dialog has a Cancel button; clicking the Cancel button aborts the current metadata retrieval. Typically, the retrieval would be cancelled if the selection of a subset of metadata is too wide and the retrieval is taking too long. The retrieval can then be repeated, selecting a smaller subset of metadata. In all cases when metadata is being retrieved, a “Processing” progress bar is displayed while the Source View pane is being updated with the new data.
Viewing the Properties of Metadata Items For each item of metadata, the View / Properties can be clicked to display a dialog that contains a list of properties for the selected item. If this dialog is left open, then changing the selected metadata item will change the contents of the Properties dialog appropriately.
Clearing Child Metadata Items Whenever a metadata item is selected, the Source / Clear Item will remove all of the child metadata items for the selected item.
Starting Again from Where You Left Off: the Current Data Set When the Metadata Browser is closed, the current data set is always saved. The current data set contains the data you retrieved from SAP when you last logged into SAP plus any changes you have made to the retrieved data. The login information is also saved. When the Metadata Browser is re-opened, a dialog will ask if you wish to restore the data that was saved from your last session.
If you select Yes, the saved data set for the current XIB user is restored, and the Metadata Browser presents the data as it was when you last closed the browser. If you select No, then the data displayed in the Metadata Browser is reinitialized. The saved current data set is unique for each XIB user defined to the XIB system.
Logging on to SAP When you view the left pane, you will refer to the SAP symbol. The level immediately below the SAP symbol shows the SAP systems to which you can logon. You must logon to access any metadata from a SAP system. After you select a SAP system, you enter the logon parameters in the SAP Logon dialog that is displayed. Access to a SAP system is obtained by: ♦ Double-clicking on the SAP Connector item or
XIB: SAP/R/3 Manual 2. Metadata and Metadata Browser 16
♦ Highlighting the SAP Connector item and selecting Source / Access Site. These actions will open a logon dialog:
To successfully logon, you enter, in the SAP Logon dialog, the data that would be required to start a remote session of the SAP GUI. The following data should be entered:
Data Description Destination The system name of the remote SAP system.
Host name The name of the remote SAP host. This can take one of
two formats: 1. A TCP/IP host name, or a valid DNS name (if DNS is being used) or an IP address. If you use a TCP/IP host name, it must also be defined in the file /etc/hosts on UNIX systems, the file %SystemRoot%\drivers\etc\hosts on Windows NT systems, or the TCP/IP host table on AS/400 systems. 2. A saprouter address. This takes the format: /H/routername/S/service/…/H/hostname.
System Number The system number defined at the SAP host. This number can be any integer between 0 and 99. This parameter defaults to the SAP default, 0.
Gateway The Gateway to connect to. This parameter is optional.
Port The port number at the remote SAP system. This parameter defaults to the SAP default, 3300.
Client The client number for the connection to the remote SAP system.
XIB: SAP/R/3 Manual 2. Metadata and Metadata Browser 17
User SAP user login name.
Note that the use of a SAP CPIC user will give improved security and ease of use, as this user type cannot login to SAP interactively, and the password will never expire.
Password The password for the SAP user. This parameter is not echoed back to the user, and it is encrypted in the XIB system.
Language The Language code to used when establishing an ALE link. The Language code is an optional field. It defaults to “EN” (English).
If the logon is successful, then a tree item will appear, the name of which is set to the name of the remote SAP system (Destination) specified in the logon dialog.
If the logon is unsuccessful, then an error dialog will be displayed. Note that if you logoff from XIB, all the logon information is saved and displayed in the dialog box next time you want to logon.
Working with Metadata Types Below the Logon icon, the next level in the left pane is a Metadata Type level. When you are logged on to a SAP system, these different types of metadata are available: ♦ IDocs ♦ BAPIs (view only) ♦ Function Modules (view only) ♦ Transactions (view only)
XIB: SAP/R/3 Manual 2. Metadata and Metadata Browser 18
The metadata types can be displayed by: ♦ Double-clicking on the Logon item or ♦ Highlighting the Logon item and selecting Source / Access Site. Note that when you view a tree structure that includes metadata, you are not viewing in real-time what is in the SAP system. You are viewing what was retrieved from the SAP system; and after the data has been retrieved, the connection to the SAP system is terminated until the next request for data. Tree items will appear for each metadata type.
The figure above shows the display of the different metadata types. Details of the metadata associated with each of these types are described in subsequent chapters.
Menu options These menu options are enabled in the Metadata Browser: Menu option Description File / Exit Exit from the Metadata Browser File / New Clear the current Format Connector pane. File / Open Open a Windows dialog to select an existing client
Datamapper ADF file, and import the data from that file into the Format Connector pane.
File / Save Save the data in the Format Connector pane to a Datamapper ADF file. If the data has not been imported from an existing ADF file, and the data has not been saved previously, then a Windows dialog will be presented to define the file name.
File / Save As Save the data in the Format Connector pane data to
XIB: SAP/R/3 Manual 2. Metadata and Metadata Browser 19
a Datamapper ADF file. Open a Windows dialog to define the file name.
Source / Access Site Request the retrieval of the next level of metadata for the currently selected metadata item in the Source View pane.
Source / Clear Item Remove all child metadata items from the currently selected item in the Source View pane.
Import / Add Item Copy the selected Source View metadata item to the Format Connector pane. If a data tree structure already exists in the pane, then the new tree will be appended to that structure.
Import / Add Children Copy all of the children of the selected Source View metadata item to the Format Connector pane. If a data tree structure already exists in the pane, then the new tree will be appended to that structure.
Import / Delete Item Remove the selected Format Connector item, and all of its children, from the display.
Help / Help Display Help dialog.
XIB: SAP/R3 Manual 3. IDocs in XIB 20
CHAPTER 3. IDOCS IN XIB
Introduction Intermediate Documents (IDocs) are files that use a proprietary file format defined by SAP.
IDoc Definitions SAP (currently) supplies over 200 standard IDoc definitions with all SAP R/3 systems. These definitions correspond to the transfer of different types of business data between systems. For example, there is an INVOIC IDoc definition for the transfer of invoice information, and an ORDERS IDoc definition for sales orders. You can modify, or add to, the IDoc definitions in the SAP system, for details refer to the SAP manuals. Note: XIB supports only versions 2 and 3 of IDoc messages.
Importing IDoc Definitions into the XIB Datamapper In XIB, the Datamapper is used to define and create conversion programs that enable you to read and write from one data format to another. These conversion programs are created by the Datamapper from, among other things, data structure definitions called ADF (Application Data Format) files. Thus, you will need to create ADF files for the IDocs that you want to use when mapping with the Datamapper.
Workflow: IDoc Download – Metadata Browser – Mapping To make ADF files for IDocs, you must first import the IDoc data structures from SAP into the Metadata Browser to be able to create the appropriate ADF files. From the IDoc data definitions you import into the Metadata Browser, you make the ADF files, which are then automatically made available to the Datamapper for use in making the conversion programs.
Module 2 Module 2 Module 3 Module 3
Module 1 Module 1 SAP R/3 System 1SAP R/3 System 1
A A L L E E IDocs
IDocApplication Data Format
1. Import format into XIB ADF repository with Metadata Browser
SAP System
Some OtherApplication Data Format
2. Create Maps using XIB Datamapper
IDocConversion
Program
XIB: SAP/R3 Manual 3. IDocs in XIB 21
Figure 5. From IDoc download to IDoc conversion program
The XIB Metadata Browser Builder tool is used to import IDoc descriptions into XIB. To launch, double-click the Metadata Browser icon from the System Manager.
The Metadata Browser When logged on to a SAP system, the Metadata Browser enables the download and display of IDoc definitions. These definitions, or only the parts of the definitions you want, can then be copied to the Output display pane. Then a Datamapper ADF file can be created from the items in the Output display pane for use in the Datamapper. The operation of the Metadata Browser is described in general terms earlier in this Chapter. For a description of the operation of the XIB Datamapper, refer to the XIB Datamapper manual.
Working with IDocs in the Metadata Browser IDoc data structures may be retrieved in two ways in the Metadata Browser: ♦ Interactively, by logging on to your SAP system through the SAP item at the top
level of the Source View pane. ♦ Using an IDoc report generated by your SAP system, through the SAP IDoc Report
item at the top level of the Source View pane.
Retrieving IDoc Data Structures Interactively To retrieve IDoc data structures interactively, you must initially logon on to your SAP system as described in the section “Logging on to SAP” on page 15. In the Source View pane, the level under the IDocs item is a list of SAP Intermediate Documents (IDocs). The IDocs that you wish to view can be selected by: ♦ Double-clicking on the IDocs item or ♦ Highlighting the IDocs item and selecting Source / Access Site. These actions will open a selection dialog:
Entering a value in the IDoc Type field will return the metadata for the matching IDocs. This field allows wildcards. For example, entering “ORDERS*” will return a list of all IDocs that start with the text “ORDERS”. In addition to the next level of metadata, the IDoc Version is also returned. IDocs exist in up to two versions, Version 3 and Version 4. It is possible to drill down immediately through these layers of metadata.
XIB: SAP/R3 Manual 3. IDocs in XIB 22
The figure above illustrates the display of all these metadata items. Metadata for a particular IDoc Version can be built up by: ♦ Double-clicking the IDoc Version item in the tree or ♦ Highlighting the IDoc Version item and selecting Source / Access Site. All of the metadata for the selected IDoc Version will be returned immediately. It is possible to drill down immediately through the next layers of metadata.
Retrieving IDoc Data Structures Using IDoc Reports Generating and downloading IDoc reports from your SAP system is described in “Chapter 17. Generating IDoc Reports in SAP”. The generated reports should be placed in a directory on your XIB client, or in the IDOCreports/import directory under the $CORE directory of your XIB installation. When you view the Source View pane, you will see the SAP IDoc Report icon. To access SAP IDoc reports, you can: ♦ Double-click on the SAP IDoc Report item or ♦ Highlight the SAP IDoc Report item and selecting Source / Access Site.
XIB: SAP/R3 Manual 3. IDocs in XIB 23
Below the SAP IDoc Report icon, the next level in the Source View pane is a Host level. The following different hosts are defined: ♦ Client ♦ Server To access IDoc reports on either host you must: ♦ Double-click on the Host item or ♦ Highlight the Host item and selecting Source / Access Site.
Using IDoc Reports from the XIB Client
If you select the Client Host item, a File Selection dialog is displayed:
XIB: SAP/R3 Manual 3. IDocs in XIB 24
From this display you can navigate to any directory on your XIB client to find the IDoc report. The default directory for this display is the directory defined by the %TEMP% environment variable on your XIB client. If a file is selected, it is transferred to the XIB server and parsed to retrieve the IDoc data structure.
Using IDoc Reports from the XIB Server
If you select the Server Host item, then a list of files from the directory $CORE/IDOCreports/import is displayed:
XIB: SAP/R3 Manual 3. IDocs in XIB 25
To retrieve IDoc metadata from a report host you must: ♦ Double-click on the file item or ♦ Highlight the file item and selecting Source / Access Site.
XIB: SAP/R3 Manual 3. IDocs in XIB 26
The Levels of Metadata under the IDocs Symbol These levels of metadata are available for an IDoc data structure: ♦ IDoc packet (a level representing one or more IDocs) ♦ Records or Groups ♦ Data Elements A Record is a data structure of one or more data elements. A Group is a repeating unit of one or more Records. Groups can contain other Groups, to create a multiple level hierarchy of Records.
XIB: SAP/R3 Manual 3. IDocs in XIB 27
The figure above illustrates the display of all of these metadata items.
Copying Items from the Source to the right pane If the IDOCPKT item for an IDoc Version is selected in left pane, then the Import / Add Item selection is enabled (and the arrow button no longer appears dimmed). This permits the item and all of its children to be copied from the left pane to the right pane. You can copy several items. This will append new trees of data to the tree in the right pane.
Using the right pane The right pane is used to build a metadata tree structure that can then be converted into and saved as an XIB Datamapper ADF file.
Building a Metadata Tree Structure
Tree structures are built up by copying metadata from the left pane to the right pane. But not all metadata in the left pane can be copied. This is because an ADF file has a data structure that is comprised only two logical elements: Records and Fields, and only metadata items (and their children) that confirm to this structure can be copied.
IDoc Packets — the Logical Units with which to Build Tree Structures
For the SAP R/3 Connector, when working with IDocs, the only logical unit that can be copied is the IDoc packet, which represents a unit of one or more IDocs. When creating a mapping program in the XIB Datamapper, the file that contains IDoc data that is the input to or output from this mapping program will always comprise one or more individual IDocs, and a subset of the records defined for that IDoc. It is therefore only meaningful if the ADF file created by the Metadata Browser contains one or more parent IDocs, and a subset of their possible child data definitions.
Creating the ADF File
At any time, data in the right pane can be used to create an ADF file using the File / Save and File / Save As.
XIB: SAP/R3 Manual 3. IDocs in XIB 28
Clearing the right pane
If you wish to discard the current data in the right pane, selecting File / New will clear all data from the pane. Note that for other metadata types in SAP, there is currently no possibility to use mapping programs, so the copying of metadata to the right pane is not allowed.
XIB: SAP/R/3 Manual 4. BAPIs in XIB 29
CHAPTER 4. BAPIS IN XIB
Introduction The R/3 Connector can transfer data to and from SAP by using their Remote Function Call (RFC) technology. In the current version of the R/3 Connector, BAPIs can be accessed using a synchronous RFC connection to SAP. Thus, any SAP programming functions that are RFC-enabled can be called, and data passed into and out of SAP. The ALE RFC statements described in “Appendix A. Message Builder Library Reference” are used to do this.
Invoking BAPIs Synchronously While BAPIs are intrinsically entities that are typically addressed using more object-oriented methods such as COM and DCOM, or C++ programming, their implementation by SAP is entirely analogous to that of Function Modules. Each BAPI is the Method of a Business Object in SAP. This is implemented by SAP as a Function Module that has an object wrapper placed around it. In XIB, the implementation of a BAPI is not through the object itself, but through the associated Function Module. By their very nature, all Function Modules associated with BAPIs are RFC-enabled. The naming convention for the Function Module associated with a BAPI is straightforward. If each BAPI is a Method associated with a Business Object, for example, there is an “ExistenceCheck” Method for the Object “Material”, the associated Functions Module for this Method is BAPI_MATERIAL_EXISTENCE_CHECK. The arguments to a BAPI are mapped to parameters and tables for the associated Function Module. The implementation of a BAPI in XIB is therefore the same as the implementation of a Function Module. A full definition of a BAPI and the associated Function Module, with all parameters and tables, may be accessed using the Metadata Browser. This is discussed in “Viewing BAPIs in the Metadata Browser”.
Invoking BAPIs Asynchronously In the previous section we have seen that BAPIs can be invoked in SAP by synchronously calling the associated Function Module. An alternative to this approach is to use standard functionality within SAP to create an IDoc definition for a BAPI. For details of how to create an IDoc definition for a BAPI, you should consult the SAP manuals. After creating the IDoc definition for the BAPI in SAP, you can import this IDoc definition into XIB and, using the XIB Datamapper, create a mapping program that will convert input data into the IDoc format required by the BAPI. Using this mapping program and the ALE Transfer Adapter, you can address the BAPI asynchronously. Note: This technique is useful only for BAPIs that do not return significant data
because this data will not be returned to XIB.
Viewing BAPIs in the Metadata Browser In the Source View pane, the level under the BAPIs item is a list of SAP Business Objects. The Business Objects that you wish to view can be selected by:
XIB: SAP/R/3 Manual 4. BAPIs in XIB 30
♦ Double-clicking on the BAPIs item or ♦ Highlighting the BAPIs item and selecting Source / Access Site. These actions will open a selection dialog:
Entering a value in the Business Object Name field will return the metadata for the matching Business Objects. This field allows wildcards. For example, entering “Material*” will return a list of all Business Objects that start with the text “Material”. If the “Get all metadata” checkbox is checked, then all of the metadata for the selected Business Objects will be returned immediately. If it is unchecked, then only a list of Business Objects will be returned.
If all of the metadata is returned, then it is possible to drill down immediately through the layers of metadata displayed in the Browser. If only the list of Business Objects is returned, then lower layers of metadata can be built up by: ♦ Double-clicking an item in the tree
XIB: SAP/R/3 Manual 4. BAPIs in XIB 31
or ♦ Highlighting the item and selecting Source / Access Site.
The Levels of Metadata under the BAPIs Symbol These levels of metadata are available under the BAPIs item in the tree: ♦ Business Object ♦ Method (this level is equivalent to a single BAPI) ♦ Parameter Type (Import, Export or Table) ♦ Parameter When a single BAPI (Method) is selected for the further retrieval of metadata, all underlying metadata levels for the BAPI will be populated.
Parameters A Parameter can have more than one level of metadata. Import and Export Parameters can either be single fields or a data structure of one or more data elements. If they are data structures, then two levels of metadata will be displayed. Tables are always data structures containing one or more data elements, so two levels of metadata will always represent them.
The figure above illustrates the display of all these metadata items.
XIB: SAP/R/3 Manual 5. SAP Function Modules in XIB 32
CHAPTER 5. SAP FUNCTION MODULES IN XIB
Introduction The R/3 Connector can transfer data to and from SAP by using their Remote Function Call (RFC) technology. In the current version of the R/3 Connector, SAP Function Modules can be accessed using a synchronous RFC connection to SAP. Thus, any SAP programming functions that are RFC-enabled can be called, and data passed into and out of SAP. The ALE RFC statements described in “Appendix A. Message Builder Library Reference” are used to do this.
Invoking Function Modules in SAP Function Modules are units of programming in SAP, typically coded in a proprietary programming language, ABAP/4. These Function Modules have an attribute that flags whether it is enabled for RFC communications or not. Any Function Module that is RFC-enabled can be called using XIB.
Importing and Exporting Data to and from Function Modules Function Modules are defined with a number of data structures for importing and exporting data from the program. These data structures fall into three types: ♦ Import parameters
Import parameters are single data elements, or a single data structure comprised of a number of data elements, that are used to import data into the program.
♦ Export parameters
Export parameters are single data elements, or a single data structure comprised of a number of data elements, that are used to export data from the program.
♦ Tables
Tables are data structures containing one or more data elements. They can contain more than one record, and are therefore used as a means of transferring larger amounts of data. They can be used to pass data both into and out of a program.
Managing a Synchronous Dialog with SAP Message Builder library functions and statements have been created which run over the SAP RFC layer, refer to “Appendix A. Message Builder Library Reference”. These functions and statements allow: ♦ A connection with the SAP system to be opened ♦ Parameters and tables to be created ♦ Data to be placed in these parameters and tables ♦ A Function Module to be invoked, using previously created parameters and tables ♦ Data to be retrieved from parameters and tables ♦ Tidy-up routines to be used to remove parameters and tables ♦ A connection with the SAP system to be closed These functions and statements allow a synchronous dialog with SAP to be managed effectively.
XIB: SAP/R/3 Manual 5. SAP Function Modules in XIB 33
In addition there are further Message Builder library functions and statements to support data conversions between Message Builder and SAP data types. These library functions and statements are fully documented in “Appendix A. Message Builder Library Reference”. A full example of the implementation of a synchronous call to a SAP Function Module is provided in “ALE.CreateParameter”. A full definition of a Function Module, with all parameters and tables, may be accessed using the Metadata Browser. This is discussed in “Viewing Function Modules in the Metadata Browser”. The data that is passed into and out of the Function Module is subject to the rules defined in SAP. It is typically useful to test the operation of any Function Module using the testing and debugging facilities provided by SAP.
Viewing Function Modules in the Metadata Browser In the Source View pane, the level under the Function Modules item is a list of SAP Function Modules. The Function Modules that you wish to view can be selected by: ♦ Double-clicking on the Function Modules item or ♦ Highlighting the Function Modules item and selecting Source / Access Site. These actions will open a selection dialog:
Entering values in the Function Group and Function Name fields will return the metadata for the matching Function Modules. These fields allow wildcards. For example, entering “RFC_*” will return a list of all Function Modules that start with the text “RFC_”. If the “Get all metadata” checkbox is checked, then all of the metadata for the selected Function Modules will be returned immediately. If it is unchecked, then only a list of Function Modules will be returned.
XIB: SAP/R/3 Manual 5. SAP Function Modules in XIB 34
If all of the metadata is returned, then it is possible to drill down immediately through the next layers of metadata. If only the list of Function Modules is returned, then lower layers of metadata can be built up by: ♦ Double-clicking an item in the tree or ♦ Highlighting the item and selecting Source / Access Site.
The Levels of Metadata under the Function Modules Symbol These levels of metadata are available under the Function Modules item: ♦ Function Module ♦ Parameter Type (Import, Export or Table) ♦ Parameter When a single Function Module is selected for the further retrieval of metadata, all metadata levels for the Function Module will be populated.
Parameters A Parameter can have more than one level of metadata. Import and Export Parameters can either be single fields or a data structure of one or more data elements. If they are data structures then two levels of metadata will be displayed. Tables are always data structures containing one or more data elements, so two levels of metadata will always represent them.
XIB: SAP/R/3 Manual 5. SAP Function Modules in XIB 35
The figure above illustrates the display of all of these metadata items.
XIB: SAP/R/3 Manual 6. SAP Transactions in XIB 36
CHAPTER 6. SAP TRANSACTIONS IN XIB
Introduction A number of different options are available when data must be transferred into SAP. While SAP recommends that more recent integration methods, such as BAPIs, should be used, the BAPIs that are currently available do not cover all the areas of SAP functionality. You can, however, use IDocs to transfer data into these areas (not covered by BAPIs), but it is also possible that the appropriate IDoc functionality does not exist. In this case, you must use SAP Transactions. This technique is often called Batch Input or Batch Data Control (BDC).
What is a SAP Transaction? A SAP Transaction is effectively a screen dialog, or a set of screen dialogs in SAP. These are the same dialogs that you would use if you were entering data into SAP from the SAP GUI. Therefore, by using SAP Transactions, you can enter data into any part of the SAP system because all SAP screen dialogs are available as Transactions.
Input to SAP Transactions In this case, the input to the SAP Transaction is not a set of keystrokes entered into the SAP GUI, but a file, a BDCTABLE in SAP terminology, which is formatted in a specific way to emulate these keystrokes.
Transaction Codes Each SAP Transaction is represented by a Transaction Code, which is available in all screen dialogs in SAP by selecting System / Status. The Transaction Code is displayed in the field “Transaction” in the “System: Status” dialog. The details of a SAP Transaction can be accessed by retrieving the Transaction metadata in the Metadata Browser. This is described in “Viewing SAP Transactions in the Metadata Browser”.
Invoking Transactions in SAP SAP Transactions are implemented in XIB by using a synchronous call to the Function Module “RFC_CALL_TRANSACTION”. The parameters to this Function Module include the Transaction Code and the BDCTABLE. Details of the implementation of Function Modules in XIB are given in section in “Invoking Function Modules in SAP”, and a full example is provided in “ALE.CreateParameter”. For more details on SAP Transactions, Batch Input, or BDC, consult the SAP manuals.
Viewing SAP Transactions in the Metadata Browser In the Source View pane, the level under the Transactions item is a list of SAP Transactions. The Transactions that you wish to view can be selected by: ♦ Double-clicking on the Transactions item or
XIB: SAP/R/3 Manual 6. SAP Transactions in XIB 37
♦ Highlighting the Transactions item and selecting Source / Access Site. These actions will open a selection dialog:
Entering a value in the Transaction Code field will return the metadata for the matching Transactions. This field allows wildcards. For example, entering “MB*” will return a list of all Transactions that start with the text “MB”. Only a list of Transaction Codes will be returned.
All the metadata for the selected Transaction is returned immediately. It is then possible to drill down through the next layers of metadata. Lower layers of metadata can be built up by: ♦ Double-clicking an item in the tree or ♦ Highlighting the item and selecting Source / Access Site.
The Levels of Metadata under the Transactions Symbol These levels of metadata are available under the Transaction item: ♦ Program Name
XIB: SAP/R/3 Manual 6. SAP Transactions in XIB 38
♦ Screen Identifier ♦ Screen Dialog Data Elements
The figure above is an example of the display after all of these metadata items have been added.
XIB: SAP/R/3 Manual 7. Data Transfers in XIB 39
CHAPTER 7. DATA TRANSFERS IN XIB
Introduction In Integration Broker, messages are processed by integrations. A simple integration consists of a series of activities. The first activity in an integration is a receive activity. The last activity is a send activity.
SendActivityActivity Activity
ReceiveActivity ...
Figure 1. Simple integration
A receive activity: ♦ Receives messages; each message is processed as specified by the remainder of the
integration. ♦ Contains one or more receive methods. A send activity: ♦ Sends a message that has been processed by the preceding activities in the
integration. ♦ Contains one or more send methods. To receive messages from SAP, you create an ALE retrieve method and an ALE receive method. When Integration Broker executes these methods, it is the ALE retrieve method that receives messages from the given SAP server. To send messages to a SAP server, you create an ALE send method. When Integration Broker executes the method, it passes the message to the method and the method sends the message to the given SAP server.
Configuration You configure Integration Broker using the tools: ♦ Task Manager—to create ALE tasks, refer to “Chapter 8. Tasks”. Typically, you
create three ALE tasks only per Integration Broker installation; by contrast, you create many methods.
♦ ALE Manager—to create ALE methods, refer to “Chapter 10. Creating Retrieve and Receive Methods” or “Chapter 11. Creating Send Methods”.
♦ Integration Manager—to create integrations. For details of the Integration Manager, refer to the Integration Manager manual.
Once you have configured an integration correctly, you can check how it is processing messages using the Message Log , refer to “Chapter 14. Message Log” for details of ALE-specific functionality.
Execution of an ALE Retrieve Method
XIB: SAP/R/3 Manual 7. Data Transfers in XIB 40
Integration Broker executes an ALE retrieve method as part of a receive activity. When Integration Broker executes an ALE retrieve method, the method connects to the ALE server and executes the script. The script receives zero or more messages. (For a description of how a script executes, refer to “Chapter 10. Creating Retrieve and Receive Methods”.) The script either completes (without errors) or it terminates (with errors). If the script received any messages (whether the script completed or not), Integration Broker processes each message as specified by the integration of which the ALE retrieve method is part.
Execution of an ALE Send Method Integration Broker executes an ALE send method as part of a send activity. When Integration Broker executes an ALE send method, it passes a message to the method, and the method connects to the specified ALE server and executes the script. The script sends the message. (For a description of how a script executes, refer to “Chapter 11. Creating Send Methods”.) The script either completes (without errors) or it terminates (with errors).
Execution of a Receive or Send Activity To understand how the methods execute, it is necessary to first understand how receive and send activities execute. A receive method executes as part of a receive activity, which contains an ordered list of receive methods. A receive method can be contained in at most one receive activity and has an associated retrieve method. For all communication connectors except FTP and OFTP, a given retrieve method can be associated with more than one receive method. In this case, for each message received by a retrieve method, Integration Broker examines criteria defined in the associated receive methods to determine which receive method to execute (at most, one can be executed). Each associated receive method must have unique criteria. A send method executes as part of a send activity, which contains an ordered list of send methods.
Scheduling (Retrieve and Send Methods Only) Each retrieve and send method has zero or more associated schedule definitions. (Schedule definitions do not apply to receive methods.) The schedule definitions specify when the method is available for execution as follows: 1. If there are no associated schedule definitions, the method is always available for
execution. 2. Otherwise, the method is available for execution at the specified times only. For
example, two schedule definitions together can specify that the method is available for execution on Tuesday mornings each week or overnight on the first day of the month (and at no other times).
Note: A schedule definition with the same start and stop times specifies that a method is available at all times with one of these constraints: ♦ Each day (daily definition) ♦ On the given day of the week (weekly definition) ♦ On the given day of the month (monthly definition)
XIB: SAP/R/3 Manual 7. Data Transfers in XIB 41
Retries (Send Methods Only) Each send method has zero or more associated retry definitions. (Retry definitions do not apply to receive or retrieve methods.) The retry definitions specify how many times and with what delays the method can be retried. If there are no associated retry definitions, no retries are allowed. In the general case, the method has n retry definitions: (A1, D1), (A2, D2), ..., (AN, DN) (“A” stands for attempt and “D” stands for delay.) The method can be retried A1 times with delay D1, A2 times with delay D2, and so on. If all A1 + A2 + ... + AN retries are exhausted, the method will no longer be available. For example, suppose a send activity contains just one send method. If the method has one retry definition (A1 = 4, D1 = 60 seconds), it can be executed up to five times (that is, up to four retries) to send a given message. If the method terminates all five times, Integration Broker logs an error in the Message Log.
Execution of Receive Activities Integration Broker executes receive activities to receive messages continuously. It executes receive activities as follows: ♦ Integration Broker continuously executes all retrieve methods in parallel (subject to
schedule definitions)—that is, it continuously executes the retrieve methods of all integrations.
♦ This description applies to all methods except FTP and OFTP methods. For each message header received by a retrieve method, Integration Broker examines the associated receive methods and selects the receive method whose criteria most closely match the header details. (Each associated receive method must have unique criteria.) Integration Broker receives the message as defined by the receive method. If the header details do not match any of the criteria, Integration Broker receives the message, logs an error in the Message Log, and discards the message (that is, does not process it further).
♦ This description applies to FTP methods only. Integration Broker receives each message without needing to refer to the receive method. (FTP receive methods do not have criteria, and there is a one-to-one relationship between FTP retrieve methods and FTP receive methods.)
♦ This description applies to OFTP methods only. There are no OFTP retrieve methods. Integration Broker receives each message without needing to refer to a receive method. It examines the available receive methods and selects the receive method whose criteria most closely match the message details. (Each receive method must have unique criteria.) If the message details do not match the criteria of any of the receive methods, Integration Broker logs an error in the Message Log and discards the message (that is, does not process it further).
♦ Whatever the result of executing a retrieve method (whether the method completes or terminates, whether messages are received or not), Integration Broker immediately restarts the retrieve method (subject to schedule definitions).
Execution of a Send Activity Integration Broker executes a send activity to send a message. It executes a send activity as follows:
XIB: SAP/R/3 Manual 7. Data Transfers in XIB 42
1. Integration Broker searches the list of methods for the method that will be available first (subject to schedule definitions). (If two methods will be available at the same time, Integration Broker selects the first one in the list.) As soon as the method is available, Integration Broker executes it.
2. The method either completes (no errors) or terminates (with errors). If the method completes, the activity has completed too. Otherwise, Integration Broker searches the list of methods for the method that will be available first (subject to schedule and retry definitions). (If two methods will be available at the same time, Integration Broker selects the first one in the list.) As soon as the method is available, Integration Broker executes it.
3. The method either completes (no errors) or terminates (with errors). If the method completes, the activity has completed too. Otherwise, Integration Broker continues to execute methods (as described in step 2 above) until a method completes or the retries of all methods are exhausted. If the retries of all methods are exhausted, Integration Broker terminates the activity and logs an error in the Message Log (since the message was not sent).
Log Entries For each significant event that happens to a message, Integration Broker writes a log event to the Message Log. The significant events, and the information logged in each case, include:
Event Information logged Integration Broker receives a message. Message contents Integration Broker receives a message and finds that none of the criteria match at all.
Error
Integration Broker sends an acknowledgment when it receives a message.
Acknowledgment
A message is to be sent. Message contents, send attempt, and retries (if any)
XIB: SAP/R/3 Manual 8. Tasks 43
CHAPTER 8. TASKS To create ALE tasks, you must use an Integration Broker login that allows User access to the Task Manager. You create two tasks: 1. ALE transfer adapter task 2. ALE transfer classifier task Typically, you create precisely one of each of these tasks per Integration Broker installation. Until you create such tasks, you cannot run ALE integrations. Typically, you do not need to know what these tasks do.
ALE Transfer Adapter Task This section describes how to create an ALE transfer adapter task. In normal circumstances, there is nothing to configure - you name the task, enable it, select a processing engine task, and save the definition. Typically, you create one ALE transfer adapter task per Integration Broker installation. Until you create such a task, you cannot run ALE integrations. From the System Manager window, open the Task Manager. Select File / New / ALE / ALE Transfer Adapter Task. Click the General tab.
General Tab
Item Action Requirement Name
Enter a name for the task.
Mandatory
XIB: SAP/R/3 Manual 8. Tasks 44
Item Action Requirement Enable
Select to enable the task—that is, you want Integration Broker to run the task (in the case that the configuration dataset is the same as the run-time dataset and the change is committed).
Optional
Description
Enter a description for the task.
Optional
Click the Configuration tab.
Configuration Tab
Item Action Requirement Temporary directory
Enter the name of a directory where you wish temporary files to be placed. This field defaults to $CORE_TMP.
Mandatory
TID server
Enter the table server to store the TID data
Mandatory
Click the Transfer Adapter tab.
Transfer Adapter Tab
XIB: SAP/R/3 Manual 8. Tasks 45
Click the Start Up tab.
Start Up Tab
Item Action Requirement Add
Click to select a processing engine task. In normal circumstances, there is just one processing engine task per Integration Broker installation.
Mandatory
Remove
Click to remove the selected task from the list.
Optional
Advanced
Click to set advanced options. In normal circumstances, accept the default settings.
Optional
Click OK to save the definition.
ALE Transfer Classifier Task
XIB: SAP/R/3 Manual 8. Tasks 46
This section describes how to create an ALE transfer classifier task. In normal circumstances, there is nothing to configure—you name the task, enable it, and save the definition. Typically, you create one ALE transfer classifier task per Integration Broker installation. Until you create such a task, you cannot run ALE integrations. From the System Manager window, open the Task Manager. Select File / New / ALE / ALE Transfer Classifier Task.
Item Action Requirement Name
Enter a name for the task.
Mandatory
Enable
Select to enable the task—that is, you want Integration Broker to run the task (in the case that the configuration dataset is the same as the run-time dataset and the change is committed).
Optional
Description
Enter a description for the task.
Optional
Click OK to save the definition.
XIB: SAP/R/3 Manual 9. Creating ALE Objects 47
CHAPTER 9. CREATING ALE OBJECTS This chapter describes how to create ALE objects. These objects are designed to be components that can be re-used in many ALE Retrieve and Send Methods, thus reducing data entry time. To create ALE objects, you must use an Integration Broker login that allows User access to the ALE Manager.
ALE Manager From the System Manager window, open the ALE Manager.
A private send method is only available to send activities via a given application. A public send method is directly available to send activities. To create a public send method, click Public and select the folder to which you want to add the method. To create a private send method, click Private and select the application to which you want to add the method.
ALE Gateway Object From the R/3 Application Connector Manager window, select File / New / Gateway Object. Click the General tab.
General Tab
XIB: SAP/R/3 Manual 9. Creating ALE Objects 48
Item Action Requirement Name
Enter a name for the object.
Mandatory
Host
The name of the remote SAP gateway. This can take one of two formats: 1. A TCP/IP host name, or IP address, or a valid DNS name (if DNS is being used). If a TCP/IP host name is used, it must also be defined in the file /etc/hosts on UNIX systems, in the file %SystemRoot%\drivers\etc\hosts on Windows NT systems, or in the TCP/IP host table on AS/400 systems. 2. A saprouter address. This takes the format: /H/routername/S/service/…/H/hostname.
Mandatory
Service
The name or number of the TCP/IP service port used at both the local system and the remote SAP gateway. If a name is used, it must be defined in the file /etc/services on UNIX systems. In the file %SystemRoot%\drivers\etc\services on Windows NT systems, or in the TCP/IP service table on AS/400 systems.
Mandatory
Description
Enter a description for the object.
Optional
Click OK to save the definition.
ALE Logon Object
XIB: SAP/R/3 Manual 9. Creating ALE Objects 49
From the R/3 Application Connector Manager window, select File / New / Logon Object. Click the General tab.
General Tab
Item Action Requirement Name
Enter a name for the object.
Mandatory
Node
Select a Node object.
Mandatory
Description
Enter a description for the object.
Optional
Click the Preferences tab.
Preferences Tab
XIB: SAP/R/3 Manual 9. Creating ALE Objects 50
Item Action Requirement Client
The client number for the connection to the remote SAP system.
Mandatory
User
Enter the SAP user login name. Note that the use of a SAP CPIC user will give improved security and ease of use, as this user type cannot login to SAP interactively, and the password will never expire.
Mandatory
Password
Enter the password for the SAP user. This parameter is not echoed back to the user, and it is encrypted in the XIB system.
Mandatory
Language
Enter the Language code to use when establishing an ALE link. This field defaults to “E” (English).
Optional
Trace
Check to enable an RFC trace for the ALE dialog. This trace will appear in the file dev_rfc in the current working directory of the process. On Windows NT, the file is called rfcnnnnn_nnnn.trc.
Optional
Connection Test
Click to check that a successful connection to the SAP system defined by this Logon object and the parent Node object can be made.
Optional
Performance Test
Click to display performance data for a successful connection to the SAP system defined by this Logon object and the parent Node object.
Optional
System Info.
Click to display system information about the SAP system defined by this Logon object and the parent Node object, if a successful connection is made.
Optional
XIB: SAP/R/3 Manual 9. Creating ALE Objects 51
If you click Connection Test, and a successful connection is made to the remote SAP system, then the following window will be displayed:
If you click Performance Test, and a successful connection is made to the remote SAP system, then the following window will be displayed:
Item Description Open connection
The time taken to open the connection to the SAP system, in seconds.
Fill tables
The time taken to load data into the tables to be sent to the remote SAP system, in seconds.
Call STFC_PERFORMANCE
The time taken to run the SAP Function module STFC_PERFORMANCE on the remote SAP system, in seconds.
Check table info sent
The time taken to check that the data received from the remote SAP system is the same as that sent, in seconds.
If you click SystemInfo., and a successful connection is made to the remote SAP system, then the following window will be displayed:
XIB: SAP/R/3 Manual 9. Creating ALE Objects 52
This window displays system information about the remote SAP system. Click OK to save the definition.
ALE Node Object From the R/3 Application Connector Manager window, select File / New / Node Object. Click the General tab.
General Tab
XIB: SAP/R/3 Manual 9. Creating ALE Objects 53
Item Action Requirement Name
Enter a name for the object.
Mandatory
Destination
The name of the remote SAP system. This is the equivalent of an RFC destination in SAP, and is typically set to the system name of the SAP system. Note that nodes should always have a unique destination because this destination is used as a reference tag in the saprfc.ini configuration file.
Mandatory
Host
The name of the remote SAP host. This can take one of two formats: 1. A TCP/IP host name, or a valid DNS name (if DNS is being used), or an IP address. If a TCP/IP host name is used, it must also be defined in the file /etc/hosts on UNIX systems, in the file %SystemRoot%\drivers\etc\hosts on Windows NT systems, or in the TCP/IP host table on AS/400 systems. 2. A saprouter address. This takes the format: /H/routername/S/service/…/H/hostname.
Mandatory
System
The system number defined at the SAP host. This number can be any integer string between “00” and “99”. This field defaults to “00”.
Mandatory
Gateway
Select a Gateway object.
Optional
XIB: SAP/R/3 Manual 9. Creating ALE Objects 54
Item Action Requirement Description
Enter a description for the object.
Optional
Click OK to save the definition.
XIB: SAP/R/3 Manual 10. Create Retrieve/Receive Methods 55
CHAPTER 10. CREATING RETRIEVE AND RECEIVE METHODS
This chapter describes how to create ALE retrieve and receive methods. For each retrieve method that you create, create precisely one receive method. To create ALE methods, you must use an Integration Broker login that allows User access to the ALE Manager.
ALE Manager From the System Manager window, double-click the ALE Manager icon.
A private receive method is only available to receive activities via a given application. A public receive method is directly available to receive activities. To create a public receive method (and associated retrieve method), click Public and select the folder to which you want to add the methods. To create a private receive method (and associated retrieve method), click Private and select the application to which you want to add the methods.
ALE Retrieve Method From the R/3 Application Connector Manager window, select File / New / Retrieve Method. Click the General tab.
General Tab
XIB: SAP/R/3 Manual 10. Create Retrieve/Receive Methods 56
Item Action Requirement Name
Enter a name for the method.
Mandatory
ALE transfer adapter task
Select an ALE transfer adapter task. Typically, there is just one such task.
Optional
Description
Enter a description for the method.
Optional
Click the Schedule tab.
Schedule Tab
Item Action Requirement New
Click to create a schedule definition.
Optional
Open
Click to edit the selected schedule definition.
Optional
Delete
Click to delete the selected schedule definition.
Optional
XIB: SAP/R/3 Manual 10. Create Retrieve/Receive Methods 57
Item Action Requirement Poll frequency
Enter the poll frequency. This is the minimum time in seconds between one execution ending and the next one starting. For example, if the value is 3, the method cannot be restarted until at least 3 seconds after the previous execution has ended (completed or terminated).
Optional
Note: A retrieve method executes as part of a receive activity. The schedule definitions specify when the method is available for execution. For a full description of how a receive activity executes, refer to “Execution of a Receive or Send Activity” on page 40. Click the ALE tab.
ALE - Reference Tab
Item Action Requirement Node
Select a Node object.
Mandatory
Gateway
Select a Gateway object.
Mandatory
Click the Preferences tab.
ALE - Preferences Tab
XIB: SAP/R/3 Manual 10. Create Retrieve/Receive Methods 58
Item Action Requirement Program Id
Enter the SAP program ID to load at the remote host. This must match a Program Id registered against an RFC Destination in SAP.
Mandatory
Update Status
Check to automatically generate an IDoc status record for the transmission received from SAP and send it to SAP.
Optional
Status value
Select the status to be used in the status record to update SAP. It is possible to select any status value allowed by SAP from a list of values.
Optional
Transactional
Check to use transactional control for data transfers.
Optional
Trace
Check to enable an RFC trace for the ALE dialog. In UNIX, this trace will appear in the file dev_rfc in the current working directory of the process. On Windows NT, the file is called rfcnnnnn_nnnn.trc.
Optional
Click OK to save the definition.
ALE Receive Method From the R/3 Application Connector Manager window, select File / New / Receive Method. Click the General tab.
General Tab
XIB: SAP/R/3 Manual 10. Create Retrieve/Receive Methods 59
Item Action Requirement Name
Enter a name for the method.
Mandatory
Description
Enter a description for the method.
Optional
Click the ALE tab.
ALE Tab
Item Action Requirement Browse
Click to select the retrieve method.
Mandatory
Note: ALE receive methods do not have criteria. Click OK to save the definition.
XIB: SAP/R/3 Manual 11. Creating Send Methods 60
CHAPTER 11. CREATING SEND METHODS This chapter describes how to create ALE send methods. If methods already exist for communicating with the SAP system that you want to communicate with, you may be able to reuse one of these methods, instead of creating a method. To create ALE methods, you must use an Integration Broker login that allows User access to the ALE Manager.
ALE Manager From the System Manager window, double-click the ALE Manager icon.
A private send method is only available to send activities via a given application. A public send method is directly available to send activities. To create a public send method, click Public and select the folder to which you want to add the method. To create a private send method, click Private and select the application to which you want to add the method.
ALE Send Method From the R/3 Application Connector Manager window, select File / New / Send Method. Click the General tab.
General Tab
XIB: SAP/R/3 Manual 11. Creating Send Methods 61
Item Action Requirement Name
Enter a name for the method.
Mandatory
Transfer timeout
Enter the transfer timeout in seconds. This is the maximum time that the method has to finish (complete or terminate). If the method exceeds the allowed time, Integration Broker terminates it.
Optional
ALE transfer adapter task
Select an ALE transfer adapter task. Typically, there is just one such task.
Optional
Description
Enter a description for the method.
Optional
Click the Retry tab.
Retry Tab
Item Action Requirement
XIB: SAP/R/3 Manual 11. Creating Send Methods 62
Item Action Requirement New
Click to create a retry definition.
Optional
Open
Click to edit the selected retry definition.
Optional
Delete
Click to delete the selected retry definition.
Optional
Move Up
Click to move the selected retry definition up one place.
Optional
Move Down
Click to move the selected retry definition down one place.
Optional
Notes: ♦ If there are no retry definitions, no retries are allowed. ♦ A send method executes as part of a send activity. The retry definitions specify how
many times and at what intervals the method can be retried. The order of the retry definitions is significant. For a full description of how a send activity executes, refer to “Execution of a Receive or Send Activity”.
Click the Schedule tab.
Schedule Tab
Item Action Requirement New
Click to create a schedule definition.
Optional
Open
Click to edit the selected schedule definition.
Optional
Delete
Click to delete the selected schedule definition.
Optional
Notes: ♦ If there are no schedule definitions, the method is always available for execution. ♦ A send method executes as part of a send activity. The schedule definitions specify
XIB: SAP/R/3 Manual 11. Creating Send Methods 63
when the method is available for execution. The order of the schedule definitions is not significant. For a full description of how a send activity executes, refer to “Execution of a Receive or Send Activity”.
Click the ALE tab.
ALE Tab
Item Action Requirement Logon
Select a Logon object.
Optional
Version
Select the IDoc version that is used transferring data. The valid values are Version 2 and Version 3 IDoc formats.
Optional
Click OK to save the definition.
XIB: SAP/R/3 Manual 12. IDoc Data Classification 64
CHAPTER 12. IDOC DATA CLASSIFICATION
Introduction IDocs that are transferred from SAP to XIB can be analyzed using the IDoc Classifier. The Classifier will parse information like Sender, Receiver and Message Type from the IDoc, and it can be used to route the document to further data processing or communication stages. The IDoc Classifier is a Data Classifier, like the EDIFACT Classifier, rather than a Transfer Adapter Classifier. This removes any dependency on the ALE Transfer Adapter, and allows an IDoc file to be classified at any stage in an XIB integration. For example, a typical integration could include an IDoc file, which is retrieved by ALE from another system, classified by the IDoc Classifier, and then sent to the appropriate ALE Send Method. In this way IDocs may be sent to more than one SAP system. The IDoc Classifier is implemented in the Integration Manager, using a Classification Activity. For more details of how to configure Integrations, please refer to the Integration Manager manual.
Integration Manager Integrations are created using the Integration Manager. For details of how to create Integrations refer to the Integration Manager manual. In this case, the IDoc Classifier will be implemented as part of a Classification Activity. From the System Manager window, double-click the Integration Manager icon.
Select an Integration name, or create a new Integration. To create a new Classification Activity, select File / New / Activity / Classification Activity.
XIB: SAP/R/3 Manual 12. IDoc Data Classification 65
Classification Activity Click the General tab.
General Tab
Item Action Requirement Name
Enter a name for the activity.
Mandatory
Description Enter a description for the activity.
Optional
Next Activity
Select an Activity to follow this stage.
Optional
Click the Configuration tab.
XIB: SAP/R/3 Manual 12. IDoc Data Classification 66
Item Action Requirement Classification Anchor
Select the Classification Anchor with which to associate the Classification Activity.
Mandatory
Classifier MBC
Select the “IDoc data classifier activity” in the ALE folder.
Mandatory
When an initial selection of the IDoc Classifier is made, a configuration window will open. This has two tabs, “IDoc, EDI” and “Sender, Receiver”, and enables you to enter selection criteria for this Classifier instance. Click the IDoc, EDI tab.
XIB: SAP/R/3 Manual 12. IDoc Data Classification 67
Item Action Requirement IDoc version (DOCREL)
Select and enter the data to match against in the corresponding data field, if you want the Classifier to select IDocs for a particular IDoc version. This selection corresponds to the DOCREL field in the IDoc data format.
Optional
IDoc type extended (CIMTYP)
Select and enter the data to match against in the corresponding data field, if you want the Classifier to select IDocs for a particular extended IDoc type. This selection corresponds to the CIMTYP field in the IDoc data format.
Optional
IDoc type (IDOCTYP)
Select and enter the data to match against in the corresponding data field, if you want the Classifier to select IDocs for a particular IDoc type. This selection corresponds to the IDOCTYP field in the IDoc data format.
Optional
EDI version (EDIVRS)
Select and enter the data to match against in the corresponding data field, if you want the Classifier to select IDocs for a particular EDI version. This selection corresponds to the EDIVRS field in the IDoc data format.
Optional
XIB: SAP/R/3 Manual 12. IDoc Data Classification 68
Item Action Requirement EDI standard (STD)
Select and enter the data to match against in the corresponding data field, if you want the Classifier to select IDocs for a particular EDI standard. This selection corresponds to the STD field in the IDoc data format.
Optional
EDI message type (EDIMES)
Select and enter the data to match against in the corresponding data field, if you want the Classifier to select IDocs for a particular EDI message type. This selection corresponds to the EDIMES field in the IDoc data format.
Optional
Client (MANDT)
Select and enter the data to match against in the corresponding data field, if you want the Classifier to select IDocs for a particular Client. This selection corresponds to the MANDT field in the IDoc data format.
Optional
Test flag (TEST)
Select if you want the Classifier to select IDocs for a particular Test flag setting. Check the box to select IDocs with the Test flag set. Leave it unchecked to select IDocs with the Test flag unset. This selection corresponds to the TEST field in the IDoc data format.
Optional
Click the Sender, Receiver tab.
XIB: SAP/R/3 Manual 12. IDoc Data Classification 69
Item Action Requirement Sender (SNDPRN)
Select and enter the data to match against in the corresponding data field, if you want the Classifier to select IDocs for a particular Sender. This selection corresponds to the SNDPRN field in the IDoc data format.
Optional
Sender partner port (SNDPOR)
Select and enter the data to match against in the corresponding data field, if you want the Classifier to select IDocs for a particular Sender partner port. This selection corresponds to the SNDPOR field in the IDoc data format.
Optional
Sender partner type (SNDPRT)
Select and enter the data to match against in the corresponding data field, if you want the Classifier to select IDocs for a particular Sender partner type. This selection corresponds to the SNDPRT field in the IDoc data format.
Optional
Receiver (RCVPRN)
Select and enter the data to match against in the corresponding data field, if you want the Classifier to select IDocs for a particular Receiver. This selection corresponds to the RCVPRN field in the IDoc data format.
Optional
Receiver partner port (RCVPOR)
Select and enter the data to match against in the corresponding data field, if you want the Classifier to select IDocs for a particular Receiver partner port. This selection corresponds to the RCVPOR field in the IDoc data format.
Optional
Receiver partner type (RCVPRT)
Select and enter the data to match against in the corresponding data field, if you want the Classifier to select IDocs for a particular Receiver partner type. This selection corresponds to the RCVPRT field in the IDoc data format.
Optional
Click OK to save the definition. The IDoc Classifier configuration can be changed at a later date by pressing the Configure button for the Classifier MBC in the Classifier Activity.
XIB: SAP/R/3 Manual 13. Implement IDoc Status Updates 70
CHAPTER 13. IMPLEMENTING IDOC STATUS UPDATES
Introduction When an IDoc is sent to a remote system by SAP, the status of the IDoc is automatically updated in the SAP system by the ALE subsystem. The status of an IDoc may be viewed in SAP using a transaction such as we05. For transfers out of SAP, the final status of an IDoc is typically “03”(“Passed to port OK”), which indicates that the IDoc has been passed to the ALE subsystem correctly, and transfer to the remote system will proceed according to the rules configured for ALE in the SAP system. It is a frequent requirement, however, to send information back to the sending SAP, to show progress of the IDoc through one or more processing or workflow stages at the remote system. In this way, progress of the IDoc can be monitored in the local SAP system. This can be achieved by sending IDoc status records back to the SAP system from which the IDoc was sent. This can be implemented in the R/3 Connector in one of two ways: ♦ In the ALE Retrieve Method ♦ Using a combination of a custom MBC and an ALE Update Status Method, which
can be placed in any Integration in XIB The implementation of IDoc status updates in an ALE Retrieve method is described in “ALE - Preferences Tab” on page 57. The implementation of IDoc status updates using a custom MBC is described in the following sections.
IDoc status updates using a custom MBC
Implementing the custom MBC IDoc status updates may be implemented in XIB using a custom MBC. This custom MBC is implemented in the Hierarchical Messaging Environment of XIB. For more details of the Hierarchical Messaging Environment, refer to the Hierarchical Message Processing manual. A sample implementation of an IDoc status update custom MBC is provided with the R/3 Connector, in the file sample_idocstatus.s4, which may be found in the directory $CORE_ROOT/sample/stage. This example is a creator MBC, which creates a new message that can be forwarded to an ALE Status Update method. The example program can be modified and re-compiled for use. The essential components of processing within the MBC can be found in the ProcessMessage function, and are as follows: ♦ Retrieve the configuration for the stage. ♦ Create a new message, using the function MBC_HIERCHMSGENV.CreateMessage. ♦ Create a null data string, using the function DATAIO.CreateString. ♦ Attach the data string to the message, using the function
MBC_HIERCHMSGENV.AttachData.
XIB: SAP/R/3 Manual 13. Implement IDoc Status Updates 71
♦ Set the next activity to that from the stage configuration, using the function MBC_HIERCHMSGENV.SetActivityBranch.
♦ Get the application acknowledgement attribute from the current message, using the function MBC_HIERCHMSGENV.GetAttribute. This attribute is automatically set for all IDocs received in the ALE Transfer Adapter.
♦ Set the application acknowledgement attribute for the new message to the retrieved value, using the function MBC_HIERCHMSGENV.SetAttribute.
♦ Set the Logger ID for the new message to the same as the current message, using the functions MBC_HIERCHMSGENV.GetLoggerId and MBC_HIERCHMSGENV.SetLoggerId.
♦ Log the event, using the function MBC_HIERCHMSGENV.CreateLoggerEvent. ♦ Signal that processing is complete, with the function
MBC_HIERCHMSGENV.ProcessMessageDone.
Configuring the custom MBC To configure the custom MBC, the following steps are required: ♦ Register the component ♦ Create an Integration, using the MBC in a Sequential Activity A component is registered in the Component Registry. Refer to the System and Administration Manager manual for more information.
Integration Manager Integrations are created using the Integration Manager. For details of how to create Integrations, refer to the Integration Manager manual. In this case, the custom MBC will be implemented as part of a Sequential Activity. From the System Manager window, double-click the Integration Manager icon.
Select an Integration name, or create a new Integration.
XIB: SAP/R/3 Manual 13. Implement IDoc Status Updates 72
To create a new Sequential Activity, select File / New / Activity / Sequential Activity.
Sequential Activity Click the General tab.
General Tab
Item Action Requirement Name
Enter a name for the activity.
Mandatory
Description
Enter a description for the activity.
Optional
Hierarchical Messaging Task
Select a Hierarchical messaging task. Typically, there is just one such task.
Optional
Click the Stages tab.
Stages Tab
XIB: SAP/R/3 Manual 13. Implement IDoc Status Updates 73
Item Action Requirement New
Click to add a new stage.
Optional
Open
Click to edit the selected stage.
Optional
Delete
Click to delete the selected stage.
Optional
Move Up
Click to move the selected stage up one place.
Optional
Move Down
Click to move the selected stage down one place.
Optional
When adding or opening a stage, the Stage dialog will open.
Stage Dialog Click the General tab.
General tab
XIB: SAP/R/3 Manual 13. Implement IDoc Status Updates 74
Item Action Requirement Name
Enter a name for the stage.
Mandatory
Description
Enter a description for the stage.
Optional
Click the Configuration tab.
Configuration tab
Item Action Requirement Next Activity
Select an Activity to follow this stage. Typically, be an ALE Status Update method.
Optional
Creating ALE Status Update methods This section describes how to create ALE status update methods. If methods already exist for communicating with the SAP system that you want to communicate with, you may be able to reuse one of these methods, instead of creating a method.
XIB: SAP/R/3 Manual 13. Implement IDoc Status Updates 75
To create ALE methods, you must use an Integration Broker login that allows User access to the ALE Manager.
ALE Manager From the System Manager window, double-click the ALE Manager icon.
A private status update method is only available to send activities via a given application. A public status update method is directly available to send activities. To create a public status update method, click Public and select the folder to which you want to add the method. To create a private status update method, click Private and select the application to which you want to add the method.
ALE Status Update Method
From the R/3 Application Connector Manager window, select File / New / Status Update. Click the General tab.
General Tab
XIB: SAP/R/3 Manual 13. Implement IDoc Status Updates 76
Item Action Requirement Name
Enter a name for the method.
Mandatory
Transfer timeout
Enter the transfer timeout in seconds. This is the maximum time that the method has to finish (complete or terminate). If the method exceeds the allowed time, Integration Broker terminates it.
Optional
ALE transfer adapter task
Select an ALE transfer adapter task. Typically, there is just one such task.
Optional
Description
Enter a description for the method.
Optional
Click the Retry tab.
Retry Tab
XIB: SAP/R/3 Manual 13. Implement IDoc Status Updates 77
Item Action Requirement New
Click to create a retry definition.
Optional
Open
Click to edit the selected retry definition.
Optional
Delete
Click to delete the selected retry definition.
Optional
Move Up
Click to move the selected retry definition up one place.
Optional
Move Down
Click to move the selected retry definition down one place.
Optional
Notes: ♦ If there are no retry definitions, no retries are allowed. ♦ A send method executes as part of a send activity. The retry definitions specify how
many times and at what intervals the method can be retried. The order of the retry definitions is significant. For a full description of how a send activity executes, refer to “Execution of a Receive or Send Activity” on page 40.
Click the Schedule tab.
Schedule Tab
XIB: SAP/R/3 Manual 13. Implement IDoc Status Updates 78
Item Action Requirement New
Click to create a schedule definition.
Optional
Open
Click to edit the selected schedule definition.
Optional
Delete
Click to delete the selected schedule definition.
Optional
Notes: ♦ If there are no schedule definitions, the method is always available for execution. ♦ A status update method executes as part of a send activity. The schedule definitions specify when the method is available for execution. The order of the schedule definitions is not significant. For a full description of how a send activity executes, refer to “Execution of a Receive or Send Activity” on page 40. Click the ALE tab.
ALE Tab
XIB: SAP/R/3 Manual 13. Implement IDoc Status Updates 79
Item Action Requirement Logon
Select a Logon object.
Optional
Status value
Select the status value with which to update the IDoc. You may select any valid IDoc status.
Optional
Click OK to save the definition.
XIB: SAP/R/3 Manual 14. Message Log 80
CHAPTER 14. MESSAGE LOG This chapter describes Message Log functionality that is specific to the R/3 Application Connector.
Search Receive Events Use the Search ALE receive events dialog box to display log entries that record the receiving of messages via ALE. Integration Broker searches events of type ALE Receive. In the Message Log, select File / New, and then select ALE Receive Transfers. If required, change the settings on the General tab. For details of this information, refer to “Chapter 8: Message Log” in the System and Administration Manager manual. Click the ALE tab.
Item Action Requirement Destination
If you want Integration Broker to display only log entries that record the receiving of a message with a given Destination via ALE, select and enter the Destination.
Optional
Creation Date
If you want Integration Broker to display only log entries that record the receiving of a message with a given Creation Date via ALE, select and enter the Creation Date.
Optional
XIB: SAP/R/3 Manual 14. Message Log 81
Item Action Requirement Creation Time
If you want Integration Broker to display only log entries that record the receiving of a message with a given Creation Time via ALE, select and enter the Creation Time.
Optional
Document Number
If you want Integration Broker to display only log entries that record the receiving of a message with a given Document Number via ALE, select and enter the Document Number.
Optional
Transaction Id
If you want Integration Broker to display only log entries that record the receiving of a message with a given Transaction Id via ALE, select and enter the Transaction Id.
Optional
Save
Click to save the search as a favorite search.
Optional
Save As
Click to save the search as a favorite search, with a new text name.
Optional
Count
Click to display the number of log entries that match the search criteria (on all tabs).
Optional
Apply
Click to display the log entries that match the search criteria (on all tabs).
Optional
Recursive
Click to create a recursive search.
Optional
Reset
Click to reset all selection values (on all tabs).
Optional
Search Send Events Use the Search ALE send events dialog box to display log entries that record the sending of messages via ALE. Integration Broker searches events of type ALE Send. In the Message Log, select File / New, and then select ALE Send Transfers. If required, change the settings on the General tab. For details of this information, refer to “Chapter 8: Message Log” in the System and Administration Manager manual. Click the ALE tab.
XIB: SAP/R/3 Manual 14. Message Log 82
Item Action Requirement Transaction Id
If you want Integration Broker to display only log entries that record the receiving of a message with a given Transaction Id via ALE, select and enter the Transaction Id.
Optional
Destination
If you want Integration Broker to display only log entries that record the receiving of a message with a given Destination via ALE, select and enter the Destination.
Optional
Save
Click to save the search as a favorite search.
Optional
Save As
Click to save the search as a favorite search, with a new text name.
Optional
Count
Click to display the number of log entries that match the search criteria (on all tabs).
Optional
Apply
Click to display the log entries that match the search criteria (on all tabs).
Optional
Recursive
Click to create a recursive search.
Optional
Reset
Click to reset all selection values (on all tabs).
Optional
Search Status Update Events Use the Search ALE update events dialog box to display log entries that record the sending of messages via ALE. Integration Broker searches events of type ALE Status Update.
XIB: SAP/R/3 Manual 14. Message Log 83
In the Message Log, select File / New, and then select ALE Status Updates. If required, change the settings on the General tab. For details of this information, refer to “Chapter 8: Message Log” in the System and Administration Manager manual. Click the ALE tab.
Item Action Requirement Document Number
If you want Integration Broker to display only log entries that record the receiving of a status update with a given Document Number via ALE, select and enter the Document Number.
Optional
Status Value
If you want Integration Broker to display only log entries that record the sending of a status update via ALE with a given Status Value, select and enter the Status Value.
Optional
Destination
If you want Integration Broker to display only log entries that record the receiving of a status update with a given Destination via ALE, select and enter the Destination.
Optional
Save
Click this button to save the search as a favorite search.
Optional
Save As
Click to save the search as a favorite search, with a new text name.
Optional
Count
Click to display the number of log entries that match the search criteria (on all tabs).
Optional
XIB: SAP/R/3 Manual 14. Message Log 84
Item Action Requirement Apply
Click to display the log entries that match the search criteria (on all tabs).
Optional
Recursive
Click to create a recursive search.
Optional
Reset
Click to reset all selection values (on all tabs).
Optional
Search IDoc Data Classifier Events Use the Search IDoc data classifier events dialog box to display log entries that record the sending of messages via ALE. Integration Broker searches events of type ALE Send. In the Message Log, select File / New, and then select IDoc Data. If required, change the settings on the General tab. For details of this information, refer to “Chapter 8: Message Log” in the System and Administration Manager manual. Click the IDoc Classifier tab.
Item Action Requirement IDoc Number (DOCNUM)
If you want Integration Broker to display only log entries that record the classification of an IDoc with a given IDoc Number, select and enter the IDoc Number.
Optional
IDoc Type (IDOCTYP)
If you want Integration Broker to display only log entries that record the classification of an IDoc with a given IDoc Type, select and enter the IDoc Type.
Optional
XIB: SAP/R/3 Manual 14. Message Log 85
Item Action Requirement Sender (SNDPRN)
If you want Integration Broker to display only log entries that record the classification of an IDoc with a given Sender, select and enter the Sender.
Optional
Receiver (RCVPRN)
If you want Integration Broker to display only log entries that record the classification of an IDoc with a given Receiver, select and enter the Receiver.
Optional
Save Click to save the search as a favorite search. Optional Save As Click to save the search as a favorite search, with a
new text name. Optional
Count Click to display the number of log entries that match the search criteria (on all tabs).
Optional
Apply Click to display the log entries that match the search criteria (on all tabs).
Optional
Recursive Click to create a recursive search. Optional Reset Click to reset all selection values (on all tabs). Optional
Display Receive Event The ALE Received dialog box displays details of an event that records the receiving of a message via ALE (or a failed attempt to receive a message via ALE). This event is of type ALEReceiveReport. Click the Properties tab.
The information displayed on this tab is common to all log events. For details of this information, refer to “Chapter 8: Message Log” in the System and Administration Manager manual.
XIB: SAP/R/3 Manual 14. Message Log 86
Click the Transfer message tab.
Item Description Requirement Transfer ID
The transfer ID for the message. The ID uniquely identifies a message.
Read-only
Attributes
Select the message attribute that you want to view. If the message has no attributes, the list is empty.
Optional
View
Click to view the selected attribute.
Optional
Size
The size of the message in bytes.
Read-only
View content as
Select the data type.
Optional
View
Click to display the data using the selected data type.
Optional
Click the Parameters tab. This tab displays the configuration data for the data transfer.
XIB: SAP/R/3 Manual 14. Message Log 87
Item Description Requirement Destination
The name of the remote SAP system from which the message was received. This is the equivalent of an RFC destination in SAP, and is typically set to the system name of the SAP system.
Read-only
Gateway Host
The name of the remote SAP gateway from which the message was received. This can take one of two formats: 1. A TCP/IP host name, or IP address, or a valid DNS name (if DNS is being used). 2. A saprouter address. This takes the format: /H/routername/S/service/…/H/hostname.
Read-only
Gateway Service
The name or number of the TCP/IP service port at the remote SAP gateway from which the message was received.
Read-only
Program Id
The SAP program ID at the remote SAP gateway from which the message was received.
Read-only
Update Status
A flag that denotes whether to automatically generate an IDoc status record for the transmission received from SAP.
Read-only
Status Value
The status value to be used in the status record to update SAP.
Read-only
XIB: SAP/R/3 Manual 14. Message Log 88
Item Description Requirement Transactional
A flag, which denotes whether to use transactional control for data transfers.
Read-only
Trace
A flag, which denotes whether RFC trace is enabled for the ALE dialog.
Read-only
Click the Transfer data tab. This tab displays transfer information about the data transfer.
Item Description Requirement Transaction Id
The SAP Transaction Id for the data transfer.
Read-only
Receive Date
The date that the data transfer was received.
Read-only
Receive Time
The time that the data transfer was received.
Read-only
File Size
The size, in bytes, of the data transfer.
Read-only
Click the IDoc Data tab. This tab displays details of the content of the data transfer.
XIB: SAP/R/3 Manual 14. Message Log 89
Item Description Requirement Client
The client number. This corresponds to the MANDT field in the IDoc control record.
Read-only
Document Number
The IDoc number. This corresponds to the DOCNUM field in the IDoc control record.
Read-only
IDoc Version
The SAP release of IDoc. This corresponds to the DOCREL field in the IDoc control record.
Read-only
Test
The test flag. This corresponds to the TEST field in the IDoc control record.
Read-only
IDoc Type
The name of the basic IDoc type. This corresponds to the IDOCTYP field in the IDoc control record.
Read-only
Extended IDoc Type
The name of the extended IDoc type. This corresponds to the CIMTYP field in the IDoc control record.
Read-only
Message Type
The logical message type. This corresponds to the MESTYP field in the IDoc control record.
Read-only
EDI Standard
The EDI standard. This corresponds to the STD field in the IDoc control record.
Read-only
EDI Version
The version of the EDI standard. This corresponds to the STDVRS field in the IDoc control record.
Read-only
XIB: SAP/R/3 Manual 14. Message Log 90
Item Description Requirement EDI Message Type
The EDI message type. This corresponds to the STDMES field in the IDoc control record.
Read-only
Sender Port
The sender port. This corresponds to the SNDPOR field in the IDoc control record.
Read-only
Sender Partner Type
The partner type of the sender. This corresponds to the SNDPRT field in the IDoc control record.
Read-only
Sender
The partner number of the sender. This corresponds to the SNDPRN field in the IDoc control record.
Read-only
Receiver Port
The receiver port. This corresponds to the RCVPOR field in the IDoc control record.
Read-only
Receiver Partner Type
The partner type of the receiver. This corresponds to the RCVPRT field in the IDoc control record.
Read-only
Receiver
The partner number of the receiver. This corresponds to the RCVPRN field in the IDoc control record.
Read-only
Creation Date
The date that the IDoc was created. This corresponds to the CREDAT field in the IDoc control record.
Read-only
Creation Time
The time that the IDoc was created. This corresponds to the CRETIM field in the IDoc control record.
Read-only
Display Send Event The ALE Transfer Completed dialog box displays details of an event that records the sending of a message via ALE (or a failed attempt to send a message via ALE). This event is of type ALESendReport. Click the Properties tab.
XIB: SAP/R/3 Manual 14. Message Log 91
The information displayed on this tab is common to all log events. For details of this information, refer to “Chapter 8: Message Log” in the System and Administration Manager manual. Click the Transfer report tab.
Item Description Requirement Transfer ID
The transfer ID for the message. The ID uniquely identifies a message.
Read-only
Attributes
Select the message attribute that you want to view. If the message has no attributes, the list is empty.
Optional
XIB: SAP/R/3 Manual 14. Message Log 92
Item Description Requirement View
Click to view the selected attribute.
Optional
Click the ALE Send tab. This tab displays the transfer information and configuration data for the data transfer.
Item Description Requirement Transaction Id
The SAP Transaction Id for the data transfer.
Read-only
Destination
The name of the remote SAP system to which the message is sent. This is the equivalent of an RFC destination in SAP, and is typically set to the system name of the SAP system.
Read-only
Mode
The version of the IDoc transferred. The value “3” denotes a Version 2 IDoc format, the value “4” denotes a Version 3 IDoc format.
Read-only
Host
The name of the remote SAP host. This can take one of two formats: 1. A TCP/IP host name, or a valid DNS name (if DNS is being used), or an IP address. 2. A saprouter address. This takes the format: /H/routername/S/service/…/H/hostname.
Read-only
System
The system number defined at the SAP host. This number can be any integer string between “00” and “99”.
Read-only
XIB: SAP/R/3 Manual 14. Message Log 93
Item Description Requirement Gateway Host
The name of the remote SAP gateway. This can take one of two formats: 1. A TCP/IP host name, or IP address, or a valid DNS name (if DNS is being used). 2. A saprouter address. This takes the format: /H/routername/S/service/…/H/hostname.
Read-only
Gateway Service
The name or number of the TCP/IP service port used at the remote SAP gateway.
Read-only
Client
The client number for the connection to the remote SAP system.
Read-only
User
The SAP user login name.
Read-only
Encrypted Password
The (encrypted) password for the SAP user.
Read-only
Language
The Language code used when establishing an ALE link.
Read-only
Trace
A flag that denotes whether RFC trace is enabled for the ALE dialog.
Read-only
Display Status Update Event The ALE Status update completed successfully dialog box displays details of an event that records the updating of an IDoc status via ALE (or a failed attempt to update an IDoc status via ALE). This event is of type ALEStatusReport. Click the Properties tab.
XIB: SAP/R/3 Manual 14. Message Log 94
The information displayed on this tab is common to all log events. For details of this information, refer to “Chapter 8: Message Log” in the System and Administration Manager manual. Click the Transfer report tab.
Item Description Requirement Transfer ID
The transfer ID for the message. The ID uniquely identifies a message.
Read-only
Attributes
Select the message attribute that you want to view. If the message has no attributes, the list is empty.
Optional
View
Click to view the selected attribute.
Optional
Click the ALE Status tab. This tab displays the transfer information and configuration data for the data transfer.
XIB: SAP/R/3 Manual 14. Message Log 95
Item Description Requirement Document Number
The IDoc number for which the status is to be updated in SAP.
Read-only
Status Value
The value of the status update for the IDoc.
Read-only
Destination
The name of the remote SAP system to which the status update is sent. This is the equivalent of an RFC destination in SAP, and is typically set to the system name of the SAP system.
Read-only
Host
The name of the remote SAP host. This can take one of two formats: 1. A TCP/IP host name, or a valid DNS name (if DNS is being used), or an IP address. 2. A saprouter address. This takes the format: /H/routername/S/service/…/H/hostname.
Read-only
System
The system number defined at the SAP host. This number can be any integer string between “00” and “99”.
Read-only
Gateway Host
The name of the remote SAP gateway. This can take one of two formats: 1. A TCP/IP host name, or IP address, or a valid DNS name (if DNS is being used). 2. A saprouter address. This takes the format: /H/routername/S/service/…/H/hostname.
Read-only
Gateway Service
The name or number of the TCP/IP service port used at the remote SAP gateway.
Read-only
Client
The client number for the connection to the remote SAP system.
Read-only
XIB: SAP/R/3 Manual 14. Message Log 96
Item Description Requirement User
The SAP user login name.
Read-only
Encrypted Password
The (encrypted) password for the SAP user.
Read-only
Language
The Language code used when establishing an ALE link.
Read-only
Trace
A flag that denotes whether RFC trace is enabled for the ALE dialog.
Read-only
Display IDoc Data Classifier Event The ALE transfer completed dialog box displays details of an event that records the sending of a message via ALE (or a failed attempt to send a message via ALE). This event is of type IDoc_Classifier. Click the Properties tab.
The information displayed on this tab is common to all log events. For details of this information, refer to “Chapter 8: Message Log” in the System and Administration Manager manual. Click the Data tab.
XIB: SAP/R/3 Manual 14. Message Log 97
Item Description Requirement Client
The client number. This corresponds to the MANDT field in the IDoc control record.
Read-only
IDoc Number
The IDoc number. This corresponds to the DOCNUM field in the IDoc control record.
Read-only
IDoc Version
The SAP release of IDoc. This corresponds to the DOCREL field in the IDoc control record.
Read-only
Test
The test flag. This corresponds to the TEST field in the IDoc control record.
Read-only
IDoc Type
The name of the basic IDoc type. This corresponds to the IDOCTYP field in the IDoc control record.
Read-only
Extended IDoc Type
The name of the extended IDoc type. This corresponds to the CIMTYP field in the IDoc control record.
Read-only
Message Type
The logical message type. This corresponds to the MESTYP field in the IDoc control record.
Read-only
EDI Standard
The EDI standard. This corresponds to the STD field in the IDoc control record.
Read-only
XIB: SAP/R/3 Manual 14. Message Log 98
Item Description Requirement EDI Version
The version of the EDI standard. This corresponds to the STDVRS field in the IDoc control record.
Read-only
EDI Message Type
The EDI message type. This corresponds to the STDMES field in the IDoc control record.
Read-only
Sender Port
The sender port. This corresponds to the SNDPOR field in the IDoc control record.
Read-only
Sender Partner Type
The partner type of the sender. This corresponds to the SNDPRT field in the IDoc control record.
Read-only
Sender
The partner number of the sender. This corresponds to the SNDPRN field in the IDoc control record.
Read-only
Receiver Port
The receiver port. This corresponds to the RCVPOR field in the IDoc control record.
Read-only
Receiver Partner Type
The partner type of the receiver. This corresponds to the RCVPRT field in the IDoc control record.
Read-only
Receiver
The partner numbr of the receiver. This corresponds to the RCVPRN field in the IDoc control record.
Read-only
Creation Date
The date that the IDoc was created. This corresponds to the CREDAT field in the IDoc control record.
Read-only
Creation Time
The time that the IDoc was created. This corresponds to the CRETIM field in the IDoc control record.
Read-only
Display Asynchronous IDoc Status Update Creator Event The Sample asynchronous IDoc status update dialog box displays details of an event that records the use of the sample IDoc Status Update MBC, to enable the updating of an IDoc status in SAP. This event is of type SampleIDocStatus. Click the Properties tab.
XIB: SAP/R/3 Manual 14. Message Log 99
The information displayed on this tab is common to all log events. For details of this information, refer to “Chapter 8: Message Log” in the System and Administration Manager manual. Click the SampleIDocStatus tab.
Item Description Requirement Data
The IDoc number for which the status is to be updated in SAP.
Read-only
XIB: SAP/R/3 Manual 15. Message Attributes 100
CHAPTER 15. MESSAGE ATTRIBUTES When XIB receives a message with ALE, it stores communication specific values as attributes of the message. When XIB has processed a message, you can view attributes by using the Message Log. This chapter describes (in outline) how to write MBCs to:
♦ Retrieve communication specific values from message attributes. ♦ Set message attributes to override control values specified in ALE send methods. Such MBCs must support the HIERCHMSGENV interface. For details of the Message Builder language, refer to the Message Builder manual. For details of the MBC_HIERCHMSGENV.GetAttribute function and the MBC_HIERCHMSGENV.SetAttribute statement, refer to the Hierarchical Message Processing manual. For details of how to create a sequential activity, refer to the Integration Manager manual.
Receive Attributes When XIB receives an ALE message, it stores communication specific values, that is host, user, file name, as an attribute of the message. A custom MBC (that is, an MBC written by you) within a sequential activity later in the integration can retrieve these values and take an action dependent on one or more of them. For example, the MBC could log an error in the Message Log if the original ALE message was not received from a given partner.
You need two files: 1. $CORE_ROOT/4edi/include/alerconfig.s4h
2. $CORE_ROOT/4edi/lib/alerconfig.s4
The file alerconfig.s4h contains a record declaration ReceiveInfo that contains a variable for each ale specific parameter. The name of the attribute is “ALERuntimeReceiveInfo” and is declared constant as ALERCONFIG.$ReceiveInfoAttribute. The basic steps in the MBC are: 1. Include the alerconfig.s4h file in the code. The compiler finds the
alerconfig.s4 automatically. 2. Declare an ALERCONFIG.ReceiveInfo record. 3. Retrieve the attribute using the function MBC_HIERCHMSGENV.GetAttribute. The
name parameter must be the constant ALERCONFIG.$ReceiveInfoAttribute. The function returns a string containing the packed record.
4. Unpack the record using the function ALERCONFIG.UnpackReceiveInfo. Here is a skeleton MBC: # Include the file. INCLUDE “alerconfig.s4h” ONCE; # ... # Missed out lines.
XIB: SAP/R/3 Manual 15. Message Attributes 101
# Declare a record. DECLARE $ReceiveInfo RECORD ALERCONFIG.ReceiveInfo; DECLARE $ReceiveInfoString STRING; # Retrieve the attribute. TRY { $ReceiveInfoString = MBC_HIERCHMSGENV.GetAttribute($SessionId, $MessageId, ALERCONFIG.$ReceiveInfoAttribute); } CATCH $Exception WHEN OTHERS { # Log the error in the trace log. LOG FORMAT("Failed to get attribute '%s' ", ALERCONFIG.$ReceiveInfoAttribute) TYPE "ERROR"; } # Unpack the record. TRY { $ReceiveInfo = ALERCONFIG.UnpackReceiveInfoAttribute ($ReceiveInfoString); } CATCH $Exception WHEN OTHERS { # Log the error in the trace log. LOG FORMAT("Failed to unpack attribute '%s' ", ALERCONFIG.$ReceiveInfoAttribute) TYPE "ERROR"; } # Now check the ALE parameters and do something useful.
Send Attributes The R/3 Connector uses two kinds of Send Method attributes, for sending an IDoc or for sending an IDoc status update to SAP. Each of these can be overridden by a custom MBC (that is, an MBC written by you) that runs within a sequential activity. You need two files: 1. $CORE_ROOT/4edi/include/alerconfig.s4h
2. $CORE_ROOT/4edi/lib/alerconfig.s4
The file alerconfig.s4h contains record declarations: ♦ OverrideIDocAttr. The record contains two variables for each control: One
specifies the control value and the other specifies if that value is to be used or not when XIB sends the message. For example, the two variables for the Mode control are $Use_Mode and $Mode.
♦ OverrideStatusAttr. The record contains two variables for each control: One
specifies the control value and the other specifies if that value is to be used or not when XIB sends the message. For example, the two variables for the Status Value control are $Use_StatusValue and $StatusValue.
Unlike most other Connectors, the Send Method attributes of the R/3 Connector are data structures that contain other records, to reflect the structure of the configuration data that is used. For example the OverrideIDocAttr record contains an OverrideLogonAttr record, which contains an OverrideNodeAttr record. When creating your MBC, the only difference is that the syntax for addressing the data elements is slightly different. An example is given below. The basic steps in the MBC are: 1. Include the alerconfig.s4h file in the code. The compiler finds the
alerconfig.s4 automatically. 2. Declare an ALERCONFIG.OverrideIDocAttr record. 3. Set the variables for the controls that you want to override.
XIB: SAP/R/3 Manual 15. Message Attributes 102
4. Pack the record using the function ALERCONFIG.PackOverrideIDocAttr. The function returns a string containing the packed record.
5. Set the attribute using the statement MBC_HIERCHMSGENV.SetAttribute. The name parameter must be the constant ALERCONFIG.$OverrideIDocAttr and the value parameter must be the packed record.
Here is a skeleton MBC: # Include the file. INCLUDE “alerconfig.s4h” ONCE; DECLARE $FALSE = 0 CONSTANT INTEGER; DECLARE $TRUE = 1 CONSTANT INTEGER; # ... # Missed out lines. # Declare a record. DECLARE $OverrideIDoc RECORD ALERCONFIG.OverrideIDocAttr; DECLARE $OverrideIDocString STRING; # Set the variables. $OverrideIDoc.$Use_Mode = $TRUE; $OverrideIDoc.$Mode = 3; $OverrideIDoc.$LogonAttributes.$Use_Trace = $TRUE; $OverrideIDoc.$LogonAttributes.$Trace = $TRUE; # Pack the record. $OverrideIDocString = ALERCONFIG.PackOverrideIDocAttr($OverrideIDoc); # Set the attribute. TRY{ MBC_HIERCHMSGENV.SetAttribute $SessionId MessageId $newMessageId Name ALERCONFIG.$OverrideIDocAttr Value $OverrideIDocString; } CATCH $Exception WHEN OTHERS { # Log the error in the trace log. LOG "No Override IDoc Send Attributes Set" TYPE "ERROR"; }
XIB: SAP/R/3 Manual 16. ALE and IDoc Configuration 103
CHAPTER 16. ALE AND IDOC CONFIGURATION IN SAP
This chapter covers various aspects of configuring SAP for the XIB R/3 Application Connector. This manual is not intended to be a definitive guide to SAP, and it only describes the basic SAP configuration related only to the XIB R/3 Application Connector. Instructions and graphical illustrations are taken from an SAP R/3 version 4.0B installation. Other SAP versions may differ in detail. For more configuration information, refer to the SAP manuals.
Destinations In order for data to be passed from SAP to XIB, the XIB system must be configured as an RFC Destination in SAP. Open the SAP program “Display and maintain RFC destinations” (short cut menu code sm59).
Click the Create button or select Edit / Create.
XIB: SAP/R/3 Manual 16. ALE and IDoc Configuration 104
The following fields are defined for an RFC Destination: RFC Destination A descriptive name of the RFC Destination. The name can
contain any text.
Connection Type Select “T” (TCP/IP connection).
Activation Type Click the Registration button.
Trace This check box should not be selected unless trace debugging information is required.
Program ID This field is the ID of the program when XIB makes a connection to SAP. This field should correspond to the Program ID in the ALE Receive Method configured in XIB.
Description A longer description of the RFC Destination. This description can contain any text.
Click the Save button to save the RFC Destination definition.
XIB: SAP/R/3 Manual 16. ALE and IDoc Configuration 105
Ports In order for SAP to pass data to XIB, the RFC Destination that will be used by XIB must be attached to a port in SAP. Open the SAP program “Port Definition” (short cut menu code we21).
Select the Transactional RFC option and click the Change icon or select Edit / Change to move into edit mode.
Then click on the New entries icon or select Edit / New entries.
XIB: SAP/R/3 Manual 16. ALE and IDoc Configuration 106
The following fields are defined for a Port: Version The IDoc record type to be used for this port. This can take
the following values: 2 = IDoc record type for R/3 versions 3.0 and 3.1 3 = IDoc record type for R/3 versions 4.0 and onwards
Logical Destination
Select the RFC Destination to attach to the Port
Port Description A descriptive name of the Port. The name can contain any text.
Click the Save button to save the Port definition.
Logical System In order for data to be transferred between SAP and XIB, a Logical System must be created that is the symbolic name of another system, SAP or otherwise. Open the SAP program “Distribution (ALE)” (short cut menu code sale), and expand the Basic Settings and then Set up a logical system structure items.
Double-click on the Maintain logical systems item. You will be informed that the table
XIB: SAP/R/3 Manual 16. ALE and IDoc Configuration 107
is client-independent. Click Enter.
Click New entries, or select Edit / New entries.
The following fields are defined for a Logical System: Logical system The name of the Logical System. The name can contain any
text.
Description A descriptive name of the Logical System. The name can contain any text.
Click Save to save the Logical System definition.
Partner Profiles In order for data to be transferred between SAP and XIB, a Partner Profile must be created and Message Types associated with it to define what processing will be performed within SAP. Open the SAP program “Partner Profiles” (short cut menu code we20).
XIB: SAP/R/3 Manual 16. ALE and IDoc Configuration 108
The following data can be entered: Partner number The name of the Logical System. A new Partner Profile can
be created only for an existing Logical System.
Partner type The type of Partner to be created. For a Logical System, this value must be “LS”.
To create a new Partner Profile, click Create or select Partner / Create.
The following fields are defined for a Partner Profile: Partner status The status of the Partner Profile. This value should be set to
“A”, for Active.
XIB: SAP/R/3 Manual 16. ALE and IDoc Configuration 109
Click Save to save the Partner Profile definition.
Outbound Parameters For a Partner Profile, the Outbound Parameters option can be used to configure all IDoc Types that are required for outbound data transfer from SAP. From any of the Partner Profile screens shown above, click Outbound parameters.
From the Outbound Parameters screen, you can click New entries or select Edit / New entries to create a new Message Type entry.
XIB: SAP/R/3 Manual 16. ALE and IDoc Configuration 110
The following fields are defined for an Outbound Parameter: Message Type The name of the Message Type to configure. This name
must be a valid SAP message Type.
Receiver Port The name of the port to receive the IDoc. This name must be a valid SAP Port. Typically it will be configured to the Port definition created in the section above.
Package size This value controls the number of IDocs that will be accumulated in the ALE subsystem before a transmission will take place. For immediate processing, this should be set to 1.
Output mode This defines whether the ALE subsystem will transfer IDocs immediately, or collect them for manual transfer. For immediate processing, this should be set to Transfer IDoc immediately.
Basic type The Basic Type of the IDoc type to be used. This must be a valid Basic Type for the Message type entered above.
XIB: SAP/R/3 Manual 16. ALE and IDoc Configuration 111
Click Save to save the Partner Profile definition.
Inbound Parameters For a Partner Profile, the Inbound Parameters option can be used to configure all IDoc Types that are required for inbound data transfer into SAP. From any of the Partner Profile screens shown above, click Inbound parameters.
From the Inbound Parameters screen, you can click New entries or select Edit / New entries to create a new Message Type entry.
XIB: SAP/R/3 Manual 16. ALE and IDoc Configuration 112
The following fields are defined for an Inbound Parameter: Message Type The name of the Message Type to configure. This name
must be a valid SAP message Type.
Process code The code that defines what should be done with the inbound data. This name must be a valid SAP Process Code.
Processing The scheduling of any processing. This is typically set to “Immediate Processing”.
Click Save to save the Partner Profile definition.
Distribution Model In order for SAP to pass data to XIB, the details of any configuration of Outbound and Inbound Parameters must be associated with the Distribution Model that registers the transfer of data between Logical Systems. Open the SAP program “Maintain distribution model” (short cut menu code bd64).
XIB: SAP/R/3 Manual 16. ALE and IDoc Configuration 113
In this screen, it is possible to add new Message Types from one Logical System to another within a view of the Distribution model. Click Add message type, or select Edit / Message type / Add.
Click Enter to add the Message Type. Then click Save to save the Distribution Model definition.
Other SAP Menu Options
General ALE Configuration The ALE system in the SAP system can be administered by accessing the menu tree: Tools / Business Engineering / Customizing Select the Enterprise IMG option. Cross-application components / Distribution (ALE) … or by using the short cut menu code sale.
XIB: SAP/R/3 Manual 16. ALE and IDoc Configuration 114
The main menu options for the maintenance of RFC Destinations, Port Definitions, Partner Profiles, and many other ALE options, for example, IDoc definitions, are under this sub menu.
Gateway Monitoring The clients logged into a SAP gateway to receive IDocs from SAP can be displayed by using the menu option: Tools / Administration Monitor / System Monitoring / Gateway monitor or by using the short cut menu code smgw, and then the menu option: Goto / Logged on systems
The Program Id entered in the Receive Method is displayed as the TP Name in this screen.
Transactional RFC Monitoring The Transactional RFC status of transfers can be viewed using the menu option: Tools / Administration Monitor / Transactional RFC or by using the short cut menu code sm58.
XIB: SAP/R/3 Manual 16. ALE and IDoc Configuration 115
Select the period to be displayed and the user name, and then click Execute.
This display can, for example, be used to monitor the status of transfers of IDocs from the SAP system, and any reasons why the transfer failed. The status of the transfer is shown in the Status Text column. This display allows re-processing options, if the processing ends in error. In addition, the default options for retrying the transfer can be set in this screen.
IDoc Transfer Monitoring The transfers of IDocs into the SAP system, and their status, can be viewed using the short cut menu code we05.
XIB: SAP/R/3 Manual 16. ALE and IDoc Configuration 116
Select the range of values to view, and then the Execute option.
From this screen it is possible to drill down to view the individual IDocs and the statuses that have been registered for the IDoc as it passes through the ALE system.
XIB: SAP/R/3 Manual 16. ALE and IDoc Configuration 117
XIB: SAP/R/3 Manual 17. Generating IDoc Reports 118
CHAPTER 17. GENERATING IDOC REPORTS IN SAP IDoc reports may be generated by logging on to your SAP system using the SAP GUI, and using the SAP program “Documentation IDoc Record Types and IDoc Types (Parser)” (short cut menu code we63).
Enter the appropriate selection criteria for creating the report, and then click Execute. Note that you should use one report to document each IDoc data structure you wish to retrieve. The IDoc report will be displayed:
XIB: SAP/R/3 Manual 17. Generating IDoc Reports 119
To download the report from the SAP system, select List / Download. You will be prompted for the format of the data to download:
Select “unconverted”, and then click Continue. You will be prompted for a local file name:
XIB: SAP/R/3 Manual 17. Generating IDoc Reports 120
Enter a file name, and change the path to the file if required, then click Transfer. The report will be transferred to your local machine.
XIB: SAP/R/3 Manual 18. About the TID Viewer 121
CHAPTER 18. ABOUT THE TID VIEWER
Transaction Ids (TIDs) Transaction Ids (TIDs) are used to keep track of the status of IDocs being transferred into and out of SAP systems by ALE. Transfers go through a number of statuses, the final of which is the sending of an acknowledgement (ACK) from the receiving system to the sending system. In the ALE TA, the TIDs and their current statuses are stored in a Table server. For outbound transfers from XIB, when the sending of an IDoc succeeds, the TID record is deleted from the Table server, as it is no longer required. When the sending of an IDoc fails, if a TID has been assigned to the transfer, it is saved in the Table server, so that the same TID can be reused when re-sending the IDoc. For inbound transfers to XIB, all TIDs are initially saved, for the purpose of checking for duplicate IDocs. This is because it is possible for XIB to send the final ACK to the sending SAP system, but for it not to be received or processed correctly. In that case, depending on the configuration of the SAP system, the IDoc may be re-sent. When this occurs, the duplicate IDoc must be rejected. In practice, there is a finite period during which a duplicate IDoc will be sent, depending on the configuration of the SAP system. The Table server will periodically delete records older than a certain time. This time is set by the TABLE_OPTIONS environment variable. (Refer to the System and Administration Manager manual for more on the TABLE_OPTIONS). The value of the TABLE_OPTIONS environment variable should be set to a figure that is suitable for the configuration of the sending SAP system. The current active TID records stored in the Table server may be viewed using the TID viewer. It is recommended that you create a separate Table server that handles the TIDs. (Refer to System and Administration Manager manual for the details of creating a Table Task)
Launching the TID Viewer In the System Manager, double-click the TID Viewer. The TID Viewer will not open if there are no TIDs to view, or if the Table server is not started.
What the TID Viewer displays The TID Viewer displays details of active inbound and outbound entries.
XIB: SAP/R/3 Manual 18. About the TID Viewer 122
Inbound TIDs
Item Action TID
The transaction id for the message in SAP.
State
The message state. The state can be CREATED, EXECUTED, RECEIVED, CONFIRMED or ROLLED BACK.
Date Received
The time the message was received.
Date Rolled Back
The time the message was rolled back.
Date Confirmed
The time the message was confirmed.
Date Executed
The time the message was executed.
Date Created
The time the message was created.
Outbound TIDs
Item Description Transfer Id
The Transfer Id for the message in Message Log.
TID
The transaction id for the message in SAP.
State
The message state. The state can be CREATED.
Date
The date the message was created.
XIB: SAP/R/3 Manual A. MB Language Reference 123
APPENDIX A. MESSAGE BUILDER LIBRARY REFERENCE
This library reference describes statements and functions provided with the R/3 Application Connector.
ALE.CreateParameter
NAME ALE.CreateParameter – Creates a handle to a parameter for use with RfcCallReceive and RfcIndirectCall.
SYNTAX ALE.CreateParameter(name, length, type)
DESCRIPTION This function creates an internal table corresponding to the parameters passed, and it returns a handle to the table. These parameters can be used for the IMPORT and EXPORT parameters required by SAP RFC-enabled functions. The name argument is the name that is presented to the SAP system for this parameter The length argument is the length of the buffer to be assigned. The type argument should resolve to one of the values specified in e_ale.s4h
ERRORS The only possible error is a memory allocation error; this will cause a termination of the interpreter.
EXAMPLE DECLARE $id[] INTEGER; $id[1] = ALE.CreateParameter("RFCSI_EXPORT", $RFC_SystemInfo_Size, $RFC_TypeCharacter);
SEE ALSO ALE.SetParameter, ALE.GetParameter, ALE.FreeParameter.
XIB: SAP/R/3 Manual A. MB Language Reference 124
ALE.FreeParameter
NAME ALE.FreeParameter – Releases the memory taken by the specified handle.
SYNTAX ALE.FreeParameter handle;
DESCRIPTION The ALE.FreeParameter statement releases the memory previously allocated by a ALE.CreateParameter function.
ERRORS The following values can be assigned to $error: $Error_RFC_Table_Unknown The specified handle was not found in the internal table.
EXAMPLE DECLARE $id[] INTEGER; $id[1] = ALE.CreateParameter("RFCSI_EXPORT", $RFC_SystemInfo_Size, $RFC_TypeCharacter); ALE.FreeParameter id[1];
SEE ALSO ALE.CreateParameter, ALE.SetParameter, ALE.GetParameter.
XIB: SAP/R/3 Manual A. MB Language Reference 125
ALE.GetParameter
NAME ALE.GetParameter – Extracts the data associated with a handle.
SYNTAX ALE.GetParameter(handle);
DESCRIPTION This function returns the data associated with the specified handle. The data is always returned as a STRING type.
ERRORS The following values can be assigned to $error: $Error_RFC_Table_Unknown The specified handle was not found in the internal table.
EXAMPLE DECLARE $id[] INTEGER; $id[1] = ALE.CreateParameter("RFCSI_EXPORT", $RFC_SystemInfo_Size, $RFC_TypeCharacter); ALE.SetParameter $id[1] DATA “DATA”; $data = ALE.GetParameter($id[1]);
SEE ALSO ALE.CreateParameter, ALE.FreeParameter, ALE.GetParameter.
XIB: SAP/R/3 Manual A. MB Language Reference 126
ALE.ItAppLine
NAME ALE.ItAppLine – Appends another entry to the end of an internal table.
SYNTAX ALE.ItAppLine handle DATA data;
DESCRIPTION The ALE.ItAppLine statement adds another entry to the end of the table created previously by ALE.ItCreate. The corresponding ABAP/4 operation is Append.
ERRORS The following values can be assigned to $error: $Error_RFC_Table_Unknown The specified handle was not found in the internal table. $Error_RFC_AddTable There was an internal error adding data to the table.
EXAMPLE DECLARE $id[] INTEGER; $id[1] = ALE.ItCreate(“IDOC_CONTROL”, $IDOC_LEN, $RFC_TypeCharacter, $RFC_Mode_ByReference); ALE.ItAppLine $id[1] DATA “DATA”; ALE.ItDelete id[1];
SEE ALSO ALE.ItCreate, ALE.ItDelete, ALE.ItFill, ALE.ItFree, ALE.ItGetLine.
XIB: SAP/R/3 Manual A. MB Language Reference 127
ALE.ItCreate
NAME ALE.ItCreate – Creates an internal table for use with RfcCallReceive and RfcIndirectCall.
SYNTAX ALE.ItCreate(name, length, type, mode);
DESCRIPTION This function creates an internal table that can be used for the TABLE parameter required by SAP RFC-enabled functions. A handle to the specified table is returned. The name argument is the name that is presented to the SAP system for this parameter. The length argument is the length of the buffer to be assigned. The type argument should resolve to one of the values specified in e_ale.s4h The mode argument should always be set to $RFC_Mode_ByReference
ERRORS The following values can be assigned to $error: $Error_RFC_Table_Unknown The specified handle was not found in the internal table. $Error_RFC_CreateTable There was an internal error creating the table.
EXAMPLE DECLARE $id[] INTEGER; $id[1] = ALE.ItCreate(“IDOC_CONTROL”, $IDOC_LEN, $RFC_TypeCharacter, $RFC_Mode_ByReference); ALE.ItAppLine $id[1] DATA “DATA”; ALE.ItDelete id[1];
SEE ALSO ALE.ItAppLine, ALE.ItDelete, ALE.ItFill, ALE.ItFree, ALE.ItGetLine
XIB: SAP/R/3 Manual A. MB Language Reference 128
ALE.ItDelete
NAME ALE.ItDelete – Deletes a table previously created by ALE.ItCreate.
SYNTAX ALE.ItDelete handle;
DESCRIPTION The ALE.ItDelete statement frees the memory associated with a table previously created by ALE.ItCreate. The handle is no longer valid. The corresponding ABAP/4 function is Free.
ERRORS The following values can be assigned to $error: $Error_RFC_Table_Unknown The specified handle was not found in the internal table. $Error_RFC_DeleteTable There was an internal error destroying the table.
EXAMPLE DECLARE $id[] INTEGER; $id[1] = ALE.ItCreate(“IDOC_CONTROL”, $IDOC_LEN, $RFC_TypeCharacter, $RFC_Mode_ByReference); ALE.ItAppLine $id[1] DATA “DATA”; ALE.ItDelete id[1];
SEE ALSO ALE.ItCreate, ALE.ItAppLine, ALE.ItFill, ALE.ItFree, ALE.ItGetLine
XIB: SAP/R/3 Manual A. MB Language Reference 129
ALE.ItFill
NAME ALE.ItFill – Returns the number of rows in the specified table.
SYNTAX ALE.ItFill(handle);
DESCRIPTION This function returns the number of rows in a table previously created by ALE.ItCreate.
ERRORS The following values can be assigned to $error: $Error_RFC_Table_Unknown The specified handle was not found in the internal table.
EXAMPLE DECLARE $id[] INTEGER; DECLARE $rows INTEGER; $id[1] = ALE.ItCreate(“IDOC_CONTROL”, $IDOC_LEN, $RFC_TypeCharacter, $RFC_Mode_ByReference); ALE.ItAppLine $id[1] DATA “DATA”; $rows = ALE.ItFill($id[1]); ALE.ItDelete id[1];
SEE ALSO ALE.ItCreate, ALE.ItAppLine, ALE.ItDelete, ALE.ItFree, ALE.ItGetLine
XIB: SAP/R/3 Manual A. MB Language Reference 130
ALE.ItFree
NAME ALE.ItFree – Clears the contents of a table associated with the specified handle.
SYNTAX ALE.ItFree handle;
DESCRIPTION The ALE.ItFree statement clears the contents of a table previously created with ALE.ItCreate. The handle is still valid, but the number of rows in the table is now zero. The corresponding ABAP/4 operation is Free.
ERRORS The following values can be assigned to $error: $Error_RFC_Table_Unknown The specified handle was not found in the internal table.
EXAMPLE DECLARE $id[] INTEGER; DECLARE $rows INTEGER; $id[1] = ALE.ItCreate(“IDOC_CONTROL”, $IDOC_LEN, $RFC_TypeCharacter, $RFC_Mode_ByReference); ALE.ItAppLine $id[1] DATA “DATA”; /* * rows is 1 */ $rows = ALE.ItFill($id[1]); ALE.ItFree $id[1]; /* * rows is now 0 */ $rows = ALE.Itfill($id[1]); ALE.ItDelete id[1];
SEE ALSO ALE.ItCreate, ALE.ItAppLine, ALE.ItDelete, ALE.ItFill, ALE.ItGetLine
XIB: SAP/R/3 Manual A. MB Language Reference 131
ALE.ItGetLine
NAME ALE.ItGetLine – Retrieves data from data previously created by ALE.ItCreate.
SYNTAX ALE.ItGetLine(handle, rowNumber);
DESCRIPTION This function returns the data that is indexed by rowNumber in the table associated with the specified handle. The corresponding ABAP/4 operation is Read Table… Index…
ERRORS The following values can be assigned to $error: $Error_RFC_Table_Unknown The specified handle was not found in the internal table.
EXAMPLE DECLARE $id[] INTEGER; DECLARE $rows INTEGER; DECLARE $data STRING; $id[1] = ALE.ItCreate(“IDOC_CONTROL”, $IDOC_LEN, $RFC_TypeCharacter, $RFC_Mode_ByReference); ALE.ItAppLine $id[1] DATA “DATA”; FOR $i = 1 TO ALE.ItFill($id[1]) { $data = ALE.ItGetLine($id[1], $i); } ALE.ItDelete id[1];
SEE ALSO ALE.ItCreate, ALE.ItAppLine, ALE.ItDelete, ALE.ItFree, ALE.ItFill
XIB: SAP/R/3 Manual A. MB Language Reference 132
ALE.RfcCallReceive
NAME ALE.RfcCallReceive – Executes an RFC-enabled function module within SAP.
SYNTAX ALE.RfcCallReceive rfcid FUNCTION function TABLES tableHandles
IMPORT importHandles EXPORT exportHandles ERROR errorString;
DESCRIPTION The ALE.RfcCallReceive statement is used to call an RFC-enabled function module within SAP. The rfcid parameter is the handle returned by a previous call to ALE.RfcOpenOutboundConnection. The function parameter is the name of the function to call. This function has to be RFC-enabled within SAP. The tableHandles parameter is an array of integers that are handles to tables previously created using ALE.ItCreate. The importHandles parameter is an array of integers that are handles to parameters previously created by ALE.CreateParameter. The exportHandles parameter is an array of integers that are handles to parameters previously created by ALE.CreateParameter. If the SAP function module does not require any of the above parameters, then empty arrays should be declared and passed through. The errorString parameter is a string parameter that is populated if there is an error during the call to RfcCallReceive.
ERRORS The following values can be assigned to $error: $Error_RFC_Connection_Unknown The connection id is invalid. $Error_RFC_Table_Unknown One of the passed parameters does not point to valid table. $Error_RFC_CallReceive_TableParm An error occurred manipulating the table parameters. $Error_RFC_CallReceive_ImportParm An error occurred manipulating the import parameters. $Error_RFC_CallReceive_ExportParm An error occurred manipulating the export parameters. $Error_RFC_CallReceive An error occurred during the execution of the function module in SAP.
EXAMPLE INCLUDE “e_ale.s4h”; DECLARE $importParameters[] INTEGER; DECLARE $tables[] INTEGER; DECLARE $exportParameters[] INTEGER;
XIB: SAP/R/3 Manual A. MB Language Reference 133
DECLARE $errorString STRING; DECLARE $openId INTEGER; ALE.RfcOpenOutboundConnection “FKG” MODE “3” HOST “sap.frontec.com” SYSTEM 0 GWHOST “sap.frontec.com” GWSERV “3300” CLIENT “800” USER “sapuser” PASSWORD “sappw” LANGUAGE “E” TRACE 0 RFCID $openId ERROR $errorString; $importParameters[1] = ALE.CreateParameter("RFCSI_EXPORT", 201, $RFC_TypeCharacter); ALE.RfcCallReceive $openId FUNCTION "RFC_SYSTEM_INFO" IMPORT $importParameters TABLES $tables EXPORT $exportParameters ERROR $errorString; $data = ALE.GetParameter($importParameters[1]); ALE.FreeParameter $importParameters[1]; ALE.RfcClose $openId;
SEE ALSO ALE.IndirectCall
XIB: SAP/R/3 Manual A. MB Language Reference 134
ALE.RfcClose
NAME ALE.RfcClose – Closes an open connection.
SYNTAX ALE.RfcClose rfcid;
DESCRIPTION This statement closes a RFC connection to SAP that was previously opened by ALE.RfcOpenOutboundConnection.
ERRORS The following values can be assigned to $error: $Error_RFC_Connection_Unknown The connection id is invalid.
EXAMPLE Refer to the ALE.RfcCallReceive function for an example.
SEE ALSO ALE.RfcOpenOutboundConnection, ALE.RfcOpenInboundConnection
XIB: SAP/R/3 Manual A. MB Language Reference 135
ALE.RfcCreateTransId
NAME ALE.RfcCreateTransId – Creates a transaction id for an asynchronous dialogue.
SYNTAX ALE.RfcCreateTransId(rfcid);
DESCRIPTION This function creates a unique transaction identity for the asynchronous dialogue with the remote SAP system. This transaction Id can then be used with ALE.RfcIndirectCall.
ERRORS The following values can be assigned to $error: $Error_RFC_Connection_Unknown The connection id is invalid. $Error_RFC_Trans_ID There was an internal error creating the transaction id.
EXAMPLE Refer to the ALE.RfcIndirectCall function for an example.
SEE ALSO ALE.IndirectCall
XIB: SAP/R/3 Manual A. MB Language Reference 136
ALE.RfcError
NAME ALE.RfcError – Gets the last error encountered by the RFC API.
SYNTAX ALE.RfcError(rfcid);
DESCRIPTION This function returns the last error encountered by the RFC API. It should be used only with those functions that do not have an error string as part of their parameter list.
EXAMPLE Refer to the ALE.RfcIndirectCall function for an example.
XIB: SAP/R/3 Manual A. MB Language Reference 137
ALE.RfcIndirectCall
NAME ALE.RfcIndirectCall – Calls a function module within SAP asynchronously.
SYNTAX ALE.RfcIndirectCall rfcid FUNCTION function TABLES tableHandles
EXPORT exportHandles TID transactionId;
DESCRIPTION The ALE.RfcIndirectCall statement is used to call a RFC enabled function module within SAP. The rfcid parameter is the handle returned by a previous call to ALE.RfcOpenOutboundConnection. The function parameter is the name of the function to call. This function has to be RFC-enabled within SAP. The tableHandles parameter is an array of integers that are handles to tables previously created using ALE.ItCreate. The exportHandles parameter is an array of integers that are handles to parameters previously created by ALE.CreateParameter. The transactionId parameter is a transaction id previously created using ALE.RfcCreateTransId, if this is not passed, then no transaction id will be recorded within SAP. If the SAP function module does not require any of the above parameters, then empty arrays should be declared and passed through.
ERRORS The following values can be assigned to $error: $Error_RFC_Connection_Unknown The connection id is invalid $Error_RFC_Send There was an internal error calling the function module $Error_RFC_Table_Unknown One of the passed parameters does not point to valid table
EXAMPLE INCLUDE “e_ale.s4h”; DECLARE $tables[] INTEGER; DECLARE $exportParameters[] INTEGER; DECLARE $tid STRING; DECLARE $data STRING; DECLARE $openId INTEGER; ALE.RfcOpenOutboundConnection “FKG” MODE “3” HOST “sap.frontec.com” SYSTEM 0 GWHOST “sap.frontec.com” GWSERV “3300” CLIENT “800” USER “sapuser”
XIB: SAP/R/3 Manual A. MB Language Reference 138
PASSWORD “sappw” LANGUAGE “E” TRACE 0 RFCID $openId ERROR $errorString; $tid = ALE.RfcCreateTransId($openId); $tables[1] = ALE.ItCreate("IDOC_CONTROL", 464, $RFC_TypeCharacter, $Rfc_Mode_ByReference); ALE.ItAppLine $tables[1] DATA “EDI_DC “; ALE.RfcIndirectCall $openId FUNCTION "INBOUND_IDOC_PROCESS" TABLES $tables EXPORT $exportParameters; IF $error <> 0 { $data = ALE.RfcError($openId); LOG “ERROR : “ & $data TYPE “ERROR”; } ALE.ItDelete $tables[1]; ALE.RfcClose $openId;
SEE ALSO ALE.RfcCallReceive
XIB: SAP/R/3 Manual A. MB Language Reference 139
ALE.RfcOpenOutboundConnection
NAME ALE.RfcOpenOutboundConnection – Opens a connection to SAP.
SYNTAX ALE.RfcOpenOutboundConnection destination
MODE mode HOST hostName SYSTEM system GWHOST gatewayHostName GWSERV gatewayService CLIENT client USER user PASSWORD password LANGUAGE language TRACE trace RFCID openid ERROR errorString;
DESCRIPTION The ALE.RfcOpenConnection statement opens a connection to SAP using the following parameters: The destination parameter resolves to the System Identity of the target SAP system. The mode parameter, should be either 2, 3, or E corresponding to R/2, R/3 and external system modes, respectively. The hostName parameter is the host name of the target SAP system, this can be either a DNS name or an IP address. The system parameter is the system number of the target SAP system. The gatewayHostName parameter is, if configured within SAP, the host name of the SAP gateway. The gatewayService parameter is, if configured within SAP, the service name or number to use when communicating to the gateway. The client parameter is the client number of the user parameter. The user parameter is the username used to log in to the target SAP system. The password parameter is the password associated with the user parameter. This is not encrypted. The language parameter defaults to “E” for English, but can be supplied if a different language is being used. The trace parameter causes a low level RFC trace file to be created in the current working directory. The openid parameter is the handle to the open connection. This is set to 0 if the initial connection fails.
XIB: SAP/R/3 Manual A. MB Language Reference 140
The errorString parameter is populated by the function if there is an error when trying to connect to the SAP system.
ERRORS The following values can be assigned to $error: $Error_RFC_Open_Error The attempt to open a connection failed
EXAMPLE Refer to the ALE.RfcIndirectCall or ALE.RfcCallReceive function for an example.
SEE ALSO ALE.RfcClose
XIB: SAP/R/3 Manual A. MB Language Reference 141
ALE.SetParameter
NAME ALE.SetParameter – Sets the contents of a table.
SYNTAX ALE.SetParameter handle DATA data;
DESCRIPTION This function sets the contents associated with the specified handle to data.
ERRORS The following values can be assigned to $error: $Error_RFC_Table_Unknown The specified handle was not found in the internal table.
EXAMPLE DECLARE $id[] INTEGER; $id[1] = ALE.CreateParameter("RFCSI_EXPORT", $RFC_SystemInfo_Size, $RFC_TypeCharacter); ALE.SetParameter $id[1] DATA “DATA” $data = ALE.GetParameter($id[1]);
SEE ALSO ALE.CreateParameter, ALE.FreeParameter, ALE.GetParameter.
XIB: SAP/R/3 Manual A. MB Language Reference 142
ALE.Version
NAME ALE.Version – Returns the version number.
SYNTAX ALE.Version()
DESCRIPTION This function returns the version number of the ALE extension module.
EXAMPLE DECLARE $data STRING; $data = ALE.Version();
XIB: SAP/R/3 Manual A. MB Language Reference 143
SAPABAP.InstallAndRun
NAME SAPABAP.InstallAndRun – Installs and runs an ABAP program.
SYNTAX SAPABAP.InstallAndRun rfcid ABAPFILE abapFile SUBSTITUTION substitution
[RETURNFILE returnFile] [VERSION version] [OUTPUT output];
DESCRIPTION The SAPABAP.InstallAndRun statement is used to install and execute a local ABAP program within SAP. The RFC-enabled function module RFC_ABAP_INSTALL_AND_RUN is used. The rfcid parameter is the handle returned by a previous call to ALE.RfcOpenOutboundConnection, or SAPLIB.OpenConnection. The abapFile parameter is the filename of the local ABAP/4 source to be executed. The substitution parameter is an array of strings, to be used for substitution purposes. The output parameter either contains an array of strings, which corresponds to any screen output from the program, or it contains the filename where the screen output has been written. The returnFile parameter defaults to 0; if set to 1, the output parameter contains the filename. The version parameter is used to indicate the version of the SAP system, if no version is supplied, it defaults to 3
SUBSTITUTIONS Within the ABAP/4 source code, the area of code where substitution is to occur is bounded by ### INSERT and ### END_INSERT contained within an ABAP/4 comment. Within this section, substitutions will occur for the values that reference an index within the substitution array. Each reference that occurs should be prefixed by a dollar sign ($). Substituted values will be bounded by a pair of single braces. For example, $1 will be substituted with the value held in first element of the substitution array.
ERRORS A THROW EXECUTE error is generated if an execution error occurs.
EXAMPLES Example of ABAP/4 Source *PROGRAM MyProgram. PROGRAM MyProgram. DATA: MY_DATA(50) TYPE C. * ### INSERT MY_DATA = $1. * ### END_INSERT WRITE / MY_DATA.
Code Example using the abap source listing above. DECLARE $abapfile = “/usr/src/myabap” STRING;
XIB: SAP/R/3 Manual A. MB Language Reference 144
DECLARE $nodeinfo[] STRING; DECLARE $rfcid INTEGER; DECLARE $output[] STRING; DECLARE $subs[] STRING; SAPLIB.GetNodeInfo “SAP” NODEINFO $nodeinfo; $rfcid = SAPLIB.OpenConnection($nodeinfo, 0); $subs[1] = “HELLO WORLD”; SAPABAP.InstallAndRun $rfcid ABAPFILE $abapfile SUBSTITUTION $subs RETURNFILE 0 VERSION 4 OUTPUT $output; FOR $i = 1 TO ARRAYSIZE($output){
PRINT $Output[$i] & “\n”; } ALE.RfcClose $rfcid;
XIB: SAP/R/3 Manual A. MB Language Reference 145
SAPCONVERT.FloatToPackedDecimalBuffer
NAME SAPCONVERT.FloatToPackedDecimalBuffer – Converts a FLOAT variable to a SAP packed decimal.
SYNTAX SAPCONVERT.FloatToPackedDecimalBuffer(float, length, decimals)
DESCRIPTION This function converts a Message Builder FLOAT variable into the SAP packed decimal format (RFC_BCD). The float parameter is the number to be converted. The length parameter is the number of bytes that the result should occupy. The decimals parameter is the number of decimal places.
ERRORS If there is an error, then an error will be thrown.
EXAMPLE DECLARE $packed STRING; DECLARE $packedbytesize = 4 INTEGER; DECLARE $I = 1.11111 FLOAT; $packed = SAPCONVERT.FloatToPackedDecimalBuffer($i, $packedbytesize, 5);
XIB: SAP/R/3 Manual A. MB Language Reference 146
SAPCONVERT.Int4BufferToInteger
NAME SAPCONVERT.Int4BufferToInteger – Converts a SAP RFC_INT4 type into an INTEGER variable
SYNTAX SAPCONVERT. Int4BufferToInteger (buffer)
DESCRIPTION This function converts a SAP RFC_INT4 type into a Message Builder INTEGER variable. The buffer parameter is the buffer to be converted.
ERRORS If there is an error, then an error will be thrown
EXAMPLE $integer = SAPCONVERT.Int4BufferToInteger($buffer);
XIB: SAP/R/3 Manual A. MB Language Reference 147
SAPCONVERT.IntegerToInt4Buffer
NAME SAPCONVERT. IntegerToInt4Buffer – Converts an INTEGER variable to a SAP RFC_INT4 type.
SYNTAX SAPCONVERT. IntegerToInt4Buffer (buffer)
DESCRIPTION This function converts a Message Builder INTEGER variable into a SAP RFC_INT4 type. The buffer parameter is the buffer to be converted.
ERRORS If there is an error, then an error will be thrown.
EXAMPLE $buffer = SAPCONVERT.IntegerToInt4Buffer(10);
XIB: SAP/R/3 Manual A. MB Language Reference 148
SAPCONVERT.PackedDecimalBufferToFloat
NAME SAPCONVERT.PackedDecimalBufferToFloat – Converts SAP packed decimal to FLOAT.
SYNTAX SAPCONVERT.PackedDecimalBufferToFloat (buffer, decimals)
DESCRIPTION This function converts the SAP packed decimal format (RFC_BCD) into a Message Builder FLOAT variable. The buffer parameter is the number to be converted. The decimals parameter is the number of decimal places.
ERRORS If there is an error, then an error will be thrown.
EXAMPLE DECLARE $unpacked FLOAT; $unpacked = SAPCONVERT.PackedDecimalBufferToFloat($buffer, 5);
XIB: SAP/R/3 Manual A. MB Language Reference 149
SAPLIB.GetNodeInfo
NAME SAPLIB.GetNodeInfo – Read the XIB database to return node information.
SYNTAX SAPLIB.GetNodeInfo nodeName NODEINFO nodeInfo;
DESCRIPTION This statement reads a tag file, and returns the information associated with the specified nodeName. The returned information is stored in the array nodeInfo. This array is set using the corresponding constant instants found in saplib.s4h. If the node is not found, then the ARRAYSIZE of nodeInfo will be zero.
EXAMPLE DECLARE $nodeinfo[] STRING; SAPLIB.ReadTagFile “/amtrix/data/ale_connect”; SAPLIB.GetNodeInfo “SAP” NODEINFO $nodeinfo;
SEE ALSO SAPLIB.OpenConnection
XIB: SAP/R/3 Manual A. MB Language Reference 150
SAPLIB.OpenConnection
NAME SAPLIB.OpenConnection – Opens a connection to SAP.
SYNTAX SAPLIB.OpenConnection(nodeinfo, trace);
DESCRIPTION This function requires a nodeinfo parameter, which corresponds to that returned by SAPLIB.GetNodeInfo. This function uses the ALE.RfcOpenOutboundConnection statement to open the connection. The trace parameter indicates whether a low-level RFC trace file should be created.
ERRORS If a connection cannot be opened then the returned ID will be zero.
EXAMPLE DECLARE $nodeinfo[] STRING; SAPLIB.ReadTagFile “/amtrix/data/ale_connect”; SAPLIB.GetNodeInfo “SAP” NODEINFO $nodeinfo; $openId = SAPLIB.OpenConnection($nodeinfo, 0);
SEE ALSO SAPLIB.GetNodeInfo, ALE.RfcOpenOutboundConnection
XIB: SAP/R/3 Manual A. MB Language Reference 151
SAPLIB.GetSystemInfo
NAME SAPLIB.GetSystemInfo – Gets system information from an SAP system.
SYNTAX SAPLIB.GetSystemInfo openId INFO systemInfo;
DESCRIPTION This statement returns system information associated with a remote SAP system. It uses the function module RFC_SYSTEM_INFO. The openId parameter should be a handle returned by either SAPLIB.OpenConnection or ALE.RfcOpenOutboundConnection. The statement returns the systemInfo parameter. This is an array that can be accessed using the constant indexes defined in saplib.s4h.
EXAMPLE DECLARE $nodeinfo[] STRING; DECLARE $systeminfo[] STRING; SAPLIB.ReadTagFile “/amtrix/data/ale_connect”; SAPLIB.GetNodeInfo “SAP” NODEINFO $nodeinfo; $openId = SAPLIB.OpenConnection($nodeinfo); SAPLIB.GetSystemInfo $openId INFO $systeminfo;
XIB: SAP/R/3 Manual A. MB Language Reference 152
SAPLIB.ReadTagFile
NAME SAPLIB.ReadTagFile – Reads connection parameters from a tag file.
SYNTAX SAPLIB.ReadTagFile fileName;
DESCRIPTION If this statement is called before a SAPLIB.GetNodeInfo is called, when SAPLIB.GetNodeInfo is executed, it reads in the connection parameter from the specified fileName rather than from the XIB database. The file can contain only one set of connection parameters, and it takes the following format: HOST=<host> DEST=<dest> SYSTEM=<system number> GWHOST=<gateway host> GWSERV=<gateway service> CLIENT=<client> USER=<user> PASSWORD=<password>
EXAMPLE DECLARE $nodeinfo[] STRING; DECLARE $systeminfo[] STRING; SAPLIB.ReadTagFile “/amtrix/data/ale_connect”; SAPLIB.GetNodeInfo “SAP” NODEINFO $nodeinfo; $openId = SAPLIB.OpenConnection($nodeinfo); SAPLIB.GetSystemInfo $openId INFO $systeminfo;
XIB: SAP/R/3 Manual A. MB Language Reference 153
SAPLIB.SetDebug
NAME SAPLIB.SetDebug – Sets the debug level within the module.
SYNTAX SAPLIB.SetDebug debugFlag;
DESCRIPTION The debugFlag can be zero or one, which indicate no debug and debug, respectively.
EXAMPLE DECLARE $nodeinfo[] STRING; DECLARE $systeminfo[] STRING; SAPLIB.SetDebug 1; SAPLIB.ReadTagFile “/amtrix/data/ale_connect”; SAPLIB.GetNodeInfo “SAP” NODEINFO $nodeinfo; $openId = SAPLIB.OpenConnection($nodeinfo); SAPLIB.GetSystemInfo $openId INFO $systeminfo;
XIB: SAP/R/3 Manual A. MB Language Reference 154
SAPUTIL.ReadTable
NAME SAPUTIL.ReadTable – Reads a database table within SAP.
SYNTAX SAPUTIL.ReadTable rfcid TABLE tableName WHERE where FIELDS fields
[DATA data] [NODATA noData] [VERSION version];
DESCRIPTION The SAPUTIL.ReadTable statement is used to read a database table within SAP. The RFC-enabled function module RFC_READ_TABLE is used. The rfcid parameter is the handle returned by a previous call to ALE.RfcOpenoutboundConnection, or SAPLIB.OpenConnection. The tableName parameter is the table to read. The where parameter is the filter to be passed to the function module. The fields output parameter is an array of elements containing the column information for the specified table. The data output parameter is an array of elements containing a single row from the specified table. The noData parameter can be set to 1 or 0. It defaults to zero, if set to 1, then no data is returned in the data parameter. The version parameter is used to indicate the version of the SAP system; if no version is supplied, then it defaults to 3.
ERRORS If there is an error during the call to this statement, then an error will be thrown.
EXAMPLE DECLARE $tablename = “EDIDO” CONSTANT STRING; DECLARE $where = “DOCTYP LIKE ‘ORD%’” CONSTANT STRING; DECLARE $fields[] STRING; DECLARE $data[] STRING; DECLARE $rfcid INTEGER; DECLARE $requiredFields[] ={ “DOCTYP”, “IDOCTYP” } STRING; DECLARE $nodeinfo[] STRING; DECLARE $actualData[][] STRING; SAPLIB.ReadTagFile “/amtrix/data/ale_connect”; SAPLIB.GetNodeInfo “SAP” NODEINFO $nodeinfo; $rfcid = SAPLIB.OpenConnection($nodeinfo, 0); SAPUTIL.ReadTable $rfcid
TABLE $tablename WHERE $where FIELDS $fields DATA $data VERSION 4;
$actualData = SAPUTIL.GetTableData($requiredFields, $fields, $data, 4); FOR $i=1 TO ARRAYSIZE($actualData) { PRINT “Doctyp = “ & $ActualData[$i][1] & “\n”;
XIB: SAP/R/3 Manual A. MB Language Reference 155
PRINT “IDoctyp = “ & $ActualData[$I][2] & “\n”; } ALE.RfcClose $rfcid;
SEE ALSO SAPUTIL.GetTableData
XIB: SAP/R/3 Manual A. MB Language Reference 156
SAPUTIL.GetTableData
NAME SAPUTIL.GetTableData – Returns data from the table in a structured format
SYNTAX SAPUTIL.GetTableData(requiredFields, fields, data, version)
DESCRIPTION The SAPUTIL.GetTableData function is used to extract data from each row of the table in a structured array. The requiredFields parameter is an array of field information used to match against the column information returned by SAPUTIL.ReadTable. The fields parameter is the fields parameter returned by SAPUTIL.ReadTable. The data parameter is the data parameter returned by SAPUTIL.ReadTable. The version parameter is used to indicate the version of the SAP system, it defaults to 3.
ERRORS If there is an error during the call to this statement then an error will be thrown.
EXAMPLE Refer to the SAPUTIL.ReadTable example
SEE ALSO SAPUTIL.ReadTable
XIB: SAP/R/3 Manual B. SAP Example 157
APPENDIX B. SAP FUNCTION MODULE IMPLEMENTATION EXAMPLE
The following code is a full example of the implementation of a synchronous call to a SAP Function Module. The implementation uses XIB library functions that make an RFC connection to a SAP system, and send a request to SAP to run the Function Module specified. Parameters are passed to the Function Module and received from it. The example can be used as a template for any implementation of a Function Module or BAPI in SAP, providing the Function Module is RFC-enabled. The example implements a stand-alone program, SAP_GetCustomer.s4, that requests information to be retrieved about customers registered in SAP. The program takes these arguments:
Argument Description ? Display usage V Display version information d Set mode to debug t Tag file. Using this argument enables the retrieval of
connection information from a tag file of the specified name. c Customer code. This argument specifies the selection
criterion for the display of customer details. Wildcards are allowed, according to rules specified by SAP.
The program uses the RFC_CUSTOMER_GET Function Module to retrieve the customer information.
/* * SAP_GetCustomer.s4 - Implementation of Function Module * RFC_CUSTOMER_GET */ INCLUDE "saplib.s4h" ONCE; INCLUDE "e_ale.s4h" ONCE; INCLUDE "sysinfo.s4h" ONCE; INCLUDE "sapCustomer.s4h" ONCE; DECLARE $programName STRING; DECLARE $FALSE = 0 CONSTANT INTEGER; DECLARE $TRUE = 1 CONSTANT INTEGER; DECLARE $debugOn = $FALSE INTEGER; DECLARE $customer STRING; DECLARE $node STRING; DECLARE $nodeInfo[] STRING; DECLARE $openId INTEGER; DECLARE $tagFile STRING; $programName = ARGUMENT(0); /* Get arguments */ TRY { WHILE $TRUE { CASE ARG.GetOpt("?Vdn:t:c:") WHEN "" { BREAK; } WHEN "V" { Version; EXIT 0; } WHEN "?" { Usage; EXIT 0;
XIB: SAP/R/3 Manual B. SAP Example 158
} WHEN "d" { $debugOn = $TRUE; SAPLIB.SetDebug $TRUE; } WHEN "n" { $node = ARG.GetOptArgument(); } WHEN "t" { $tagfile = ARG.GetOptArgument(); } WHEN "c" { $customer = ARG.GetOptArgument(); } } } CATCH $exception WHEN "EXECUTE" { Usage; EXIT 2; } IF ($tagfile <> "") { SAPLIB.ReadTagFile $tagfile; } IF ($node = "" AND $tagfile = "") { PRINTERR "Node or Tag file must be specified\n"; EXIT 3; } IF $customer = "" { PRINTERR "Customer string must be specified\n"; EXIT 4; } /* Get the node information */ SAPLIB.GetNodeInfo $node NODEINFO $nodeInfo; /* Open connection */ $openId = SAPLIB.OpenConnection($nodeInfo); IF $openId = 0 { LOG "Failed to Open connection" TYPE "DEBUG"; EXIT 5; } /* Call the function module */ GetCustomer $openId CUSTOMER $customer; /* Close connection */ ALE.RfcClose $openId; EXIT 0; DECLARE STATEMENT Version { PRINTERR "Program Unit Revision: " & ARGUMENT(0) & " : " & ALE.Version() & "\n"; RETURN; } DECLARE STATEMENT Usage { CASE System() WHEN $System_Posix, $System_OS400 { PRINTERR "Usage: r4edi " & $programName & " [-?] [-V] [-d] [-n node] [-t tagfile]\n"; } WHEN $System_Win32 { PRINTERR "Usage: r4edi " & $programName & " [/?] [/V] [/d] [/n node] [/t tagfile]\n"; } WHEN OTHERS {
XIB: SAP/R/3 Manual B. SAP Example 159
LOG "System not supported: " & System() TYPE "ERROR"; EXIT 1; } RETURN; } DECLARE STATEMENT GetCustomer IN $openId CUSTOMER IN $customer { DECLARE $tables[] INTEGER; DECLARE $exportParameters[] INTEGER; DECLARE $importParameters[] INTEGER; DECLARE $tableData STRING; DECLARE $customerInfo[] STRING; DECLARE $i INTEGER; DECLARE $limit INTEGER; DECLARE $errString STRING; /* Set up tables */ IF $debugOn = $TRUE { LOG "Generating table entries, and populating" TYPE "DEBUG"; } $tables[1] = ALE.ItCreate("CUSTOMER_T", 197, $RFC_TypeCharacter, $RFC_Mode_ByReference); /* Set up export parameters */ $exportParameters[1] = ALE.CreateParameter("KUNNR", 10, $RFC_TypeCharacter); ALE.SetParameter $exportParameters[1] DATA LEFT($customer, 10); $exportParameters[2] = ALE.CreateParameter("NAME1", 35, $RFC_TypeCharacter); ALE.SetParameter $exportParameters[2] DATA LEFT("*", 35); IF $debugOn = $TRUE { LOG "Calling RFC_CUSTOMER_GET" TYPE "DEBUG"; } /* Call remote SAP function */ ALE.RfcCallReceive $openId FUNCTION "RFC_CUSTOMER_GET" EXPORT $exportParameters IMPORT $importParameters TABLES $tables ERROR $errString; IF ($errString <> "") OR ($error <> 0) { LOG "Error occured during RFC call" TYPE "DEBUG"; IF $debugOn = $TRUE { LOG "Details :" & "error [" & $error & "], " & "error string [" & $errString & "]\n" TYPE "DEBUG"; } RETURN; } $limit = ALE.ItFill($tables[1]); IF $debugOn = $TRUE { LOG "Number of records found : " & $limit & "\n" TYPE "DEBUG"; } FOR $i = 1 TO $limit { $tableData = ALE.ItGetLine($tables[1], $i); ResolveCustomerInfo $tableData INFO $customerInfo; LOG "Customer details :\n"
XIB: SAP/R/3 Manual B. SAP Example 160
& " Number = " & $customerInfo[$RFC_Customer_Number] & "\n" & " Title = " & $customerInfo[$RFC_Customer_Title] & "\n" & " Name = " & $customerInfo[$RFC_Customer_Name] & "\n" & " POBox = " & $customerInfo[$RFC_Customer_POBox] & "\n" & " Street = " & $customerInfo[$RFC_Customer_Street] & "\n" & " PostalCode = " & $customerInfo[$RFC_Customer_PostalCode] & "\n" & " City = " & $customerInfo[$RFC_Customer_City] & "\n" & " Telephone = " & $customerInfo[$RFC_Customer_Telephone] & "\n" & " Fax = " & $customerInfo[$RFC_Customer_Fax] & "\n" TYPE "INFO"; } /* Tidy up */ ALE.FreeParameter $exportParameters[1]; ALE.FreeParameter $exportParameters[2]; ALE.ItDelete $tables[1]; RETURN; } DECLARE STATEMENT ResolveCustomerInfo IN $data INFO OUT $customerInfo { $customerInfo[$RFC_Customer_Number] = STRMID($data, 1, 10); $customerInfo[$RFC_Customer_Title] = STRMID($data, 11, 25); $customerInfo[$RFC_Customer_Name] = STRMID($data, 26, 60); $customerInfo[$RFC_Customer_POBox] = STRMID($data, 61, 70); $customerInfo[$RFC_Customer_Street] = STRMID($data, 71, 105); $customerInfo[$RFC_Customer_PostalCode] = STRMID($data, 106, 115); $customerInfo[$RFC_Customer_City] = STRMID($data, 116, 150); $customerInfo[$RFC_Customer_Telephone] = STRMID($data, 151, 166); $customerInfo[$RFC_Customer_Fax] = STRMID($data, 167, 197); RETURN; }
The program uses a header file, SAPCustomer.s4h.
/* * sapCustomer.s4h - Header file for SAP Customer programs */ /* * Customer data */ DECLARE $RFC_Customer_Number = 1 CONSTANT INTEGER; DECLARE $RFC_Customer_Title = 2 CONSTANT INTEGER; DECLARE $RFC_Customer_Name = 3 CONSTANT INTEGER; DECLARE $RFC_Customer_POBox = 4 CONSTANT INTEGER; DECLARE $RFC_Customer_Street = 5 CONSTANT INTEGER; DECLARE $RFC_Customer_PostalCode = 6 CONSTANT INTEGER; DECLARE $RFC_Customer_City = 7 CONSTANT INTEGER; DECLARE $RFC_Customer_Telephone = 8 CONSTANT INTEGER; DECLARE $RFC_Customer_Fax = 9 CONSTANT INTEGER;
XIB: SAP/R/3 Manual B. SAP Example 161
APPENDIX C. ALE LOG CLEAN UTILITY Supplied with the SAP Connecter is a program called cleanAleLog.x4. This program cleans the Ale logs.
Syntax of ALE Log clean PRINTERR "Usage: r4edi cleanAleLog.x4" & " [-t days] [-c cachefile] [-l logfile] [-V] [-?] [-d]\n" & " V - show version number\n" & " ? - show this help\n" & " d - enable debug output\n" & " t - Days to keep (default 28 days)\n" & " c - XIB TID management file. Default $CORE_DATA/ale/tid.cache\n" & " l - RFC TID management file. Default $CORE_DATA/ale/tid.log\n";
XIB: SAP/R/3 Manual Index 162
INDEX A
ABAP/4.....................................................32 activation type .........................................105 activity
receive ...................................................41 send .......................................................41
ADF file creating an .............................................27
ALE...........................................................10 configuration .......................................114
ALE Gateway Object ................................47 ALE inbound search
ALE tab .................................................81 ALE logon object ......................................49
General tab ............................................49 preferences tab ......................................49
ALE Manager concept ..................................................39 retrieve and receive methods.................55 send methods................................... 47, 60
ALE methods, creating..............................39 ALE node object .......................................52
General tab ............................................52 ALE objects
creating..................................................47 ALE outbound search
ALE tab .................................................84 ALE receive method .................................58
ALE tab .................................................59 concept ..................................................39 creating..................................................55 General tab ............................................58 lack criteria............................................59 private....................................................55 public.....................................................55
ALE Received IDoc Data tab ........................................89 Parameters tab .......................................87 Properties tab.........................................86 Transfer Data tab...................................89 Transfer message tab.............................87
ALE retrieve method.................................55 ALE tab .................................................57 concept ..................................................39 creating..................................................55 execution ...............................................40 General tab ............................................55 Schedule tab ..........................................56
ALE send method......................................60 ALE tab .................................................63 concept ..................................................39 creating..................................................60 execution ...............................................40 General tab ............................................60
private........................................47, 60, 76 public.........................................47, 60, 76 Retry tab ................................................61 Schedule tab ..........................................62
ALE send tab, Data sent successfully........93 ALE status tab, Status update completed
successfully ...........................................95 ALE status update method ........................76
ALE tab .................................................79 creating..................................................75 General tab ............................................76 Retry tab ................................................77 Schedule tab ..........................................78
ALE tab ALE receive method..............................59 ALE retrieve method.............................57 ALE send method..................................63 ALE status update method ....................79 search ALE outbound search.................84 search ALE send events ........................82
ALE tasks creating..................................................39
ALE tasks, creating ...................................43 ALE transfer adapter task..........................43
Configuration tab...................................44 General tab ............................................43 Start Up tab ...........................................45 Transfer Adapter tab..............................44
ALE transfer classifier task .......................46 ALE.CreateParameter .............................124 ALE.FreeParameter.................................125 ALE.GetParameter ..................................126 ALE.ItAppLine .......................................127 ALE.ItCreate ...........................................128 ALE.ItDelete ...........................................129 ALE.ItFill ................................................130 ALE.ItFree ..............................................131 ALE.ItGetLine.........................................132 ALE.RfcCallReceive...............................133 ALE.RfcClose .........................................135 ALE.RfcCreateTransId............................136 ALE.RfcError..........................................137 ALE.RfcIndirectCall ...............................138 ALE.RfcOpenOutboundConnection .......140 ALE.SetParameter...................................142 ALE.Version ...........................................143 Application Link Enabling ........................10 attributes
concept ................................................101 receive .................................................101 send .....................................................102
B
BAPI arguments ..............................................29
XIB: SAP/R/3 Manual Index 163
business object ......................................31 method...................................................31 parameter...............................................31 parameter type.......................................31 synchronous call to..............................158
BAPIs.................................................. 11, 29 Batch Data Control (BDC)........................36 batch input.................................................36 BDC ................. Refer to Batch Data Control BDCTABLE..............................................36 business object ..........................................31 business object in SAP..............................29
C
classification activity.................................64 Configuration tab ..................................65 General tab ............................................65
classification configuration IDoc, EDI tab ........................................66 Sender, Receiver tab..............................68
client number........................... 17, 50, 94, 96 configuration
general...................................................39 Configuration tab
classification activity.............................65 stage dialog ...........................................75
Configuration tab, ALE transfer adapter task...............................................................44
connection type .......................................105 control value, overriding .........................101 conversions
data ........................................................33 criteria, lacking in ALE receive methods..59 criteria, lacking in FTP receive methods...41 custom MCB .............................................72
D
data classifier.............................................64 data conversions ........................................33 data element ..............................................26 Data sent successfully
ALE send tab.........................................93 Properties tab.........................................91 Transfer report tab.................................92
data structure .............................................26 Data tab, IDoc Document Number............97 dev_rfc file .......................................... 50, 58 display IDoc types........................... 110, 112 DNS name ............................... 16, 53, 93, 96 drill down options ...................................117
E
event type ALE Received .......................................86 AleStatusReport ....................................94 SampleIDocStatus .................................99
events, searching for..................................81
export parameters ......................................32
F
function PackSendMethodOverrideAttribute ....103
function group name..................................33 function module
metadata ................................................34 naming convention ................................29
function modules .................................11, 32 export parameters ..................................32 import parameters..................................32 tables .....................................................32
function name............................................33
G
gateway .....................................................16 host ................................ 88, 89, 94, 96, 97 monitoring ...........................................115 SAP .......................................................48 service .......................................48, 94, 96
Gateway Object .........................................47 General tab ............................................47
General tab ALE logon object ..................................49 ALE node object....................................52 ALE receive method..............................58 ALE retrieve method.............................55 ALE send method..................................60 ALE status update method ....................76 ALE transfer adapter task......................43 classification activity.............................65 Gateway Object .....................................47 sequential activity..................................73
group .........................................................26
I
IDoc subsystem ..............................................10
IDoc Classifier ..........................................64 IDoc Classifier tab
search IDoc data classifier events..........85 IDoc data classifier events
IDoc Classifier.......................................85 search.....................................................85
IDoc data structure ....................................26 IDoc Data tab, ALE Received...................89 IDoc definitions.......................................115 IDoc Document Number
Data tab .................................................97 Properties tab.........................................97
IDoc packet ...............................................26 IDoc packets..............................................27 IDoc report ..........................................14, 21
from XIB client .....................................23 from XIB server ....................................24 generating and downloading .................22
XIB: SAP/R/3 Manual Index 164
generating from SAP...........................119 icon........................................................23
IDoc status...............................................117 IDoc status update ............................... 58, 88
display ...................................................94 IDoc types
displaying .................................... 110, 112 IDoc version..............................................21 IDoc, EDI tab
classification configuration ...................66 IDOCreports/import
directory ................................................22 import parameters......................................32 inbound parameters option ......................112 inbound parameters screen ......................112 inbound transfers
monitoring...........................................116 Integration Manager, concept....................39 intermediate documents .......... Refer to IDoc
L
language code.......................... 17, 50, 94, 97 log entries..................................................42 logical destination ...................................107 logon
to SAP system .......................................15
M
MBC custom .................................................101
message attributes ...................................101 Message Builder programs
to access BAPIs, function modules, and SAP transactions ...............................11
Message Log concept ..................................................39 display asynchronous IDoc status update
creator events ....................................99 display IDoc data classifier event..........97 display retrieve events...........................86 display send events.......................... 91, 94 log entries..............................................42 search IDoc data classifier events .........85 search receive events.............................81 search send events ........................... 82, 83
metadata in IDoc report ........................................14 levels of .................................................26
metadata types...........................................17 method.......................................................31
ALE receive ..........................................58 ALE retrieve..........................................55 ALE send...............................................60 ALE status update .................................76
mode version ....................................... 63, 80 monitoring
gateways..............................................115
inbound transfers .................................116 outbound transfers ...............................116
N
node object ................................................52
O
OFTP methods ..........................................41 outbound parameters option ....................110 outbound parameters screen ....................110 outgoing transfers
monitoring ...........................................116
P
PackSendMethodOverrideAttribute function.............................................................103
parameter...................................................31 metadata ................................................34
parameter type...........................................31 Parameters tab, ALE Received..................87 partner profile..........................................108 partner profiles
maintaining..........................................115 password..................................17, 50, 94, 97 port
SAP .....................................................106 port definition..........................106, 107, 113 port definitions
maintaining..........................................115 preferences tab, ALE logon object ............49 private receive method ..............................55 private send method ......................47, 60, 76 program ID..........................................58, 88 Properties tab
ALE Received .......................................86 Data sent successfully ...........................91 IDoc Document Number .......................97 Sample asynchronous IDoc status update
...........................................................99 Status update completed successfully ...94
public receive method ...............................55 public send method........................47, 60, 76
R
receive activity concept ..................................................39 execution .........................................40, 41
receive attributes, ReceiveInfoAttribute..101 receive events
search.....................................................81 receive method
creating..................................................55 execution ...............................................40 private....................................................55 public.....................................................55
ReceiveInfoAttribute receive attribute ....101 record, defined...........................................26
XIB: SAP/R/3 Manual Index 165
Remote Function Calls ..............................10 remote SAP host...................... 16, 53, 93, 96 remote SAP system ................. 53, 88, 93, 96 re-processing options ..............................116 retrieve events
display ...................................................86 retrieve method.................................... 40, 55 retry
in ALE status update method ................77 retry definition
general...................................................41 in ALE send method..............................61
Retry tab, ALE send method .....................61 Retry tab, ALE status update method........77 RFC.............. Refer to Remote Function Call RFC destination.........................................58
descriptive name..................................105 RFC destinations .....................................104
maintaining..........................................115 RFC layer ..... Refer to Remote Function Call RFC trace ..................................................50
S
Sample asynchronous IDoc status update Properties tab.........................................99 SampleIDocStatus tab .........................100
SampleIDocStatus tab, Sample asynchronous IDoc status update ........100
SAP configuration .......................................104 IDoc subsystem .....................................10 logical system......................................107 menu options .......................................114 partner profile......................................108 ports.....................................................106 program ID...................................... 58, 88 user login name ............................... 17, 50
SAP ALE subsystem.................................11 SAP function module
synchronous call to.......................... 8, 158 SAP host
system number .................... 16, 53, 93, 96 SAP IDoc report
icon........................................................23 SAP interface technology..........................12 SAP system
logon .....................................................15 remote.................................. 53, 88, 93, 96
SAP transaction metadata ................................................37 transaction code.....................................36
SAP transactions .......................................11 SAP tTransactions.....................................36 SAP Workflow..........................................11 SAPABAP.InstallAndRun ......................144 SAPCONVERT. IntegerToInt4Buffer ....148
SAPCONVERT.FloatToPackedDecimalBuffer ........................................................146
SAPCONVERT.Int4BufferToInteger .....147 SAPCONVERT.PackedDecimalBufferToFl
oat........................................................149 SAPLIB.GetNodeInfo .............................150 SAPLIB.GetSystemInfo..........................152 SAPLIB.OpenConnection .......................151 SAPLIB.ReadTagFile .............................153 SAPLIB.SetDebug ..................................154 SAPUTIL.GetTableData .........................157 SAPUTIL.ReadTable ..............................155 schedule definition
general ...................................................40 in ALE retrieve method.........................56 in ALE send method..............................62 in ALE status update method ................78
Schedule tab ALE retrieve method.............................56 ALE send method..................................62 ALE status update method ....................78
search ALE send events ALE tab .................................................82
send activity concept ............................................39, 40 execution .........................................40, 41
send attributes..........................................102 send events
display .......................................91, 97, 99 search...............................................82, 83
send method creating..................................................60 execution ...............................................40 private........................................47, 60, 76 public.........................................47, 60, 76
Sender, Receiver tab classification configuration ...................68
sequential activity General tab ............................................73 Stages tab ..............................................73
stage dialog................................................74 Configuration tab...................................75 General tab ............................................74
Stages tab, sequential activity ...................73 Start Up tab, ALE transfer adapter task.....45 Status update completed successfully
ALE status.............................................95 Properties tab.........................................94 Transfer report tab.................................95
synchronous call to BAPI................................................158 to SAP function module ..................8, 158
synchronous call to a SAP Function Module example .................................................33
synchronous dialog with SAP ...............................................32
system number ........................16, 53, 93, 96
XIB: SAP/R/3 Manual Index 166
T
tables .........................................................32 Task Manager, concept .............................39 tasks
ALE transfer adapter .............................43 ALE transfer classifier ..........................46
tasks, creating............................................43 TCP/IP host name, or .............. 16, 53, 93, 96 trace.........................................................105 transaction code
of SAP transaction.................................36 transactional RFC....................................115
transactional RFC option.........................106 Transfer Adapter tab, ALE transfer adapter
task ........................................................44 Transfer Data tab, ALE Received .............89 Transfer message tab, ALE Received .......87 Transfer report tab, Data sent successfully92 Transfer report tab, Status update completed
successfully ...........................................95 transferring data between SAP and XIB .....9
U
UnpackReceiveAttribute .........................101 UnpackReceiveAttribute function ...........101