Skip to Content

During the initial phase, I faced quite some issues in finding material for creating transactions and I see people asking for some stuff on it in the forums. So, thought of publishing it. This is just a start and will be posting more. This post can be quite useful for beginners who wanna learn xMII on their own.

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(Remote Function Call) 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.

 

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).

Illuminator Document

 

 

https://weblogs.sdn.sap.com/cs/blank/edit/wlg/

  

  

  

  

  

  

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 conditional
  2. If error occurs, then storing the error in XML Illuminator document using fatal error action block Fatal Error
  3. Terminating the transaction with an error message using termination transaction block Terminate Transaction

 

 

Here we are focusing on two stages of BAPI call

  1. Connection
  2. 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.

Linking

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.

IF Condition

 

  • 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.
  • 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.

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.

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

 

 

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)

 

 

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.

 

 

Linking of Fields

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

Linking

 

 

 

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.

The final transaction should look something like this.

 

Final

 

The output can be tested by creating a Xacute query and checking it.

You should get output, something like this.

 

Output

 

 

 

 

 

 


To report this post you need to login first.

3 Comments

You must be Logged on to comment or reply to a post.

  1. Vivek Krishnan Kandasamy
    Musarrat,

    Nice work extremely helpful .

    Some minor things which took some time to resolve:

    We are getting output in xAcute as Transaction successfully completed for a long time until we changed the transaction parameters for the Output XML as Output ( the checkbox Output is kept on ) .

    (0) 

Leave a Reply