16
Step By Step guide for Creating a Transaction in xMII to call an RFC Module SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2007 SAP AG 1 Step By Step guide for Creating a Transaction in xMII to call an RFC Module Applies to: SAP xApp Manufacturing Integration and Intelligence (SAP xMII 11.5.1 build 63) and SAP 6.00 Summary This Paper tells about calling an RFC (BAPI_SERVICE_GET_LIST) from xMII Business Logic Editor using a transaction? Data fetched from SAP can be used for different purposes in xMII. Author: Musarrat Husain Company: Wipro Technologies Created on: 8 October 2007 Author Bio Musarrat Husain is working in Wipro Technologies as a SAP consultant since October 2006 and doing application development and support for various projects in ABAP. Since the launch of xMII team in Wipro technologies, he has become a part of competency and is contributing in development of composite applications in xMII.

Step By Step guide for Creating a Transaction in …...SAP xApp Manufacturing Integration and Intelligence (SAP xMII 11.5.1 build 63) and SAP 6.00 Summary This Paper tells about calling

  • Upload
    others

  • View
    50

  • Download
    1

Embed Size (px)

Citation preview

Step By Step guide for Creating a Transaction in xMII to call an RFC Module

SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2007 SAP AG 1

Step By Step guide for Creating a Transaction in xMII to call an RFC Module

Applies to:

SAP xApp Manufacturing Integration and Intelligence (SAP xMII 11.5.1 build 63) and SAP 6.00

Summary This Paper tells about calling an RFC (BAPI_SERVICE_GET_LIST) from xMII Business Logic Editor using a transaction? Data fetched from SAP can be used for different purposes in xMII. Author: Musarrat Husain Company: Wipro Technologies Created on: 8 October 2007

Author Bio Musarrat Husain is working in Wipro Technologies as a SAP consultant since October 2006 and doing application development and support for various projects in ABAP. Since the launch of xMII team in Wipro technologies, he has become a part of competency and is contributing in development of composite applications in xMII.

Step By Step guide for Creating a Transaction in xMII to call an RFC Module

SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2007 SAP AG 2

Table of Contents Create a Table of Contents in Microsoft Word. To change, right-click on the TOC and select Update Field. Applies to: ........................................................................................................................................ 1 Summary.......................................................................................................................................... 1 Author Bio ........................................................................................................................................ 1 Declaring Variables.......................................................................................................................... 2 Adding and configuring JCO Action Block....................................................................................... 2 Adding an Illuminator Document ..................................................................................................... 3 Error Handling.................................................................................................................................. 4

Error handling at Connection Phase ............................................................................................ 5 Checking the Error Return Type .................................................................................................. 8

Populating Data in Illuminator Document ........................................................................................ 9 Configuring Repeater ................................................................................................................... 9 Configuring Illuminator Rows ..................................................................................................... 10

Linking of Fields...................................................................................................................... 11 Assigment ...................................................................................................................................... 12 Related Content............................................................................................................................. 15 Disclaimer and Liability Notice....................................................................................................... 16

Declaring Variables Variable declaration can be done at any stage, but I’m doing it just for the sake of clarity. Go to Transaction->properties and create following output parameter of type XML.

• Output

• Request

• Response

Adding and configuring JCO Action Block JCO Action Blocks are used to call an RFC from SAP server. Insert SAP JCO interface action block (from SAP ERP interface tab) in first sequence and right click->configure. In the configuration window, choose SAP Server Name and give search pattern and SAP RFC name as BAPI_SERVICE_GET_LIST . After that, click ok and hit choose generate sample XML.

Step By Step guide for Creating a Transaction in xMII to call an RFC Module

SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2007 SAP AG 3

Adding an Illuminator Document Illuminator document is used to hold multiple XML rows during the course of transaction and it also converts the XML format to xMII understandable form. The structure of Illuminator document should be same as the output required by you. Here, I’m taking the service no., short text and serv from the BAPI output (internal table SERVICELIST).

Step By Step guide for Creating a Transaction in xMII to call an RFC Module

SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2007 SAP AG 4

Error Handling In order to trap and handle errors occurred during the SAP RFC call, we need to check RFC status at various stages. I’m quoting the instances of connection and error return type. Error handling comprises of three steps:

1. Checking for the error using condition Block 2. If error occurs, then storing the error in XML Illuminator document using fatal error action block

Step By Step guide for Creating a Transaction in xMII to call an RFC Module

SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2007 SAP AG 5

3. Terminating the transaction with an error message using termination transaction block

Here we are focusing on two stages of BAPI call.

• Connection

• Return type

Error handling at Connection Phase Add a sequence to the transaction and add a condition block (Logic tab). Map the “success” property of BAPI to the input of the condition block.

Step By Step guide for Creating a Transaction in xMII to call an RFC Module

SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2007 SAP AG 6

Now add two sequences to the condition block. The green one will be executed if the condition is true otherwise red one will be executed.

Now add an “illuminator fatal error” action block to the sequence. And configure it illuminator document. In the “incoming” tabs, Map the BAPI’s LastErrorMessage to the message property.

Step By Step guide for Creating a Transaction in xMII to call an RFC Module

SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2007 SAP AG 7

In the outgoing tabs, map the illuminator document’s output property to transaction’s output.

Now add a sequence to the fatal error action block. And add a terminate transaction action block and map the termination message to RFC’s last error message.

Step By Step guide for Creating a Transaction in xMII to call an RFC Module

SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2007 SAP AG 8

Checking the Error Return Type The BAPI should be checked for return type error. One has to follow the same methodology as done in previous section.

• Add a condition check action block.

• Add a fatal error action block.

• Add a terminate transaction action block. To achieve this, map

BAPI_SERVICE_GET_LIST.Response{/BAPI_SERVICE_GET_LIST/TABLES/RETURN/item/TYPE} != "E"

to the input property of condition action block and proceed as we did in the last section.

Step By Step guide for Creating a Transaction in xMII to call an RFC Module

SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2007 SAP AG 9

After finishing with error handling, the screen should look something like this.

Populating Data in Illuminator Document Since the data is in the form of table and comprises of more than one record, so we have to use loop the RFC output line by line.

So for this we will be using repeater (from logic) and illuminator row

(from xMII XML output)

Configuring Repeater In the true sequence of second condition check, add the repeater action block and configure it to item level of output from BAPI.(Here, we’ll be sticking to internal table SERVICELIST)

Step By Step guide for Creating a Transaction in xMII to call an RFC Module

SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2007 SAP AG 10

Configuring Illuminator Rows Add a sequence to the repeater and add an illuminator row action block to it. Configure it to the output of illuminator document.

Step By Step guide for Creating a Transaction in xMII to call an RFC Module

SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2007 SAP AG 11

Linking of Fields Link each field of the illuminator row to the corresponding field from the output of the repeater.

Step By Step guide for Creating a Transaction in xMII to call an RFC Module

SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2007 SAP AG 12

Assignment The “Assignment” action block is used for explicitly assigning some value to some variable. Here, we’ll be using it to assign the illuminator documents output to the output of the transaction.

Step By Step guide for Creating a Transaction in xMII to call an RFC Module

SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2007 SAP AG 13

The final transaction should look something like this.

Step By Step guide for Creating a Transaction in xMII to call an RFC Module

SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2007 SAP AG 14

The output can be tested by creating a Xacute query and checking it. You should get output, something like this.

Step By Step guide for Creating a Transaction in xMII to call an RFC Module

SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2007 SAP AG 15

Related Content Please include at least three references to SDN documents or web pages.

• xMII Best Practices Guide

• SAP xMII getting Started

• Calling Services and Queries in SAP xMII 11.5 from ABAP

Step By Step guide for Creating a Transaction in xMII to call an RFC Module

SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2007 SAP AG 16

Disclaimer and Liability Notice This document may discuss sample coding or other information that does not include SAP official interfaces and therefore is not supported by SAP. Changes made based on this information are not supported and can be overwritten during an upgrade. SAP will not be held liable for any damages caused by using or misusing the information, code or methods suggested in this document, and anyone using these methods does so at his/her own risk. SAP offers no guarantees and assumes no responsibility or liability of any type with respect to the content of this technical article or code sample, including any liability resulting from incompatibility between the content within this document and the materials and services offered by SAP. You agree that you will not hold, or seek to hold, SAP responsible or liable with respect to the content of this document.