webMethods workshop – Day 4
Ravindran V ,Badrinath P
EAI and Middleware
July 2005
EAI and Middleware
Course Agenda – Day 4
EDI Processing
- What is EDI?
- EDI B2B Landscape
- Sample EDI
- EDI Structural details
- webMethods EDI Components
- EDI Implementation Case Study
• Inbound Scenario
• Outbound Scenario
SAP Adapter
- What is SAP?
• Core SAP functionalities
• SAP Connectivity (RFC/BAPI and IDOC interfaces)
- Understanding webMethods SAP Adapter
• Feature points
• Architecture Overview
• Installing SAP Adapter
- Implementation Process
• Choice of Implementation BAPI/RFC over IDOC/ALE
• Implementation Advantage using BAPI over RFC
• Sample Scenario- Purchase Order Creation
Assignment
2
EDI
Ravindran.V
July 2005
EAI and Middleware
Electronic Data Interchange (EDI)
EDI - Standard for electronic document exchange between partners
EDI Standards :
- ANSI X12 – US Standard
- UN/EDIFACT – International Standard
- EANCOM,
- TRADACOM
ANSIX12 AND UN/EDIFACT are the popular ones.
Each EDI standard has multiple versions with in them.
E.g ANSI has 20 version starting from 2000 to 4060 being the latest
4
EAI and Middleware
EDI Landscape
5
EAI and Middleware
VAN
VAN (Value Added Network): Acts as a intermediary service provider to
facilitate:
• Routing of EDI data between partners
• Provides store and forward facility, Vendor systems are not required to be online
always, Vendor systems can retrieve the EDI data addressed to them from their
respective mailboxes
• Provides daily summary reports of the EDI data transactions
6
EAI and Middleware
Sample EDI Structure
ISA*00* *00* *08*9251750000 *08*1234567890 *030627*1304*U*00401*000001403*0*P*>~
GS*PO*8019721193*1234567890*20030627*1304*1403*X*004010VICS~
ST*850*01403001~
BEG*00*SA*548177**20030627~
REF*AN*547794~
PER*BD*JOHN JONES*TE*5552225555~
FOB*PB~
DTM*002*20030705~
DTM*118*20030704~
PKG******01~
TD5****H*OUR CR/T~
N9*AH*548177~
MSG*THIS PURCHASE ORDER IS SUBJECT TO THE SAME TERMS AND~
MSG*CONDITIONS AS SAFEWAY PURCHASE ORDER FORM 1030~
MSG*PICK-UP NO. 12345~
N1*ST*SAFEWAY INC*9*0091372092527~
N2*Tracy Produce~
N3*16900 West Schulte Road~
N4*Tracy*CA*95376~
N1*BT*SAFEWAY INC*9*0091372091700~
N2*NATIONAL SERVICES CENTER~
N3*P.O. BOX 29093~
N4*PHOENIX*AZ*85038~
N1*VN*BEST SUPPLIER INC.*9*1234567890000~
N3*P.O. BOX 11111~
N4*LOS ALAMITOS*CA*90001~
PO1**10*CA*12.5**UA*042040304101*IN*20403041*VN*22222~
CTP*RS*FCP*12.5~
PID*F*08***ITEM DESCRIPTION 1/10 LB~
SAC*A*B280***20.00***2.00****02~
CTT*1**120*LB~
SE*30*01403001~
GE*1*1403~
IEA*1*000001403~
7
EAI and Middleware
EDI X12 (Structure & Semantics)
8
EAI and Middleware
EDI X12 (Structure & Semantics)
9
EAI and Middleware
WebMethods EDI Components
10
EAI and Middleware
Case study- Purchase Order processing
Requirement 1: Implement the interface in the Vendor System to receive and load the EDI data to the
Vendor Oracle database.
Mapping Requirements: [Link]
VAN (Value Added Network): Acts as a intermediary service provider to facilitate:
Routing of EDI data between partners
Provides store and forward facility, Vendor systems are not required to be online always,
Vendor systems can retrieve the EDI data addressed to them from their respective mailboxes
Provides daily summary reports of the EDI data transactions
11
EAI and Middleware
Mappings - EDI 850 4010 Segments
EDI Segment description for Purchase order
Header Section
BEG PO Beginning segment
REF Reference Identification
PER Administrative Communication contact
FOB F.O.B related instructions
DTM Date / Time reference
PKG Marking. Packaging, Loading
TD5 Carrier Details
Loop ID - N9
N9 Reference Identification, Identifies using the purchase order id used as placeholder for providing the purchase order description
MSG Message Text. Contains the Purchase order description
Loop ID - N1 Holds the Information about the Buyer, Seller and Vendor
N1 Name
N2 Address Name information
N3 Address Information
N4 Geographic Location
Detail Section
PO1 Base Item Data
CTP Pricing information
PID Product item description
SAC Service Promotion allowance or charge information
Summary Section
CTT Transaction Totals
12
EAI and Middleware
Mappings - EDI 850 4010 Sample data
Header Mapping Details
BEG*00*SA*548177**20030627 [Mapping to Order id and PO date]
REF*AN*547794
PER*BD*JOHN JONES*TE*5552225555 [Mapping to Buyer Name and Telephone Number]
FOB*PB [Mapping to Delivery Type field PB- Customer Pickup / PP – Pre Paid freight]
DTM*118*20030704 [Mapping to Delivery Date CCYYMMDD]
PKG******01 [Mapping to Packaging Type ]
TD5****H*OUR CR/T [Mapping to Transport Type and Transport Description]
N9*AH*548177 [Mapping reference for enclosing the Purchase Order description has ref to
order id]
MSG*THIS PURCHASE ORDER IS SUBJECT TO THE SAME TERMS AND Mapping :
Concat all
MSG*CONDITIONS AS SAFEWAY PURCHASE ORDER FORM 1030 MSG01 for PO
MSG*PICKUP NO. E450562 Description
13
EAI and Middleware
Mappings - EDI 850 4010 Sample data
Header Mapping Details ….(Cont…) Mapping Buyer, Seller and Vendor
N1*ST*SAFEWAY INC*9*0091372092527 [Mapping to : Seller Details (ST), name,
Identification code]
N2*Tracy Produce [Mapping to : Additional Identification Name]
N3*16900 West Schulte Road [Mapping to: Address]
N4*Tracy*CA*95376 [Mapping to City, State , Zip code]
Similar mapping for Buyer and Vendor.
Buyer (BT) : N1*BT*SAFEWAY INC*9*0091372091700
Vendor (VT): N1*VN*BEST SUPPLIER INC.*9*1234567890000
14
EAI and Middleware
Mappings - EDI 850 4010 Sample data
Details Section – Line Items Mapping
PO1 repeats for every line item in the purchase order
PO1**10*CA*12.5**UA*042040304101*IN*20403041*VN*22222 [Mapping to : Quantity, UOM, Unit price,
UPC case code, Safeway item no, Vendor Item no]
CTP*RS*FCP*12.5 [Mapping to : Trade Type RS- Resale]
PID*F*08***ITEM DESCRIPTION 1/10 LB [Mapping to : Item Description]
SAC*A*B280***20.00***2.00****02 – [Mapping : Allowance Details Not mapped]
15
EAI and Middleware
Mappings - EDI 850 4010 Sample data
Summary Section – Mapping
Consolidates the data from all the line items PO1 segment
CTT*1**120*LB [Mapping : Total Number of line items , Total weight of the order, Unit of measurement]
16
EAI and Middleware
Interface Implementation design
Vendor System
VAN Enabler
Partner -1
EDI Map to PO Canonical
Safeway System -2
Parser/Translator Model
Partner -3
Publish
Target system -1 Target system -2 Target system -3
17
EAI and Middleware
Arriving at a Generic Canonical Model
Details Section - Line Items
Header Section Address Details
18
EAI and Middleware
Suggestive Mapping approach
Map EDI data based on the segments
- E.g. mapPO1 takes in PO1 as input and provides line_item as output.
Advantage : Mapping are simple and easy to understand as they are atomic and very flexible for future changes.
19
EAI and Middleware
Demo Scenario Implemented in webMethods
EDI submission console. (Safeway submitting PO 850 EDI to Vendor)
- [Link]
Vendor Back end System (Receiver- Processes the Edi and logs the PO to
Oracle DB)
- [Link]
20
EAI and Middleware
Implementing Functional Acknowledgments
Functional Acknowledgment
- Report of the syntactic analysis of the transaction set, indicates if the EDI transaction
has been Accepted, Accepted with errors or Rejected
FA are implemented using EDI transaction set 997
FA are usually automated process handled by the EDI Translator/ handler
FA can be generated at various levels
- Group level (Default)
• AK1 and AK9
- Transaction set level –AK5
• AK1, AK2, AK5, AK9
- Segment level – AK3
• AK1, AK2, AK3, AK5 and AK9
- Element Level –AK4
• AK1, AK2, AK3, AK4 and AK9
21
EAI and Middleware
EDIINT
EDIINT Electronic Data Interchange-Internet Integration,” or “EDI over the Internet.”
Defines a protocol for using the Internet to securely exchange business documents (EDI,
- EDIINT AS1 (EDIINT Applicability Statement 1) uses SMTP (e-mail) to transport documents
- EDIINT AS2 (EDIINT Applicability Statement 2) uses HTTP (or HTTP/S) to transport documents
- EDIINT AS3 (EDIINT Applicability Statement 3) uses FTPS (FTP over SSL) to transport
documents
22
SAP Adapter
Badrinath.P
July 2005
EAI and Middleware
What is SAP ?
– SAP R/3 - ERP package intended as a total software solution for running large
businesses.
• PP – Production Planning
• MM – Materials Management JDEDWARDS
PEOPLESOFT 5%
• SD – Sales and Distribution 13%
SAP
ORACLE
• FI – Financial Accounting 15%
50%
SIEBEL
• CO -- Controlling 17%
• AM – Fixed Assets Management
• PS – Project Systems
• WF -- Work Flow
• IS – Industry Solutions
• HR – Human Resources
• PM -- Plant Maintenance
• QM – Quality Management
24
EAI and Middleware
SAP Connectivity
RFC – Remote Function call are used to synchronously communicate between
• Two SAP Systems or
• For communication between a SAP system and an external application
BAPI (Business API) : Programming interface/Methods for working with and
manipulating SAP Business Objects.
BAPI is implemented as Functional Module internally so every BAP has an
equivalent internally named Function Module behind.
Subset of the RFC enabled function module officially released by SAP as a part of
the Business Object repository – BOR to be called from external programs.
25
EAI and Middleware
SAP Connectivity RFC/BAPI
External programs SAP : External programs can directly call any of the
Function Module in SAP that is RFC enabled.
External SAP Server
Application
RFC RFC BAPI
Client
SAP systems External : SAP systems can call external systems a gateway
proxy (Registering an external RFC server in the SAP system as a SAP RFC
Listener) External SAP Server
Application
Note:
RFC RFC Client : One which
RFC RFC
Client makes the request
RFC Server: One which
RFC receives the request
Server RFC
(Listener)
26
EAI and Middleware
SAP Connectivity
IDOC – Intermediate Document : Standard SAP Data format for exchange of
document between different R3 Systems and External Systems.
IDOC contains Header and data segments and similar in structure to EDI formats.
Transaction based on tRFC (Transactional RFC)
ALE – Application Link Enabling Proprietary message based routing and transport
mechanism.
Ability to represent logical system both SAP and External system
Define routing rules for sellers /buyers and message types
Note: RFC/BAPI use Synchronous Mode
IDOC/ALE use Asynchronous mode.
27
EAI and Middleware
SAP Connectivity
ALE/IDOC Communication
External SAP Server
Application
RFC
Server IDOC
tRFC
(Listener)
ALE Routing
28
EAI and Middleware
Understanding webMethods SAP Adapter 4.6
Features
Executes SAP’s Independent BAPI Methods as specified in BOR(Business Object
Repository).
Executes SAP’s remote Function Calls (RFC) irrespective of the SAP Datatypes.
Call SAP adapter services from SAP System.
Route Business Documents(IDOC) based on routing rules using partner Manager.
Real-time Integration.
High level Services to process SAP IDOC’s & BAPI’s.
29
EAI and Middleware
webMethods SAP Adapter – Components
Invoking Business Logic
- RFC Server (Listener)- Listens to incoming request from SAP Server
- RFC Client- Sends request to execute BAPI/RFC.
- tRFC – transport mechanism for IDOC
Message Routing Logic
- Partner Manager : receives & routes messages using routing rules defined
- Message Store : Used by Transactional manager to track IDOCs(tRFC) routed to &
from the SAP system.
30
EAI and Middleware
webMethods SAP Adapter -Architecture OverView
31
EAI and Middleware
webMethods SAP Adapter- Extended Partner Integration
Architecture
32
EAI and Middleware
webMethods SAP Adapter Installation Tips
Install wm SAP Adapter as per installation Guide.
Copy [Link] from lib folder of the SAP Adapter to the <winnt>/system32 folder
for windows installation.
The different platforms use the following libraries:
- • Windows uses [Link]
- • Solaris uses [Link]
- • AIX uses librfccm.o
- • HPUX uses [Link]
The lib file versions should be the same as in the SAP adapter package.
SAP Adapter uses SAP JCO Java Connector.
33
EAI and Middleware
Implementation Process
Choice of Implementation BAPI/RFC over IDOC/ALE
BAPI/RFC IDOC/ALE
Synchronous/Real Time Mode Asynchronous/Batch Mode
NA Built-in queue & queue manager
function
Smaller Transactions. Large transaction
Volumes( Background processing)
No mechanism to ensure exact once The tRFC ensures specific transaction
processing exactly once in RFC Server System.
Customizing is easier Custom IDOC most difficult.
Monitoring function not available Simple Error handling & monitoring
function
NA If SAP uses EDI Gateway, iDOC
integration is preferred.
34
EAI and Middleware
Implementation Process
Implementation Advantage using BAPI over RFC
• Provides a stable and object oriented view of the R3/applications
• Stay consistent over various R/3 releases
• Can be accessed using standard program languages C++ and Java
• No ABAP programming knowledge required.
Note: When a BAPI is available , BAPI should be used and not the Function Module
35
EAI and Middleware
Implementation Process
Prime Requirement
- SAP System Administrator.
- Functional Analyst
- Developer
SAP Users
- Dialog User: SAP GUI user.
- Background User: SAP Backgroud job, no access to GUI.
- CPIC User: Communicate with SAP using CPIC.
webMethods SAP Adapter can operate both as Dialog user(RFC logging)/ CPIC user
based on requirement.
Ports Used by SAP
32xx - Dialog port
33xx- Gateway port
36xx- Message port xx- SAP SystemsNumber
- Inbound RFC Ports used - 32xx
- Outbound RFC Ports Used - 32xx & 33xx
- In Addition for load balancing 32xx & 36xx will be used.
36
EAI and Middleware
Implementation Process
SAP Transactions
SAP Txn Description
SM59 Maintain RFC destination. SM59 allows you to
create/display/change/delete the RFC destination information.
SM58 tRFC monitoring – SAP persists all tRFC transactions. SM58 is used to
monitor the tRFC status and re-execute the failed transactions.
SU53 Authorization Check –Run SU53 after to determine exactly which
authorization object the transaction failed on.
WE02 IDoc Monitor – Monitors all inbound/outbound IDoc [Link] status is
‘03’ – ‘Deliver to port ok’, use SM58 to check if the IDoc has reached its
destination.
ST11 View SAP log files
WE60 Generates a DTD from an IDOC (including extensions) – Select the IDoc
type.
37
EAI and Middleware
Implementation Scenario for Inbound process to SAP
Purchase Order Creation
Scenario Description: Purchase Orders are created in Ariba and the same are to
be synchronized in SAP system by invoking the BAPI
Steps in the implementing the Purchase Order Creation Interface
1. SAP Settings/Configurations:
1.1. Create SAP server
1.2. Look up BAPI using Function Module and create the Outbound Map (Outbound
WebMethods to SAP) SAP BC calling SAP.
2. Create a service and the corresponding trigger to subscribes to the PO Canonical
3. Create Outbound Map Invoke the BAPI : Z_BAPI_PO_CREATE from the flow service
using the service specified in configuration step
38
EAI and Middleware
Implementation Scenario for Outbound process from SAP
Goods Receipt
Scenario Description: Goods receipt are generated in SAP system as IDOCS which are to be
processed and sent out as XML to the receiving External System webMethods
SAP R/3
Integration Server
Message
Sender Port Type
WMPRP2P1
(RFC Dest. Partner processGood
RP1100PR ZMMBID
Manager sReceipt
WMPR120P2
P1) Message
Store
Steps in the implementing the Goods Receipt Interface
1. SAP Settings/Configurations:
External System
1.1. Partner manager is used for routing the SAP IDOCs to the B2B service External System
1.2. Create SAP server and the SAP Listener
1.3. Create the Routing rule for the ZMMBID message type
1.3.1. Specify the Sender, Receiver and Message type
1.3.2. Specify transport (e.g. B2B Service)
1.3.3. Specify the flow service to be invoked
2. Flow service (processGoodsReceipt) receives the IDOC and converts to XML and sent to external system
39
EAI and Middleware
Assignment – Day 4
Implement the EDI 850 Inbound processing
- Refer the reference package : POProcessing Package
EDI Outbound processing for reference. (SW_POOutbound Package)
EDI Sample Standard Guide for 850 Refer [Link]
EDI Test [Link] for the EDI test data
EDI Inbound EDI Outbound SQL Tables EDI Test Data
40