Skip to main content

Migrating the MQSeries Link for R3 to the WebSphere Message Broker Adapter Nodes for SAP

Cyril Stewart (stewartc@uk.ibm.com), IT Specialist, WebSphere Message Broker and WebSphere MQ, IBM
Cyril P. Stewart is a WebSphere Message Broker and WebSphere MQ Specialist, and has worked as a Tester, Developer, Consultant, and Service Specialist. You can contact Cyril at stewartc@uk.ibm.com.

Summary:  This article shows you how to migrate from the R3Link Adapters for SAP to the WebSphere Message Broker V6.1 Adapter Nodes for SAP. The article also describes various migration issues and proposes solutions for them.

Date:  13 Aug 2008
Level:  Intermediate
Activity:  763 views

Introduction

With the addition of new adapter support in IBM® WebSphere® Message Broker V6.1 (hereafter called Message Broker), you can communicate a with a SAP system using the embedded WebSphere Adapter for SAP. This new function offers a number of advantages, including ease of operation and improved performance, and is now the the recommended solution over MQSeries Link for R3. Along with these benefits, there are some migration issues that require attention when moving from an architecture that uses the R3Link to a one that uses the WebSphere Message Broker Adapter Nodes. These issues are covered in this article. As part of the migration, you will need to create new artifacts to use in Message Broker. Doing this is not difficult and this article shows you how.

The R3Link was used in a number of different ways. Migration for the most common usage scenarios is covered in this article and the cases are listed here and shown in Figure 1 below:

  1. Sending IDocs from SAP via the R3Link to a Message Broker message flow
  2. Sending IDocs from SAP via the R3Link to an application
  3. Sending IDocs from a Message Broker flow via the R3Link to SAP
  4. Sending IDocs from an application via the R3Link to SAP

Figure 1. R3Link migration scenarios
Figure 1

The R3Link can be used to send and receive IDocs between SAP and an application. In this migration case, the target application will produce and consume messages in the format of the R3Link. If this application is to continue to send and receive messages as formatted by the R3Link, an intermediary is needed to convert messages in both directions. Message Broker can fulfill that role, as explained later in the article. This migration assumes:

  • You have a working R3Link installation (including SAP).
  • You have access to the R3Link configuration files.
  • You have some knowledge of the R3Link.
  • You have some knowledge of SAP.
  • You have a SAP logon.
  • You have a working Message Broker installation.
  • You have some knowledge of developing Message Broker message flows.

This article shows you how to migrate off the R3Link, which is replaced with a message flow with a SAP adapter node. In Migration Scenarios #1 (SAP to Message Broker) and #3 (Message Broker to SAP), there is an existing message flow. In these cases, the message flow has to be migrated and then altered to use the new adaptor nodes for SAP. In Migration Scenarios #2 (SAP to an application) and #4 (application to SAP), there is no existing message flow, so it is more accurate to say that you are building a new message flow to replace the functionality of the R3Link. This article has five parts:

  • Configuring the adaptor connection
  • Creating a new message flow
  • Migrating an existing message flow
  • Changing SAP settings
  • Deploying the flow

The sections "Configuring the adapter," "Changing SAP settings," and "Deploying the flow" are common and must be completed for all migration cases. The section "Creating a new message flow" is applicable to Migration Scenarios #2 and # 4. The section "Migrating an existing message flow" relates to Migration Scenarios #1 and #3.

Configuring the adaptor connection

In all migration cases, the first step is to configure the adapter connection, because in all cases you need communication with SAP. Use the Adapter Connect wizard in the Message Broker toolkit, as described below:

When you first open the Message Broker toolkit, you are asked to select a workspace:


Figure 2. Workspace launch screen
Figure 2

This screen is where you save your projects. To accept the default location, click OK. If this is the first time you have used this workspace, you will see the welcome screen. To close it, click Go to the Message Broker Toolkit:


Figure 3. Go to the Message Broker Toolkit button
Figure 3

To return to the Welcome screen, click Help => Welcome. If you have not used the Message Broker toolkit before, it is worth exploring the links off this screen at some point.

You can now start configuring the adapter. To create and configure the adapter node, start the Adapter Connection wizard: click Start from adapter connection in the broker development view of the Broker Application Development perspective, as shown in Figure 4 below. If Start from adapter connection is not visible, click the button next to Active Working Set. You can also start the wizard by clicking File => New => Adapter Connection.


Figure 4. Broker development view
Figure 4

You will see the Adapter Connection Wizard window. Select IBM WebSphere Adapter for SAP Software transaction support (IBM: 6.1) and click Next:


Figure 5. Adapter selection
Figure 5

The next screen is the Connector Import, where you set the connector project name. Change it to a meaningful name, such as one including the name of your SAP system, and click Next. Fill in information about the JAR and library files. For more information, see Adding external software dependencies for SAP in the Information centre.

The steps you have taken to this point only need to be completed once to set up the connect project. The following steps must be completed for each new SAP adapter you create. You will need one adapter for each instance of the R3Link. You should now see the Adaptor Style window. In this case we are migrating a flow that processes information that originated from SAP, which is called an inbound flow. Click Next.

If you are migrating an R3Link that sends IDocs to SAP, then select Outbound. Follow the remaining steps. Any deviation for the outbound IDoc process will be highlighted.

In the R3Link world, the direction was relative to SAP, so data that was sent from SAP was called outbound. With the WebSphere Message Broker V6.1 Adapter for SAP (hereafter called the Message Broker Adapter for SAP), the direction is relative to the broker, so in this case it is called inbound. You can find the values for the Configure Setting for Discovery Agent in the R3Link smqDestConf file. Here is an example of a smqDestConf file:


Example 1. smqDestConf file
receivingdestination
receivingpartner=ORDERS0
edi_mestype=MATMAS
outboundqueuemanager=V61QM
outboundqueue=R3LINK_O
calluserexit=no
exitname=
exitbuffer=
client=001
language=E 
hostname=1.1.1.1 
systemnumber=00 
userid=anID 
password=aPassword 
default=yes

The required values are in bold. The outboundqueue name will be needed when the flow is developed. Change SAP interface name to ALE pass-through IDoc. Your screen should look like this:


Figure 6. Configure setting for discovery agent window
Figure 6

The next screen is the IDoc Discovery window . To set a filter, click the Filter button (make sure you have first clicked Discover IDoc From System):


Figure 7. Object discovery window, before discovery
Figure 7

In this case you are looking for a MATMAS05 IDoc, so you set the filter:


Figure 8. Object discovery filter window
Figure 8

Once it is discovered, select it. Click Add selected objects to be imported to move the IDoc into the Object to be Imported" window, and then click Next:


Figure 9. Object discovery window, after discovery
Figure 9

At the Configure Objects screen, click Next. If you are configuring an outbound adapter, a window will pop up before moving to the next screen. Click OK. The next screen will show the business object namespace. Copy the namespace, because you will need it when you write the message flow. Click OK.

In the Publishing Object Configuration Properties screen, you must enter the RFC program ID and password. The RFC program ID is in the R3Link out.ini file, and is called programid. To set the password, click Advanced, which will display additional properties. Scroll down until you find the password property and set it to the required password:


Figure 10. Advanced button, on the Publishing Object Configuration Properties screen
Figure 10

At the next screen, change the name of the message flow project, message set project, and message set. Enter a name for the Adapter component. The name will appear in the adapter properties. Pick a name that differentiates this adapter from all others. For example, you could use a standard like <SAP transaction>_<direction (o or i)>. This example uses MATMAS05_i_R3Link_migration. R3Link_migration is added to the name to make the function of the adapter clear:


Figure 11. Publish Properties Window
Figure 11

You can now click Finish on the Adapter Connection Wizard. When you see a Tip window, click OK. This completes the adapter configuration. The next step is message flow development.

Creating a new message flow

In the case where you sent IDocs from SAP to an application over the R3Link or received them into SAP from an application over the R3Link, a message flow must be built to facilitate this communication, as the R3Link will not longer be able to do this. The R3Link produces messages with the structure shown in Figure 12:


Figure 12. The structure of an R3Link message
Figure 12

This section assumes that the target application sends and receives the messages, in the above structure. In this migration case, you must ensure that the message flow produces or receives messages with the same structure. Depending on the direction of the communication, one or both different message flow types will be needed. If you already have a message flow that processes R3link messages, you should see the next section "Migrating an existing message flow."

Creating a new inbound message flow

An inbound message flow will be needed when receiving IDocs from SAP and forwarding them to an application that expects to receive data in R3Link format.

The first step is to open the message flow. If you have followed the steps earlier, you will have a message flow and message set project. Open the message flow by expanding the plus sign next to the message set. In the example it is MATMAS05_i_R3Link_migration => Flow => default broker schema. Double-click on the flow name -- for example, MATMAS05_i_R3Link_migrationFlow.msgflow:


Figure 13. The hierarchy of a message flow and message set
Figure 13

The message flow canvas will be displayed. Drag the adapter to the canvas. To find the adapter, expanding MATMAS05_i_R3Link_migrationMessageSet => Adapters => Inbound => SAP, as shown in Figure 13. You will see two nodes: the node on the left is the adapter and the node to the right is a subflow, which should be deleted, as it does not provide the functionality you need. Add a subflow called Add_SAP_Header to the canvas (to find out how to import the subflow, see Appendix B: Importing Add_SAP_Header_Project_Interchange_file.zip). This subflow takes the message from the adapter and transforms it to the same structure as the R3Link message. You also need to add an MQOutput node, which can be found on the palette next to the canvas:


Figure 14. Node selection palette
Figure 14

Connect the output terminal from the adapter to the input terminal of the subflow Add_SAP_Header and the output terminal from Add_SAP_Header to the input terminal of the MQInput node. The flow should look like this:


Figure 15. An example of an inbound message flow
Figure 15

Click on the node Add_SAP_Header and select Properties. Below the canvas, you will see the properties of this node:


Figure 16. The properties of the Add_SAP_Header sub flow
Figure 16

You can fill in the values according to the smqDestConf file. Right-click on MQOutput node and select Properties. Under Properties tab => Basic, enter the output queue and, if needed, a queue manager. Take the values for the queue and queue manager names from the smqDestConf file. (These properties are optional.)

In the smqDestConf file, the outboundqueue name is R3LINK_O. However, in the flow, the name has been changed to R3LINK_I in order done to make the naming standard consistent, as shown in Figure 17 below, O means outbound, receiving from SAP, and I means inbound, sending to SAP. This means that the target application must be changed to process the messages off the queue named R3LINK_I instead of R3LINK_O. This change reduces confusion when troubleshooting problems.


Figure 17. The basic properties of the MQ input node
Figure 17

You can now save the flow. It is ready to be deployed, but before you do so, go to the section Changing SAP setting.

Creating a new outbound message flow

An outbound message flow is needed when forwarding IDocs to SAP for an application that expects data in R3Link format. The first step is to open the message flow. If you followed the steps earlier, you will have a message flow and message set project. Open the message flow by expanding the plus sign next to the message set. In this case that is MATMAS05_o_R3Link_migration => Flow => default broker schema. Double-click on the flow name (for example, MATMAS05_o_R3Link_migrationFlow.msgflow):


Figure 18. The location of the adaptor in the Message set hierarchy
Figure 18

The message flow canvas will be displayed.

You need to add an MQInput node to your flow. It an be found on the palette in the WebSphere MQ section (next to the canvas), as shown in Figure 19 below. Drag the MQInput node onto the canvas of your flow. The message needs to be transformed from the R3Link structure to the Message Broker Adapter for SAP adapter structure, which you do with a Compute node, found on the palette in the Transformation section.


Figure 19. The location of the MQ input node
Figure 19

Drag the outbound adapter to the canvas. To find the adapter, expand MATMAS05_o_R3Link_migrationMessageSet => Adapters => Inbound => SAP, as shown in Figure 18 above.

Now you can wire up the nodes. The output terminal of the MQInput node must be connected to the input terminal of the Compute node, and the output terminal of the Compute node must be connected to the input Terminate of the adapter node. The flow should look like this:


Figure 20. The migrate outbound flow
Figure 20

Right-click on the MQInput node and select Properties. Under the Properties tab => Basic, enter the input queue, as shown in Figure 21 below. Take the value for the queue from the in.ini file. The name of the property in this file that contains the queue name is inboundqueue.


Figure 21. The Queue name property of the MQ input node
Figure 21

The domain property must also be set on the MQInput node. Click Input Message Parsing and select BLOB : For messages with an unspecified format from the domain dropdown.

In the in.ini file, the name of the queue is R3LINK_I. However in the flow, the name has been changed to R3LINK_O in order to make the naming consistent (O means outbound, sending from the broker to SAP, and I means inbound, sending from SAP to the broker). Therefore you must change the source application to send the messages to the queue named R3LINK_O instead of to R3LINK_I. Making this change reduces confusion when troubleshooting.

The message that is read off the queue R3LINK_I conforms to the structure of an R3Link message, shown in Figure 12 above. The message set that represents this message is not compatible with the WebSphere Message Broker Adapter for SAP. You must add a small amount of code to the Compute node to transform the message. Double-click on the Compute node to open up the ESQL editor, which will contain some lines of ESQL in it. In this example replace the lines:

	-- CALL CopyMessageHeaders();
	-- CALL CopyEntireMessage();

with:

	-- CALL CopyMessageHeaders();
	-- CALL CopyEntireMessage();
	

The best way to enter the code is to use code completion:

  1. Delete the lines to be replaced.
  2. Type "SET OutputRoot".
  3. Type Ctrl-Space. A window will open.
  4. Select DataObject.
  5. Click .
  6. Type Ctrl-Space.
  7. Select the SAP transaction you want (it will end in the transaction name).
  8. Type Ctrl-Space.
  9. Click .
  10. Select IdocStreamData (you could have typed the ESQL without code completion, but using code completion reduces the chance of making typos).
  11. To finish the line, type "= InputRoot.BLOB.BLOB".

The code should look like this:

   DECLARE ns NAMESPACE 'http://www.ibm.com/xmlns/prod/websphere/j2ca/sap/sapmatmas05';

   CREATE COMPUTE MODULE MATMAS05_o_R3LINKFlow_Compute
      CREATE FUNCTION Main() RETURNS BOOLEAN
      BEGIN

         SET OutputRoot.DataObject.ns:SapMatmas05.IDocStreamData = InputRoot.BLOB.BLOB;
		
         RETURN TRUE;
   END;

   CREATE PROCEDURE CopyMessageHeaders() BEGIN
      DECLARE I INTEGER 1;
      DECLARE J INTEGER;
      SET J = CARDINALITY(InputRoot.*[]);
      WHILE I < J DO
         SET OutputRoot.*[I] = InputRoot.*[I];
         SET I = I + 1;
      END WHILE;
   END;

   CREATE PROCEDURE CopyEntireMessage() BEGIN
      SET OutputRoot = InputRoot;
   END;
END MODULE;

The ESQL code could have been written without using code completion. but using it reduces the chance typos. You do not need the two procedures but it does no harm to leave them.

You can now save the flow. The flow is now ready to be deployed, but before you do so, go to the section Changing SAP setting.

Migrating an existing message flow

In the case where a message flow was already sending or receiving R3Link format messages directly from the R3Link, there will be an existing message flow that must be migrated. This section shows you how to migrate your existing message flow to use the Message Broker Adapter for SAP. It is assumed that you have:

  • Configured the Adapter
  • Imported the existing message flow and any dependent message sets into the Message Broker workspace. (This task is not covered in this article.)

The Message Broker Adapter for SAP could deliver IDocs in unparsed form or in a parsed XML form. The unparsed form is compatible with the R3Link. However, if the message flow uses the IDoc parser, then consider rewriting the message flow to use the parsed XML form of the IDoc, because the IDoc parser is deprecated.

Migrating an existing inbound message flow

An inbound message flow is a flow that receives IDocs from SAP. Here are the steps needed to migrate an existing inbound message flow. Import the message flow to be migrated into your workspace. Replace the MQInput node with the adapter, the subflow Add_SAP_Header, and a Reset Content Descriptor. See Appendix B to find out how to import Add_SAP_Header project. Figure 22 shows an example of the flow before and after migration:


Figure 22. An inbound message flow before and after migration
Figure 22

The subflow Add_SAP_Header adds an MQ SAP header to the IDoc. If required, you can populate the fields client, language, host name, user id, password, and system number in the MQ SAP header by setting the user-defined properties of the subflow. For an example, see Figure 16 above. Set the user-defined values according to the smqDestConf file. The properties of the Reset Content Descriptor must be identical to the MQInput node.

The flow is now ready to be deployed, but before you do so, go to the section Changing SAP setting.

Migrating an existing outbound message flow

An outbound message flow is a flow that sends IDocs to SAP. Here are the steps needed to migrate an existing outbound message flow. Open the message flow you imported into your Message Broker workspace. Replace the MQOutput node with a Reset Content Descriptor, followed by a Compute node, followed by the outbound adapter Request node. Figure 23 below shows a message flow that has been migrated. Whilst your message flow may not look exactly like those shown, the principle of migration is the same and similar changes need to be made.


Figure 23. An outbound message flow before and after migration
Figure 23

In most cases, the MQInput node will have the message domain set to IDOC. The Message Broker node for SAP needs the IDoc to be in the BLOB domain, so set the message domain of the Reset Content Descriptor to BLOB.

In the Compute node, you must type the ESQL (using code completion). Here is an example of the ESQL code:

DECLARE ns NAMESPACE 'http://www.ibm.com/xmlns/prod/websphere/j2ca/sap/sapmatmas05';

CREATE COMPUTE MODULE MATMAS05_o_unparsedFlow_Compute
   CREATE FUNCTION Main() RETURNS BOOLEAN
   BEGIN

      SET OutputRoot.DataObject.ns:SapMatmas05.IDocStreamData = InputRoot.BLOB.BLOB;

      RETURN TRUE;
   END;

END MODULE;

This code is for a SAP MATMAS05 transaction. If you are not using this transaction, code completion will help you to get the correct syntax. The first line is a declaration. If you use code completion, the Message Broker toolkit will generate this line for you. This line can be ignored -- in fact the only line that you need to type is the one that starts with SET, which you must type between BEGIN and RETURN TRUE in your function. This line takes the IDoc and places it in the correct part of the tree. Using code completion will help eliminate typos. After typing "DataObject" type Ctrl-Space to invoke code completion, as shown in Figure 24 below. The correct element is usually at the bottom of the code completion list -- it is the line with the SAP transaction at the end. When you find the correct entry, hit enter. The line will be added to the ESQL statement and declare the correct namespace at the top of the code.


Figure 24. Code completion window
Figure 24

Changing SAP setting

The R3Link requires a Non-Unicode setting to communicate with SAP. The Message Broker Adapter node requires a Unicode setting to communicate with SAP, so this setting must be altered. To do so, log on to SAP and run transaction SM59. Locate the RFC connection that corresponds with the programid in the out.ini file in the TCP/IP connections folder. In the MDMP & Unicode tab, select the Unicode button:


Figure 25. Setting communication type
Figure 25

Make sure your backout procedure documents the need to change the setting back to Non-Unicode.

Deploying the flow

To deploy your message flow, follow the steps in the Message Broker Toolkit help: Click Help => Search, then type "Deploying a message flow application" in the Search expression box. Under local help, click the help topic Deploying a message flow application and follow the instructions.

Conclusion

There are issues you need to consider when moving from an architecture that uses the R3Link to one that uses Message Broker:

  • Deciding the migration strategy
  • Developing a backout plan
  • Changing existing message flows
  • Creating new artifacts to use in Message Broker
  • Changing the SAP setting

These steps are not difficult, and with some planning you can have a smooth migration. This article has shown you how to migrate a single flow, and can be part of a migration strategy that will enable a smooth transition between the two architectures.

Appendix A. Troubleshooting

The flow does not deploy

First, check the event log: Double-click on the Event Log in the Domain view:


Figure 26. Locating the event log
Figure 26

The Event log has a historical view of messages relating to interaction between the configuration manger and the broker, which should help you troubleshoot the problem. The most recent message is at the top:


Figure 27. Event log entries
Figure 27

In the case above, the error message BIP3450E was received, and the detailed message says "incomplete logon data." This error was caused by failure to set the password, and you can resolve it by setting the password in the adapter, which is the node that was dragged on to the message flow earlier. To set the password, select Show Advanced => Advanced connection configuration.

The flow does not work

If you have successfully deployed your flow, the first thing to check is whether the broker is communicating with the SAP system. Use the SAP transaction SMGW. If the message flow has been deployed you should see:

  • Under Local LU name: your hostname
  • Under Local TP name: DataFlow
  • Under Users: your ID

In the example in Figure 28 below you can see the hostname CPS, which is the name of the system on which the broker is running. User name is stewart and TP name is DataFlow, which identifies the Message Broker execution group. This information confirms that the adapter node is trying to communicate with SAP.


Figure 28. Gateway Monitor entries
Figure 28

If the adapter is not connected, check the adapter’s connection details and also the SAP Unicode setting (see the section Changing SAP setting). You may find some helpful information in the user trace log.

If the SAP transaction SMGW is as expected, use SAP transaction SM59. Locate your RFC connection and double-click it. Click Connection Test to make sure the adapter is connected to SAP. Here is the result of a successful connection test:


Figure 29. RFC destination connect test
Figure 29

If you have deployed your flow and are connected, but you get unexpected results, you can debug your message flow with the Debugger provided with the Message Broker Toolkit. To find out more about the Debugger, enter "Testing and debugging message flow applications" in the Search help bar of the Message Broker Toolkit.

Appendix B. Importing Add_SAP_Header project

The project Add_SAP_Header is provided in the file Add_SAP_Header.zip. This project adds the SAP header to the start of the message. To import this project:

  1. From your workspace, click File => Import.
  2. In the Import Select wizard, expand Other.
  3. Select Project Interchange and click Next.
  4. Browse to Add_SAP_Header_Project_Interchange_file.zip, then click on the project and click Finish.

You will now see the project in your workspace. Add the subflow to your project: expand Add_SAP_Header => Flows => (default broker schema) and drag Add_SAP_Header.msgflow to the flow canvas, as shown below:


Figure 30. The Add_SAP_Header project
Figure 30

The section Migrating an existing inbound message flow above explains how to use this subflow.



Download

DescriptionNameSizeDownload method
Code sampleAdd_SAP_Header.zip2 KBHTTP

Information about download methods


Resources

About the author

Cyril P. Stewart is a WebSphere Message Broker and WebSphere MQ Specialist, and has worked as a Tester, Developer, Consultant, and Service Specialist. You can contact Cyril at stewartc@uk.ibm.com.

Comments (Undergoing maintenance)



Trademarks  |  My developerWorks terms and conditions

Help: Update or add to My dW interests

What's this?

This little timesaver lets you update your My developerWorks profile with just one click! The general subject of this content (AIX and UNIX, Information Management, Lotus, Rational, Tivoli, WebSphere, Java, Linux, Open source, SOA and Web services, Web development, or XML) will be added to the interests section of your profile, if it's not there already. You only need to be logged in to My developerWorks.

And what's the point of adding your interests to your profile? That's how you find other users with the same interests as yours, and see what they're reading and contributing to the community. Your interests also help us recommend relevant developerWorks content to you.

View your My developerWorks profile

Return from help

Help: Remove from My dW interests

What's this?

Removing this interest does not alter your profile, but rather removes this piece of content from a list of all content for which you've indicated interest. In a future enhancement to My developerWorks, you'll be able to see a record of that content.

View your My developerWorks profile

Return from help

static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=WebSphere
ArticleID=329905
ArticleTitle=Migrating the MQSeries Link for R3 to the WebSphere Message Broker Adapter Nodes for SAP
publish-date=08132008
author1-email=stewartc@uk.ibm.com
author1-email-cc=

My developerWorks community

Tags

Help
Use the search field to find all types of content in My developerWorks with that tag.

Use the slider bar to see more or fewer tags.

Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere).

My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).

Use the search field to find all types of content in My developerWorks with that tag. Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere). My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).

Special offers