Enterprise Administration > Implementing Windchill ESI > Implementing Windchill ESI in an SAP Environment > Understanding Windchill ESI Architecture > Supporting Multiple SAP Instances
  
Supporting Multiple SAP Instances
Windchill ESI supports the publishing of data to distribution targets belonging to multiple ERP instances. By generating one Windchill ESI response message per ERP instance, the published data is routed by the EAI software components to the relevant distribution targets.Windchill ESI services places response messages on multiple TIBCO EMS queues. Each response message caters to an ERP instance. As well, multiple EAR applications deployed in TIBCO middleware use these messages for publishing data to the relevant distribution targets. Therefore, each application subscribes to a unique EMS queue, and is configured to connect to one ERP instance. The following diagram provides an overview of the desired objective:
Windchill ESI Services and TIBCO EMS Queues
The name of a given EMS queue is composed of two parts. The first part is determined by the value of theWindchill ESI preference named Data Response Queue Name. The second part is determined by the specifics for a given ERP instance. When publishing to an SAP instance, you must provide the system ID and name of the associated client. The queue name takes the following form:
<Value of the preference>.<System ID>.<Client>.
The specifics of the ERP instance (system ID and client in this case) are obtained from the distribution target attributes stored in the ESITarget object in Windchill. Also obtained from the distribution target is the attribute Task Uniform Resource Identifier. The Task Uniform Resource Identifier holds the name of the I*E task that Windchill ESI services invoke for placing a response message on the relevant EMS queue. Out of the box, this attribute has the value com/ptc/windchill/esi/export/ExportToJMSQueue.xml which is a path relative to the <Windchill>/tasks folder.
* 
TheWindchill ESI preference Data Response Queue Name is set to the value com.ptc.windchill.esi DataResponse out of the box. The I*E task in ExportToJMSQueue.xml fetches the relevant queue name by appending the specifics of the ERP instance to this value.
The values input by you for the fields SAP System ID and SAP Client that appear in the SAP ERP Properties window of the MICU (Middleware Installation and Configuration Utility), must match the values specified for the attributes System ID and Client corresponding to the distribution target object in Windchill. If theWindchill ESI preference Data Response Queue Name has a value other than the default, the value for the field Queue name for ESI EMS Data Response of the ESI EMS Queues window should be changed appropriately.
With reference to the architecture diagram, the queue name com.ptc.windchill.esi.DataResponse.PTC_BL_PROD.800, uses the default value for the Windchill ESI preference, a value of PTC_BL_PROD for System ID and a value of 800 for Client.
TIBCO EAR Applications
The MICU allows you to deploy out of the box EAR applications for multiple ERP instances. Each deployment contains a process archive service consisting of business logic executed by the BW engine, and an SAP adapter archive service consisting of BAPI/RFC configurations and connections to SAP. The process archive for deployment subscribes to an EMS queue whose name is based on the TIBCO global variable ESIJMS/DataResponseQueue. This global variable is populated by the MICU using the value given by the user for the relevant field in the SAP ERP Properties window.
The process archive service is closely tied to the adapter archive service. This is achieved by using a unique subject name that is passed by the process engine to the adapter. The subject name has the following form:
%%Domain%%.%%Deployment%%.%%ESISAPAdapter/SystemID%%%%ESISAPAdapter/
Client%%.%%ESISAPAdapter/Locale%%.<<ERP API Service Name>>
* 
In the above name, anything that is enclosed within “%%” characters is a global variable name. The value of the global variable will be used to generate the subject name. The meanings of the various elements that make up the subject name are as follows:
Domain is the name of the domain in which the TIBCO project (or repository) resides. This is automatically set by TIBCO BusinessWorks when a project is created or deployed.
Deployment is the name of the project, automatically set by TIBCO BusinessWorks.
ESISAPAdapter/SystemID is an optional element in the name and has an empty value out of the box.
ESISAPAdapter/Client is a mandatory element and is used for establishing a connection with the SAP system.
ESISAPAdapter/Locale is a mandatory element used by the business logic for fetching the message text from a message code using cross referencing.
For example, an adapter service configured for creating a part in the ERP system using the deployed application "SAP-1" with a locale of "English (United States)" may use the following subject name:
ESIPTCDomain.SAP-1.800.en_US.BAPI_MATERIAL_SAVEREPLICAServer
The, the above listed example, uses ESIPTCDomain for the TIBCO Administrator domain name, "SAP-1" for the deployment name, a blank value, "800" and "en_US" for the global variables ESISAPAdapter/SystemID, ESISAPAdapter/Client and ESISAPAdapter/Locale respectively, and BAPI_MATERIAL_SAVEREPLICAServer for the ERP API Service Name.
The deployment name, for example,"SAP-1," is unique across a given TIBCO Administrator domain. Each deployed application requires the following ERP connection parameters:
ESISAPAdapter/ApplicationServer
ESISAPAdapter/SystemNumber
ESISAPAdapter/Client
ESISAPAdapter/UserName
ESISAPAdapter/Password
Although the MICU prompts the user for the field "SAP System ID", the input value is only used for creating an EMS queue with the appropriate name. It is not used for establishing a connection with the SAP system.