Quantcast
Channel: SCN : Document List - Process Integration (PI) & SOA Middleware
Viewing all 571 articles
Browse latest View live

Parameter reference for SFTP Advanced Mode

$
0
0

Introduction

I must admit that I am not good at searching for solutions from SAP Notes. There are many regular contributors in this space that are really good at searching through SAP Notes (you know who you are!) and I am often amazed at the Notes that they come up with to help resolve the issues in this space.

 

Perhaps one day, one of these superheroes might come up with a blog on how to effectively search for solutions in SAP Notes Until then, the rest of us mortals are left to our own devices to navigate the wild wild west of the SAP Notes world.

 

Every now and then, I notice there will be a reference SAP Note to some parameter for the SFTP's Advanced Mode. Personally, I find it frustrating that these parameters are not listed in the Online Help Portal for the SFTP adapter. Additionally, even SAP Note 1692819 which is the FAQ for the SFTP adapter does not provide a complete list of all the parameters available.

 

This document is my attempt to provide a central listing for all the parameters available in the SFTP adapter's Advanced Mode. It is based on the latest SP (SP04 at time of writing) of the SFTP adapter. It is a compilation of all the parameters with their related SAP Note, and I've also thrown in a few undocumented ones I've created this as a collaborative document, so anyone who is interested to help maintain this listing (maybe for future SPs) are welcome - just drop me a comment to request for edit permission.

 

 

Parameter Reference

 

Both directions

 

ParameterDefault ValueSAP NoteDescriptionExample Issue
addDefaultFileExtensionfalse

1817747

1815655

Files are archived with default .txt extension

File Extension ".txt" using SFTP-SND-Adpater

SFTP receiver channel Archive filename isssue

skipRemoteDirCheckfalse1737547Skip remote directory check on SFTP servers implementation (example GXS) that deviate from RFC

Button advanced mode not present on SFTP receiver adapter

Issue with SFTP Connectivity on PI 7.3

oscomamnd.tracefalseUndocumentedLog OS command errors even when trace level is not set to "Debug" - similar to Note 1334947 for File Adapter

ignore.error.cd

ignore.error.ls

ignore.error.pwd

false

false

false

1859563Ignore error with the pwd/cd/ls commands occur due to incompatibility with certain servers

Strange error with new SAP SFTP adapter "Exception received: 4: cd to ... failed"

SFTP : Receiver Channel Error : Javax.resource.ResourceException: 10: pwd failed

connection.mode.permanentfalse2069078Set connection mode of SFTP channel to permanent. By default a new connection is made at each polling and/or message processing

auth.method.privatekey

privatekey.view

privatekey.entry

false

null

null

2028233Support SFTP servers that require two-factor authentication

 

Sender

 

ParameterDefault ValueSAP NoteDescriptionExample Issue
receiveBufferSize655351738500File retrieve operation fails with the following error: "Inputstream is closed". Buffer size can be changed to lesser custom value
duplicateCheckPersist

20160

(14 days)

1744700Define custom duplicate check validitySFTP Sender CC weird Error: Duplicated Message-ID in database
usePathForLsfalse1850220Use full path when performing listing for files and additional files instead of current directory (ls .)
file.encodingUTF-81906648Support different encoding for filename if code pages of PI OS and SFTP Server points to different encoding

 

Receiver

 

ParameterDefault ValueSAP NoteDescriptionExample Issue
retain.attachment.namefalseUndocumentedRetain filenames of attachment when using "Store attachments" in receiver channelSFTP Receiver adapter - Store attachments File name issue

How to add attachment using JAVA Mapping (SAP PO)

$
0
0

Hi,

 

I was having a requirement to pick a PDF file from a file server, send it as attachment and PDF file name as field to the target server.

 

As a solution I created a JAVA code and used it as JAVA mapping in PI. I hope this code will help PI consultants if they have similar kind of requirement.

 

/*

* Created on May 14, 2015

*

* To change the template for this generated file go to

* Window>Preferences>Java>Code Generation>Code and Comments

*/

package attach;

 

 

/**

* @author ashutosh upadhyay

*

* To change the template for this generated type comment go to

* Window>Preferences>Java>Code Generation>Code and Comments

*/

 

import java.io.InputStream;

import java.io.OutputStream;

import com.sap.aii.mapping.api.AbstractTransformation;

import com.sap.aii.mapping.api.Attachment;

import com.sap.aii.mapping.api.DynamicConfigurationKey;

import com.sap.aii.mapping.api.OutputAttachments;

import com.sap.aii.mapping.api.TransformationInput;

import com.sap.aii.mapping.api.TransformationOutput;

import  com.sap.aii.mapping.api.DynamicConfiguration;

 

public class AddAttachment extends AbstractTransformation{

 

 

  private static final DynamicConfigurationKey KEY_FILENAME = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");

 

  public void transform(TransformationInput transformationInput, TransformationOutput transformationOutput) {

  //System.out.println("A");

  // access dynamic configuration

  InputStream inputstream = transformationInput.getInputPayload().getInputStream();

  OutputStream outputstream = transformationOutput.getOutputPayload().getOutputStream();

 

  DynamicConfiguration conf = transformationInput.getDynamicConfiguration();

  String fileName = "";

   fileName = conf.get(KEY_FILENAME);

  //System.out.println("C"+fileName);

 

  // set file name

  conf.put(KEY_FILENAME, fileName);

 

  try {

 

  // a) Populate XML for XIPAYLOAD

 

  String fresult= "";

  // creating the xml

  fresult="<?xml version=\"1.0\" encoding=\"UTF-8\"?>";

  fresult = fresult.concat("<ns0:MT_Payload xmlns:ns0=\"http://test\">");

  fresult = fresult.concat("<FileName>");

  fresult = fresult.concat(fileName);

  fresult = fresult.concat("</FileName>");

  fresult = fresult.concat("</ns0:MT_Payload>");

 

  outputstream.write(fresult.getBytes("UTF-8"));

 

// Write attachment

  OutputAttachments outputAttachments = transformationOutput.getOutputAttachments();

  byte[] b = new byte[inputstream.available()];

  inputstream.read(b);

  Attachment newAttachment = outputAttachments.create(fileName,"application/pdf", b);

  outputAttachments.setAttachment(newAttachment);

  }

  catch (Exception e) {

  getTrace().addDebugMessage(e.getMessage());

  }

  }

}

 

Output:

1.JPG

2.JPG

Base64EncodeConverter - Base64 encoding made easy!

$
0
0

Introduction

In my previous article Base64DecodeConverter - Base64 decoding made easy!, I introduced a new converter for FormatConversionBean to handle decoding of Base64 content.

 

This article covers Base64EncodeConverter, which handles encoding of content into a Base64 string in either plain text file or embedded in an XML payload.

 

 

Source Code and Deployment Archive

Refer to following blog on location of source code and/or EAR deployment file.

FormatConversionBean - One Bean to rule them all!

 

 

Usage of Module in Communication Channel

Module Processing Sequence

NumberModule NameTypeModule Key

<Depending on position of module in chain>

1) Asynchronous scenario,

Normally before the last module in channels

2) Synchronous scenario,

Before last module to convert request payload

After last module to convert response payload

Custom_AF_Modules/FormatConversionBeanLocal Enterprise Bean<Any Arbitrary Value>

 

 

Module Parameter Reference

Below are the parameters for configuration of the module for Base64 encoding. Certain parameters will automatically inherit the default values if it is not configured.

 

Parameter NameAllowed valuesDefault valueRemarks
converterClasscom.equalize.xpi.af.modules.base64.Base64EncodeConverterRequired field. Determines conversion class
outputTypeplain, xml

Required field. Indicates type of output data

  • plain = Base64 string as plain output text
  • xml = Base64 string embedded in XML element of XML payload
documentName

Required field when outputType = 'xml'.

Document name of root element of XML output

documentNamespace

Required field when outputType = 'xml'.

Namespace of root element of XML output

base64FieldNamebase64Content

Available when outputType = 'xml'.

Field name of  XML element containing Base64 string

compressY,NNCompress input content before encoding into Base64 string
messageLog

pre, post

Saves a log version of the message that is viewable in Message Monitor
  • pre = saves payload before conversion
  • post = saves payload after conversion
logLocationName of log version when messageLog is populated. Location defaulted to value in messageLog if logLocation not populated

 

 

Example Scenarios

Here are some example scenarios of the behavior of the conversion based on different configuration options.

 

Scenario 1

  • Encode content into Base64 string in plain output text
  • Content will be compressed before encoding into Base64

 

Module parameters

Parameter NameParameter Value
converterClasscom.equalize.xpi.af.modules.base64.Base64EncodeConverter
outputTypeplain
compressY

 

Result

Inputinput1.png
Outputoutput1.png

 

 

Scenario 2

Screenshot of actual configuration and testing are shown below.

  • Encode content into Base64 string, and embed in XML payload
  • Output XML's root element, namespace and field containing base 64 string specified

 

Module configuration on an SFTP receiver channel.

config.png

 

The input content to be encoded is sent via the Send Test message function.

testdata1.png

 

The log version 'b64embedxml' shows the content after encoding. The Base64 string is embedded into an XML payload.

encoded.png

 

The audit log shows the trace of steps being executed by the module.

log.png

 

The encoded output is verified using Base64 Decode - Online to decode the generated Base64 string to retrieve back the original content.

verify.png

 

 

Conclusion

With this new addition to FormatConversionBean, encoding of Base64 content can also now be easily handled without additional custom development

Multiple target directories dynamically using JAVA Mapping

$
0
0

Hi All,

 

I have a requirement where I need to pick files from multiple source directories and place it to on target file server using one file channel. The interface was passthrough interface so I created dummy structures as I would be needing service interfaces and operation mapping to call JAVA mapping.

 

To achieve this I prefer to write Adapter Module but sometimes due to BASIS dependency, we have to go for JAVA mapping. Here I am putting up my JAVA code but ADAPTER MODULE code will be shared soon.

 

 

Source directories were like

 

/a/b/c/X

/a/b/c/Y

/a/b/c/Z

 

and target directories were /X, /Y, /Z

 

PFB the code:

 

/*

* Created on May 26, 2015

*

* To change the template for this generated file go to

* Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments

*/

package global;

 

 

/**

* @author ashutosh.a.upadhyay

*

* To change the template for this generated type comment go to

* Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments

*/

 

 

import java.io.InputStream;

import java.io.OutputStream;

import java.util.Map;

 

import com.sap.aii.mapping.api.AbstractTransformation;

import com.sap.aii.mapping.api.DynamicConfiguration;

import com.sap.aii.mapping.api.DynamicConfigurationKey;

import com.sap.aii.mapping.api.StreamTransformationConstants;

import com.sap.aii.mapping.api.StreamTransformationException;

import com.sap.aii.mapping.api.TransformationInput;

import com.sap.aii.mapping.api.TransformationOutput;

 

public class DynamicDirectory extends AbstractTransformation {

 

  public void transform(TransformationInput transformationInput, TransformationOutput transformationOutput)throws StreamTransformationException{

  try {

    InputStream inputstream = transformationInput.getInputPayload().getInputStream();

      OutputStream outputstream = transformationOutput.getOutputPayload().getOutputStream();

 

    Map mapParameters = (Map) transformationInput.getInputHeader().getAll();

 

    // Dynamic Confguration

    mapParameters.put(DynamicConfigurationKey.create("http://sap.com/xi/XI/Dynamic", StreamTransformationConstants.DYNAMIC_CONFIGURATION), "");

    DynamicConfiguration conf = (DynamicConfiguration) mapParameters.get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);

    DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File", "Directory");

 

    //Check the input directory and set the output directory

    String inputDir = "";

    String outputDir = "";

 

    inputDir = conf.get(key);

 

    if(inputDir.endsWith("X")){

    outputDir = "/X/";

    }

 

 

    else if (inputDir.endsWith("Y")){

    outputDir = "/Y/";

    }

 

    else if(inputDir.endsWith("Z")){

    outputDir = "/Z/";

    }

 

 

  //Set the directory parameter

  conf.put(key,outputDir);

 

    //copy Input file content to Output file content

    byte[] b = new byte[inputstream.available()];

    inputstream.read(b);

    outputstream.write(b);

    }

    catch (Exception exception){

    getTrace().addDebugMessage(exception.getMessage());

    throw new StreamTransformationException(exception.toString());

    }

  }

}

Pulling Data From Webservice using Sender SOAP Adapter with AXIS protocol

$
0
0


Dear SCN Users,


There might a requirement of pulling XMLs from a webservice.


This blog is about achieving the same using Sender SOAP Adapter with AXIS as Transport protocol and writing the XML as output file


Requirment is to get the exchange rates from this below XML link

 

http://www.geoplugin.net/xml.gp?base_currency=EUR

 

ESR OBJECTS:


Data Type: Since no transformation in the XML,Same data type at sender and receiver side.

 

Untitled.png

Message Type: Message Type with above Data Type.

 

Untitled.png

 

Service Interfaces: One outbound and one inbound with the Same Message Types defined above.


No need of Message/Operation Mapping as there is no any message transformation.


ID OBJECTS:


Sender Soap Channel With (AXIS Protocol):

Untitled.png

 

Then Normal File Channel as below and ICO Configurations as per the requirment.

 

Untitled1.png

 

Below is the output file written in the file directory.

Capture.JPG

Things to be Noted:

 

1. If there is no structure created and with enableREST parameter set to 'true', and using dummy interfaces below error was thrown.

 

Untitled1.png

 

2. without structure and with enableREST parameter not set to 'true' below error was thrown.

 

Capture1.JPG

 

So with data Structure and setting enableREST parameter to 'true' requirment  completed.

 

Reference Link :Michal's PI tips: Exchange Rates from an XML file on a web page - REST, AXIS

 

Reference Note:0001039369

PI-Multiple operations with FILE adapter

$
0
0

           Introduction: Multiple operations in sender Interface allows to read different structure using same Interface from file server and process accordingly. Simultaneously multiple operations in receiver Interface allows to send different structure to file server. Here, we use both sender and receiver Interfaces with multiple operations to read different structures and to send different structures to file server.

 

Author: Parin Chahwala

Created on: 03 JUNE 2015

Guided By: Jagesh Lakdawala

 

Step 1: Create Data Types and Message Types for OUTBOUND Interface operations and INBOUND Interface operations.

SCN1.jpg.png

Step 2: Design OUTBOUND and INBOUND Interfaces with multiple operations and add relevant Message Types for it.

SCN2.jpg.png

Step 3: Design Message Mapping for all Message Types.

Note:- Here, I've created Function Library to set filename for receiver server dynamically as I need different filename for all operations.

SCN3.jpg.png

Step 4: Design Operation Mapping for all Operations of OUTBOUND and INBOUND Interface.

SCN4.jpg.png

Step 5: Configure Sender Communication Channel with all filenames to be Pick from fileserver in File Name Mask.

SCN5.jpg.png

Step 6: Configure Receiver Communication Channel with filename.

Note:- As Define above in Message Mapping Filename will be set Dynamically.

SCN6.jpg.png

Step 7: Configure Sender and Receiver Agreement.

SCN7.jpg.png

Step 8: Configure Interface Determination for all Sender Interface Operations define Operation Mapping.

SCN8.jpg.png

Step 9: Configure Receiver Determination with Receiver Component.

SCN9.jpg.png

 

Plus

• Read or Send file with different structures.

• Less Objects need to develop

• Less Memory, Resource required as less no of Objects.

• Less time to Develop complete scenario.

PI: Send email with pdf attachment using graphical mapping

$
0
0

Summary

In that document I am presenting a way on how to use the mail package in graphical mapping to send email with binary attachment (pdf).

In my scenario I have an incoming RFC call containing pdf lines which are base64 encoded. These lines are concatenated into one pdf document which is sent out as email attachment. The email has also a normal body part.

 

My first attempt was to use multipart/mixed content type and to create the mail package content in an udf taking care of the inline email body and the pdf attachment separated by boundaries. The problem was that the pdf attachment was base64 encoded in the email thus invalid. Decoding the pdf in the udf is not an option as the mail package content field is of string type (as it contains also the body text). So this approach works only for non binary attachments.

 

Next I tried to create the attachment in the global container and that did the trick. I am showing now that solution focusing only on the key objects which are the message mapping and the receiver channel.

 

Message Mapping

 

scrshot1.png

In the source message we have DIJNET_NAM used for the file name, EMAIL_ADDRESS and DIJNET_TAB containing the pdf lines in BASE64.

We might have different type of lines but we are interested in pdf lines only (TYPE='P').

 

In the target message I deactivated the irrelevant fields.

Content_Type is set to text/html; charset=ISO-8859-2 because I am sending the email with html body.

Content_Disposition is set to inline because I want to display the html content in the email body (and not as attachment).

Content is created by the udf CreateContent.

 

UDF CreateContent

The udf is taking rows (pdf lines), row types (for filtering on 'P') and filename as argument. We execute it on the whole queue as we need all the pdf lines to create the attachment.

scrshot2.png

scrshot3.png

We create the attachment as message attachment in the global container so we can use the Keep attachment flag in the mail receiver channel.

We also need to decode the pdf lines because we need the original binary content to get a valid pdf.

I am not using error handling (try/catch) to keep the tutorial as short as possible.

 

Receiver channel

scrshot4.png

That's it

Simplified Version of SXMB_MONI With a Capability to Reterive data from payload in ALV

$
0
0

Summary

The document shows you a way to fetch the XI monitoring data from the various standard SAP tables.  In this I will show a way to fetch the PI monitoring data (accessed via transaction SXMB_MONI) from the various standard tables, save these data in a customizing transparent table and a report that recover the saved data and shows the payload in a HTML viewer control application. It also includes data conversion from XML (payload) to ALV report  where user can search data using ALV filters i.e.  shows the ability to search based on data from payload in ALV display.

Introduction

Business always cares about a status of the messages flowing through XI. SAP Exchange Infrastructure has been known for many of its dazzling features and one of them is the effective and efficient message tracing facility through the transaction - SXMB_MONI. The transaction provides a detailed tracing information for each and every XI interfaces.

Sometimes it’s necessary to fetch some PI monitoring messages accessed via transaction SXMB_MONI (to show them over a Portal or in another system for example). Here, I will show in few steps how to recover these data, save it in a custom transparent table and a small application that shows these data based on radio button selected whether you want to see a payload message in a HTML viewer control (XML Format) when some line is double clicked or all the data from XML(Payload) file in ALV format which user can filter based on his requirement.


Introducing the Important XI Tables


Here are the key objects for any XI interface in a runtime environment:
  • Inbound message Interface
  • Outbound message Interface
  • Interface namespace
  • Sending Business System
  • Receiving Business System
  • Interface Mapping
  • Message Payload
  • Message status
The SAP XI stores the monitoring trace data in the multiple tables. Before I go further, I would like to give some overview on the tables which I have used to fetch the basic XI interface monitoring data.
  1. SXMSPMAST: (Integration Engine: Message Queue (Master)) The table is the master table for the monitoring information. You can get the timestamp, interface status, message id, and many more information.
  2. SXMSPEMAS: (Integration Engine: Enhanced Message Queue (Master)) The table provides the namespaces, the business systems and message interfaces involved in the interface.
  3. SXMSMSTATT: (Exchange Infrastructure: Message Status Description) This table provides a message status description.
  4. SXMSMSTAT: (Exchange Infrastructure: Message Status) This table is helpful if you want to show the process status icon for the corresponding message state.
  5. SMPPMAP3: (Mapping Runtime: Mapping) The above table gives you the mapping name (if any) used in the interface. It also provides the details on the type of mapping (ABAP mapping, Java mapping, Generated Mapping, XSLT java mapping, XSLT ABAP mapping) used for an interface.
  6. SMPPREL3: (Mapping Runtime: Mapping Relation) the table gives an interface mapping details for an interface and its corresponding message interface.
Note: For more information consider the following tables:

• SXMSPERROR: XML Message Broker: Message Queue (Incorrect Entries)
• SXMSCLUP: XMB: Property Cluster
• SXMSPVERS: Integration Engine: Message Version
• SXMSAGGRAW: SAP XI Status Overview: Integration Engine Raw Data
• SXMSALERTLOGGER: XI Alert Logs
• SXMSAEADPMODCHN: XI: Adapter Module Chains
• SMPPSPLIT : XI Mapping: Merge and Split

Step 1:  Create Transparent Tables/Structure/Table type using SE11

First of all, it’s necessary to create a transparent table to store the monitoring messages and the payload recovered from the standard tables. This transparent table (ZSM_DATA) is composed by the structure that contains the keys for the message (ZSM_KEY) and the structure that contains the data fields (ZSM_OTHER).

Create Structure ZSM_KEY

1.jpg

Create Structure ZSM_OTHER

2.jpg

Create Transparent Table ZSM_DATA.

3.jpg

Create Table Type ZSM_DATA_TAB for Table ZSM_DATA4.jpg

 

Create Output Structure ZSM_DATA_OUTPUT

6.jpg

Create Transparent table  ZSM_FILTER

7.jpg

Create Table Type ZSM_FILTER_TAB using ZSM_FILTER

9.jpg8.jpg

Step 2:  Create Function Module “ZSXMB_MONI_EXTRACT” using SE37

The function is responsible to fetch the data from the standard SAP monitoring tables (including the messages payloads) and export them as a table. I used a remote enabled function module (RFC) because with this option it’s possible to call it from others systems and save the fetched data remotely on the caller systems.


Importing Parameters

The importing parameters are:
I_DATE_FROM  The initial execution date;
I_TIME_FROM    The initial execution time;
I_DATE_TO        The final execution date;
I_TIME_TO          The final execution time;
IT_FILTER          A filter table based on the ZSM_FILTER structure where is defined the field and the conditions that this field must respect. The field is one    or more of the SXI_MSG_SELECT structure and the value is the desired condition. An example of how to fill this table will be showed in    the report that’s used to recover the monitoring data.
10.jpg

Exporting Parameters

The exporting parameter is:
ET_DATA      The table that contains the message data including its payload. This table is based on the structure ZSM_DATA (which include the structures                        ZSM_KEY – with the key fields for the messages and ZSM_OTHER – that contains the data.

11.jpg

Exceptions

The exceptions are:
      INVALID_DATES  The date and time passed as importing parameters are invalids (date and time from greater than the date and time to, for example);
      NO_DATA            There’s no PI monitoring messages for the conditions passed in the importing parameters.


12.jpg
FM Source code


Function Module Source Code attached with the message in xml format(FM.xml).

 

Application to Fetch & Show the Fetched Monitoring Messages data

After the creation of the function module it’s necessary to create a way to call it, fetch the data and store these data in a transparent table and display in an ALV table. When you double click one of the monitoring messages displayed it displays the payload related to the message in a HTML viewer control or After selecting multiple or single row on ALV display and clicking the button ‘Payload’ on ALV Output the data from payload is displayed in ALV format.For this will be created a report that calls the function module, shows a small summary of the processing status, store the fetched data in a transparent table, Extract data from payload to display in ALV format.

    A. This program is composed of 3 Screens

                          (Below is the necessary information to create the screen)
      1. Create one screen that has a container(CC_SXMB) used to shows the initial Display of all the messages as per selection criteria in ALV Format.
      2. Second Screen that has a container(CC_PL) used to shows HTML viewer control.
      3. Third Screen that has a container (CC_ALV)used to shows extract form XML (payload) data in ALV format.

                        ff.jpg

 

    B. GUI Status/GUI Title.

              ALV_GUISTATUS
22.jpg23.jpg

    C. Create Selection Screen as below

24.jpg

    D. Declaration for all the variables/Internal Tables/Types

Following are the declarations for all the variables/Internal Tables/Types to be used in the code snippets throughout the document. This would help us avoid all the confusion pertaining to the type of variables used.
*----------------------------------------------------------------------
*        C O N S T A N T  D E C L A R A T I O N                     
*----------------------------------------------------------------------
CONSTANTS:
 
BEGIN OF gc_log,
    success
TYPE symsgty VALUE 'S',
    warning
TYPE symsgty VALUE 'W',
    error 
TYPE symsgty VALUE 'E',
 
END OF gc_log,

  gc_exit
TYPE sy-ucomm  VALUE 'EXIT',
  gc_canc
TYPE sy-ucomm  VALUE 'CANC',
  gc_back
TYPE sy-ucomm  VALUE 'BACK',
  gc_a   
TYPE char01    VALUE 'A',
  gc_xmld
TYPE char04    VALUE 'XMLD'.
*----------------------------------------------------------------------
*        T Y P E  D E C L A R A T I O N                             
*----------------------------------------------------------------------*
TYPES :
  ty_zsm_key
TYPE SORTED TABLE OF zsm_key  WITH UNIQUE DEFAULT KEY.
TYPES:
 
BEGIN OF ty_zsm,
    msgguid 
TYPE zsm_data-msgguid,
    pid     
TYPE zsm_data-pid,
    msgstate 
TYPE zsm_data-msgstate,
    exetimest
TYPE zsm_data-exetimest,
    adminuser
TYPE zsm_data-adminuser,
    ob_system
TYPE zsm_data-ob_system,
    ob_ns   
TYPE zsm_data-ob_ns,
    ob_name 
TYPE zsm_data-ob_name,
    ib_system
TYPE zsm_data-ib_system,
    ib_ns   
TYPE zsm_data-ib_ns,
    ib_name 
TYPE zsm_data-ib_name,
 
END OF ty_zsm,

  ty_t_zsm   
TYPE SORTED TABLE OF ty_zsm  WITH NON-UNIQUE KEY msgguid pid,

  ty_t_output
TYPE STANDARD TABLE OF zsm_data_output
                     
WITH NON-UNIQUE KEY msgdate msgtime msgguid pid.
*----------------------------------------------------------------------
*        I N T E R N A L  T A B L E  D E C L A R A T I O N           
*----------------------------------------------------------------------*
DATA :
  it_payload 
TYPE zsm_data_tab,
  it_zsm_data
TYPE ty_t_zsm,
  it_output 
TYPE STANDARD TABLE OF zsm_data_output,
  wa_payload 
TYPE zsm_data,
  wa_output 
TYPE LINE OF ty_t_output.

*----------------------------------------------------------------------
*        V A R I A B L E  D E C L A R A T I O N                     
*----------------------------------------------------------------------*
DATA:
  gv_error
TYPE char01,
  gv_log 
TYPE num5,
  gv_ucomm
TYPE sy-ucomm,
  gv_lines
TYPE int4.

*----------------------------------------------------------------------
*        A L V  D E C L A R A T I O N                               
*----------------------------------------------------------------------*
* ALV Internal Table Declaration
DATA: it_cellstyle  TYPE STANDARD TABLE OF lvc_s_styl,
      it_fieldcat 
TYPE STANDARD TABLE OF lvc_s_fcat,
      it_exclude   
TYPE ui_functions,
      it_row_no_top
TYPE TABLE OF  lvc_s_roid INITIAL SIZE 0,
      wa_row_no_top
TYPE lvc_s_roid.

* ALV Work Area Declaration
DATA : wa_fieldcat  TYPE  lvc_s_fcat,
      wa_layout   
TYPE  lvc_s_layo,
      wa_result   
TYPE  string.
DATA:
  gv_layout   
TYPE disvariant.

*----------------------------------------------------------------------
*        X M L To Internal Table Conversion  D E C L A R A T I O N
*----------------------------------------------------------------------

* Declaring the table to contain the parsed data
DATA: it_xml_info TYPE STANDARD TABLE OF smum_xmltb.
* Declaring the work area for the internal table containing the parsed data
DATA: wa_xml_info TYPE smum_xmltb.
* Declaring the table to contain the returned messages from the parsing FM
DATA: it_return TYPE STANDARD TABLE OF bapiret2.
* Declaring the work area for the return table
DATA: wa_return TYPE bapiret2.
DATA :
  it_fieldcatxml
TYPE lvc_t_fcat,
  gref_table   
TYPE REF TO data,
  gref_line     
TYPE REF TO data.
DATA : gv_count TYPE int4.
FIELD-SYMBOLS : <fs_table>    TYPE STANDARD TABLE,
                <fs_tabletmp>
TYPE STANDARD TABLE,
                <fs_line>   
TYPE any,
                <fs_t>       
TYPE any,
                <fs_s>       
TYPE any.

    E. Retrieve Data by calling FM ZSXMB_MONI_EXTRACT and passing Selection Screen

        parameters.

CONSTANTS:
     
BEGIN OF lc_field,
        field1
TYPE zsm_filter-field VALUE 'SENDER_RECEIVER-OB_NAME',
        field2
TYPE zsm_filter-field VALUE 'SENDER_RECEIVER-OB_NS',
        field3
TYPE zsm_filter-field VALUE 'SENDER_RECEIVER-IB_NAME',
        field4
TYPE zsm_filter-field VALUE 'SENDER_RECEIVER-IB_NS',
     
END OF lc_field.*
   
DATAlit_filter TYPE zsm_filter_tab,
            lwa_filter
TYPE zsm_filter,
            lv_num   
TYPE num03.*
   
IF NOT p_infsnm IS INITIAL.
      lv_num
= lv_num + 1.
      lwa_filter
-filternum lv_num.
      lwa_filter
-field = lc_field-field1.
      lwa_filter
-value = p_infsnm.
     
APPEND lwa_filter TO lit_filter.
   
ENDIF.

   
IF NOT p_infsns IS INITIAL.
      lv_num
= lv_num + 1.
      lwa_filter
-filternum lv_num.
      lwa_filter
-field = lc_field-field2.
      lwa_filter
-value = p_infsns.
     
APPEND lwa_filter TO lit_filter.
   
ENDIF.

   
IF NOT p_infrnm IS INITIAL.
      lv_num
= lv_num + 1.
      lwa_filter
-filternum lv_num.
      lwa_filter
-field = lc_field-field3.
      lwa_filter
-value = p_infrnm.
     
APPEND lwa_filter TO lit_filter.
   
ENDIF.

   
IF NOT p_infrns IS INITIAL.
      lv_num
= lv_num + 1.
      lwa_filter
-filternum lv_num.
      lwa_filter
-field = lc_field-field4.
      lwa_filter
-value = p_infrns.
     
APPEND lwa_filter TO lit_filter.
   
ENDIF.
** Call FM ZSXMB_MONI_EXTRACT for Extracting SXMB_MONI Data.

   
CALL FUNCTION 'ZSXMB_MONI_EXTRACT'
     
EXPORTING
        i_date_from 
= p_exedat
        i_time_from 
= p_exetim
        i_date_to   
= p_exe2da
        i_time_to   
= p_exe2ti
        it_filter   
= lit_filter
     
IMPORTING
        et_data     
= it_payload
     
EXCEPTIONS
        invalid_dates
= 1
        no_data     
= 2
       
OTHERS        = 3.
   
IF sy-subrc = 2.
     
MESSAGE i007(sabapdocu) DISPLAY LIKE gc_log-error.
   
ELSE.
     
SORT it_payload BY msgguid pid.
   
ENDIF.

F.  Update Data to custom table ZSM_DATA from data retrieved in step E

DATA: lit_zsxmb_moni TYPE STANDARD TABLE OF zsm_data  WITH NON-UNIQUE DEFAULT KEY,
      lwa_zsxmb_moni
TYPE zsm_data,
      lref_payload 
TYPE REF TO zsm_data.

   
LOOP AT it_payload REFERENCE INTO lref_payload.
     
MOVE-CORRESPONDING lref_payload->* TO lwa_zsxmb_moni.
     
APPEND lwa_zsxmb_moni TO lit_zsxmb_moni.
   
ENDLOOP.

   
IF lit_zsxmb_moni IS NOT INITIAL.
     
DELETE FROM zsm_data.
     
MODIFY zsm_data FROM TABLE lit_zsxmb_moni.
   
ENDIF.

G.  Retrieve Data From Custom Table

          SELECT msgguid pid msgstate  exetimest adminuser ob_system

                ob_ns ob_name ib_system ib_ns ib_name

         
FROM zsm_data INTO TABLE it_zsm_data.

         
IF it_zsm_data IS INITIAL.
         
MESSAGE i007(sabapdocu) DISPLAY LIKE gc_log-error.
         
ENDIF.

H.  Process data for ALV Output


          DATA:
      lref_zsxmb_moni
TYPE REF TO ty_zsm,
      lwa_output     
TYPE LINE OF ty_t_output,
      lit_sxmsmstat  TYPE sxmsmstat_attr_t,
      lref_sxmsmstat
TYPE REF TO sxmsmstat_attr.
    LOOP AT it_zsm_data REFERENCE INTO lref_zsxmb_moni.
     
CLEAR lwa_output.
      lwa_output
-msgguid = lref_zsxmb_moni->msgguid.
      lwa_output
-pid = lref_zsxmb_moni->pid.
      lwa_output
-ob_system = lref_zsxmb_moni->ob_system.
      lwa_output
-ob_ns = lref_zsxmb_moni->ob_ns.
      lwa_output
-ob_name = lref_zsxmb_moni->ob_name.
      lwa_output
-ib_system = lref_zsxmb_moni->ib_system.
      lwa_output
-ib_ns = lref_zsxmb_moni->ib_ns.
      lwa_output
-ib_name = lref_zsxmb_moni->ib_name.
      lwa_output
-adminuser = lref_zsxmb_moni->adminuser.
     
CONVERT TIME STAMP lref_zsxmb_moni->exetimest  TIME ZONE sy-zonlo
     
INTO DATE lwa_output-msgdate TIME lwa_output-msgtime.
     
IF msgstate IS NOT INITIAL

     
CALL FUNCTION 'SXMB_GET_STATUS_ATTRIBUTES'
     
EXPORTING
        im_langu         
= sy-langu
        im_msgstate       
= msgstate
        im_icon_convert   
= space
     
IMPORTING
        ex_msgstate_attr 
= lit_sxmsmstat
     
EXCEPTIONS
        msgstate_not_found
= 1
       
OTHERS            = 2.
      IF sy-subrc <> 0.
            ENDIF.

     
READ TABLE lit_sxmsmstat INDEX 1 REFERENCE INTO lref_sxmsmstat.
     
IF lref_sxmsmstat IS NOT INITIAL.
        msgstate_icon
= lref_sxmsmstat->icon_id.
     
ENDIF.
      ENDIF.
     
APPEND lwa_output TO it_output.
   
ENDLOOP.

I.    Display Data in ALV on Screen 100 Container using Internal Table based on selection

      screen data

25.jpg

J.    View Payload in payload viewer on Double Clicking on any line in Step I Output.

CONSTANTS:
    lc_type   
TYPE char50 VALUE 'application',
    lc_subtype
TYPE char50 VALUE 'octet-stream',
    lc_512   
TYPE int4  VALUE 512.

 
DATA:
    lv_length   
TYPE int4,
    lv_len       
TYPE int4,
    lv_offset   
TYPE int4,
    lv_len_tmp   
TYPE int4,
    lv_url       
TYPE char255,
    lit_raw_lines
TYPE sxmsraw512lines,
    lwa_raw_line 
TYPE LINE OF sxmsraw512lines.
* Creating Objects

 
IF  gref_ccontainerpl IS NOT BOUND.
   
CREATE OBJECT gref_ccontainerpl
     
EXPORTING
        container_name
= 'CC_PL'.

   
CREATE OBJECT gref_html_viewer
     
EXPORTING
        parent           
= gref_ccontainerpl
     
EXCEPTIONS
        cntl_error       
= 1
        cntl_install_error
= 2
        dp_install_error 
= 3
        dp_error         
= 4.

   
IF sy-subrc = 0.
      cl_gui_cfw
=>flush( ).
   
ENDIF.
 
ENDIF.
*
**Creating URL for Payload
*
  lv_length
= xstrlen( wa_payload-payload ).
  lv_len
= lv_length.
  lv_offset
= 0.
  lv_len_tmp
= lv_len.

 
IF lv_len_tmp > lc_512.
   
DO.
      lwa_raw_line
= wa_payload-payload+lv_offset(lc_512).
     
APPEND lwa_raw_line TO lit_raw_lines.
      lv_offset
= lv_offset + lc_512.
      lv_len_tmp
= lv_len_tmp - lc_512.

     
IF lv_len_tmp < lc_512.
       
EXIT.
     
ENDIF.
   
ENDDO.
 
ENDIF.

 
IF lv_len_tmp > 0.
    lwa_raw_line
= wa_payload-payload+lv_offset(lv_len_tmp).
   
APPEND lwa_raw_line TO lit_raw_lines.
 
ENDIF.

  gref_html_viewer
->load_data(
   
EXPORTING
       
type = lc_type
        subtype
= lc_subtype
       
size = lv_length
   
IMPORTING
        assigned_url
= lv_url
   
CHANGING
        data_table
= lit_raw_lines
   
EXCEPTIONS
        dp_invalid_parameter
= 1
        dp_error_general
= 2
   
OTHERS = 4 ).

 
IF sy-subrc <> 0.
 
ENDIF.

  gref_html_viewer
->show_url( url = lv_url ).

 
REFRESH: lit_raw_lines.
 
CLEAR : lv_url,lwa_raw_line,lv_len_tmp,lv_length,lv_len.

After double click one of the messages the payload will be displayed  like follows:
26.jpg

K.    On Selecting a row or multiple row and clicking Button 31.jpgor selecting radio Button 32.jpg
  XML data is converted to internal table which is displayed in ALV format. Steps to do the same are in Step L

        below.

27.jpg

 

L.    Process XML data to dynamic internal table and display in ALV.

 

**Prepare XML Data
   
REFRESH  it_fieldcatxml[].
   
CLEAR :gv_count,gv_lines.
   
DESCRIBE TABLE it_output LINES gv_lines.
   
LOOP AT  it_output  INTO wa_output .
     
READ TABLE it_payload INTO wa_payload WITH KEY
                                msgguid
= wa_output-msgguid
                                pid
= wa_output-pid
                             
BINARY SEARCH.
     
IF sy-subrc = 0.

a) Parsing the x string in order to convert the data into an XML table.

 

          In case we have an XML string that needs to be converted into an object, then the XML string needs to be parsed. The parsing would convert the string into a table. The internal table that would be returned is it_xml_info. It_xml_info is of type SMUM_XMLTB. The structure for SMUM_XMLTB is in the screen-shot below:

28.jpg

The table SMUM_XMLTB has four fields: HIER, TYPE, CNAME and CVALUE. The XML data would be transferred into the four fields.

** This function module is used to parse the XML and get the data in the form of a table

      CALL FUNCTION 'SMUM_XML_PARSE'
         
EXPORTING
            xml_input
= wa_payload-payload
         
TABLES
            xml_table
= it_xml_info
            r
eturn    = it_return
         
EXCEPTIONS
           
OTHERS    = 0.

*If XML parsing is not successful, return table will contain error messages
       
READ TABLE it_return INTO wa_return WITH KEY type = 'E'.
       
IF sy-subrc EQ 0.
         
MESSAGE 'Error converting the input XML file' TYPE 'E'.
       
ELSE.
         
REFRESH it_return.

 

b) Read the XML table to transfer the data into the required table.

 

We are acquainted with the fields of table it_xml_info HIER, TYPE, CNAME and CVALUE.

 

We now, need to move the data from this table into the required, final table. For instance in the scenario we are creating dyanamic final Internal based on the interface data. The transfer of data from the table it_xml_info to our final table would be done in accordance with the values held by the four fields of the it_xml_info table.

 

While parsing, the values are assigned to the table it_xml_info. The values are moved depending upon the node being converted to the table.

 

Let me elaborate about the values held by the table it_xml_info.

 

i. Values held by the field HIER in XML table

a. The field ‘Hier’ would hold the value ‘1’ for the element in the root node. Since, Root node is the first level of the XML hierarchy.

b. ‘Hier’ would hold the value ‘2’ for the fields in the Element node, which is at the second level of hierarchy. In our example Header is at the second level of hierarchy.

c. The value would be ‘3’ for all the Value nodes. Here the value nodes would be NotificationNumber, OrderNumber …etc.

d.  Hence, we conclude that the value of ‘Hier’ depends upon the level of hierarchy that particular node holds in the XML file.

ii. Values held by the field TYPE in XML table

a. The value that the field ‘Type’ holds for all the elements in the Header of the XML file would be ‘A’. It would be ‘V’ for the value nodes. For all the other nodes, it would hold a blank.

iii. Values held by the field CNAME in XML table

a. Cname contains the names of the nodes. Hence, considering our example here, if the Hier is ‘2’ the Type would be blank the Cname would be ‘Header’ and the Cvalue would be blank since Header holds no value.

iv. Values held by the field CVALUE in XML table

a. Cvalue contains the values held by the elements of the various nodes of an XML file.

b. For HIER ‘3’ the Type would be ‘V’, Cname can be ‘NotificationNumber’, ‘OrderNumber’ ….Etc. and the Cvalue would be the values held by these records.

c. Here is a screen-shot of the values contained in the table it_xml_info, considering our example.

29.jpg

Now that we are acquainted with the pattern of values contained in it_xml_info, we can move these values to the required structure.


We require only the values contained in the value nodes and we have to transfer these to their respective fields of final internal table. Since, we need the values only for the value nodes we can directly move the values in the final table for a value of HIER equal to ‘3’.

 

Note: The value of HIER for which we need the data, can be manipulated in accordance with the position of the value nodes in the hierarchy of XML.

                            
We use the following code snippet to move the data:

IF gv_lines >= 1.
    ADD 1 TO gv_count.
    wa_fieldcat-col_pos    = gv_count.
    wa_fieldcat-fieldname  = 'MSGGUID'.
    wa_fieldcat-scrtext_l = 'Message ID'(h04).
    wa_fieldcat-intlen  = 255.
    APPEND wa_fieldcat TO it_fieldcatxml.
    ADD 1 TO gv_count.
    wa_fieldcat-col_pos    = gv_count.
    wa_fieldcat-fieldname  = 'MSGDATE'.
    wa_fieldcat-scrtext_l = 'Execution Date'(h01).
    wa_fieldcat-intlen  = 255.
    APPEND wa_fieldcat TO it_fieldcatxml.
    ADD 1 TO gv_count.
    wa_fieldcat-col_pos    = gv_count.
    wa_fieldcat-fieldname  = 'MSGTIME'.
    wa_fieldcat-scrtext_l = 'Execution Time'(h02).
    wa_fieldcat-intlen  = 255.
    APPEND wa_fieldcat TO it_fieldcatxml.
    ADD 1 TO gv_count.
    wa_fieldcat-col_pos    = gv_count.
    wa_fieldcat-fieldname  = 'ADMINUSER'.
    wa_fieldcat-scrtext_l = 'User Name'(h03).
    wa_fieldcat-intlen  = 255.
    APPEND wa_fieldcat TO it_fieldcatxml.


    LOOP AT it_xml_info INTO wa_xml_info WHERE hier EQ 3.
      ADD 1 TO gv_count.
      wa_fieldcat-col_pos    = gv_count.
      wa_fieldcat-fieldname  = wa_xml_info-cname.
      wa_fieldcat-scrtext_l = wa_xml_info-cname.
      wa_fieldcat-intlen  = 1024.
      APPEND wa_fieldcat TO it_fieldcatxml.
  ENDLOOP.

* Create the structure
    CALL METHOD cl_alv_table_create=>create_dynamic_table
      EXPORTING
        it_fieldcatalog          = it_fieldcatxml
      IMPORTING
        ep_table                  = gref_table
      EXCEPTIONS
        generate_subpool_dir_full = 1
        OTHERS                    = 2.
    IF sy-subrc = 0.
* build the dynamic table.
      ASSIGN gref_table->* TO <fs_table>.
      IF <fs_table> IS ASSIGNED.
        CREATE DATA gref_line LIKE LINE OF <fs_table>.
        ASSIGN gref_line->* TO <fs_line>.
      ENDIF.
    ENDIF.
    CLEAR gv_lines.
  ENDIF.
  SORT it_xml_info BY cname.
  LOOP AT it_fieldcatxml INTO wa_fieldcat.
    ASSIGN COMPONENT wa_fieldcat-fieldname OF STRUCTURE
                            <fs_line> TO <fs_t>.
    IF sy-subrc = 0.
    READ TABLE it_xml_info INTO wa_xml_info WITH KEY cname = wa_fieldcat-fieldname.
      IF sy-subrc = 0.
        <fs_t> = wa_xml_info-cvalue.
      ENDIF.
    IF wa_fieldcat-fieldname = 'MSGGUID'.
        READ TABLE it_output INTO wa_output WITH KEY
                                        msgguid = wa_payload-msgguid
                                        pid = wa_payload-pid.
        IF sy-subrc = 0.
          <fs_t> = wa_output-msgguid.
        ENDIF.
      ELSEIF wa_fieldcat-fieldname = 'MSGDATE'.
        READ TABLE it_output INTO wa_output WITH KEY
                                        msgguid = wa_payload-msgguid
                                        pid = wa_payload-pid.
        IF sy-subrc = 0.
          <fs_t> = wa_output-msgdate.
        ENDIF.
    ELSEIF wa_fieldcat-fieldname = 'MSGTIME'.
        READ TABLE it_output INTO wa_output WITH KEY
                                      msgguid = wa_payload-msgguid
                                      pid = wa_payload-pid.
        IF sy-subrc = 0.
          <fs_t> = wa_output-msgtime.
        ENDIF.
    ELSEIF wa_fieldcat-fieldname = 'ADMINUSER'.
        READ TABLE it_output INTO wa_output WITH KEY
                                        msgguid = wa_payload-msgguid
                                        pid = wa_payload-pid.
      IF sy-subrc = 0.
          <fs_t> = wa_output-adminuser.
      ENDIF.
      ENDIF.
    ENDIF.

    AT LAST.
      APPEND <fs_line> TO <fs_table>.
    ENDAT.
  ENDLOOP.
  REFRESH :it_xml_info.
  CLEAR : wa_xml_info,wa_fieldcat,wa_output.
        ENDIF.
    ENDIF.
      CLEAR :wa_output,wa_payload.
      REFRESH :it_xml_info.
    ENDLOOP.

 

Thus, we get the values in our desired structure. We populated the final table in accordance with the location.


This marks the end of our journey from the XML residing in the application server to the internal table in SAP ABAP.

 

Advantages/Disadvantages of using the FM SMUM_XML_PARSE over XSLT.


1. As apparent from the description of the entire process, the Function Module SMUM_XML_PARSE is beyond question an undemanding approach towards the XML-ABAP conversion. SMUM_XML_PARSE is an uncomplicated, unreleased, effortless and undocumented version of the powerful, released and documented iXML.


2. This function module can be used for complex XML structures by deciding upon suitable ways to segregate the data from the XML table in to the required internal table. This is entirely in our hands since; we are the ones to decide upon the structure of the final internal table required and to decide upon the HIER values of the XML table for which we need the data in the required table.


3. To turn the XML into an internal table or any other series of ABAP objects we can make use of ABAP’s CALL TRANSFORMATION keyword. Though, this unlike SMUM_XML_PARSE is very well documented in the help documentations and makes use of a XSLT template to transform XML into ABAP objects and vice versa. However, while making use of CALL TRANSFORMATION we need to create the XML schema or the XSLT program in the transaction SE80 which has to be in a definite format, failing which there can be a number of anomalies. Besides, this is a time consuming process. This adds to the complexity quotient of the CALL TRANSFORMATION method.


4. Quite often, a peculiar problem that occurs while reading the xml file using the CALL TRANSFORMATION method is- 'format not compatible with the internal table'. Hence, in order to get rid of this particular issue we further need to apply another transformation to convert the data from the internal table into the xml file. Then only, do we get the format of XML which might be utilized for conversion and is compatible with the given internal table.

 

Output Screen for XML data converted to ALV

30.jpg

 

     Complte Source Code

          Complete source code is attached with the message in .xml format.(SourceCode.xml)


Multiple directories dynamically using Custom Adapter Module

$
0
0

Hi All,

 

Below is the JAVA code for Adapter Module which I wrote for setting target directory based on source directory information.  The requirement is to read the Folder name where the files are placed and as per that Folder name we need to set the target directo

 

There are many nice blogs to tell about how to use NWDS for creating modules so not putting that information. Only the code for the Adapter Module I feel will be helpful for PI consultants.

 

 

package com.pi.adaptermodule;

 

 

import javax.ejb.Stateless;

 

 

import java.rmi.RemoteException;

import java.util.Timer;

 

 

import javax.ejb.EJBException;

import javax.ejb.SessionBean;

import javax.ejb.SessionContext;

 

 

import com.sap.aii.af.lib.mp.module.Module;

import com.sap.aii.af.lib.mp.module.ModuleContext;

import com.sap.aii.af.lib.mp.module.ModuleData;

import com.sap.aii.af.lib.mp.module.ModuleException;

import com.sap.aii.af.service.auditlog.Audit;

 

 

import com.sap.engine.interfaces.messaging.api.Message;

import com.sap.engine.interfaces.messaging.api.MessageKey;

import com.sap.engine.interfaces.messaging.api.MessagePropertyKey;

import com.sap.engine.interfaces.messaging.api.XMLPayload;

import com.sap.engine.interfaces.messaging.api.auditlog.AuditLogStatus;

 

 

/**

* Session Bean implementation class DynamicDirectoryBean

*/

@Stateless

public class DynamicDirectoryBean implements DynamicDirectoryBeanRemote, DynamicDirectoryBeanLocal,SessionBean, Module {

 

 

    /**

     * Default constructor.

     */

    public DynamicDirectoryBean() {

        // TODO Auto-generated constructor stub

    }

 

 

    public ModuleData process(ModuleContext moduleContext,ModuleData inputModuleData)throws ModuleException {

     Object obj = null;

     Message msg = null;

     MessageKey amk = null;

     String inputDir = null;

     String outputDir = null;

     String dirpath1 = moduleContext.getContextData("dirpath1");

     String dirpath2 = moduleContext.getContextData("dirpath2");

     String dirpath3 = moduleContext.getContextData("dirpath3");

     String dirpath4 = moduleContext.getContextData("dirpath4");

     String dirpath5 = moduleContext.getContextData("dirpath5");

     String dirpath6 = moduleContext.getContextData("dirpath6");

 

     String folderName1 = moduleContext.getContextData("folderName1");

     String folderName2 = moduleContext.getContextData("folderName2");

     String folderName3 = moduleContext.getContextData("folderName3");

     String folderName4 = moduleContext.getContextData("folderName4");

     String folderName5 = moduleContext.getContextData("folderName5");

     String folderName6 = moduleContext.getContextData("folderName6");

 

     try{

     // Retrieves the current principle data, usually the message , Return type is Object

     obj = inputModuleData.getPrincipalData();

     // A Message is what an application sends or receives when interacting with the Messaging System.

     msg = (Message) obj;

     // MessageKey consists of a message Id string and the MessageDirection

     amk = new MessageKey(msg.getMessageId(),msg.getMessageDirection());

     // Audit log message will appear in MDT of Channel Monitoring

     Audit.addAuditLogEntry(amk, AuditLogStatus.SUCCESS,"Dynamic Directory Module called");

     // Returns the main document as XMLPayload

     XMLPayload xpld = msg.getDocument();

     //Reading the directory from message header

     MessagePropertyKey mpk = new MessagePropertyKey("Directory","http://sap.com/xi/XI/System/File");

     inputDir = msg.getMessageProperty(mpk);

     Audit.addAuditLogEntry(amk, AuditLogStatus.SUCCESS, "directory is" + inputDir );

     if(inputDir.contains(folderName1))

     {

           outputDir = dirpath1;  

     }

 

     else if (inputDir.contains(folderName2))

     {

           outputDir = dirpath2;

     }

 

     else if (inputDir.contains(folderName3))

     {

           outputDir = dirpath3;

     }

 

     else if (inputDir.contains(folderName4))

     {

           outputDir = dirpath4;

     }

 

     else if (inputDir.contains(folderName5))

     {

           outputDir = dirpath5;

     }

 

     else if (inputDir.contains(folderName6))

     {

           outputDir = dirpath6;

     }

 

 

     //setting directory in the message header

     MessagePropertyKey dir = new MessagePropertyKey("Directory","http://sap.com/xi/XI/System/File"); 

     msg.setMessageProperty(dir,outputDir);

     Audit.addAuditLogEntry(amk, AuditLogStatus.SUCCESS, "target directory is " + outputDir );

     Audit.addAuditLogEntry(amk, AuditLogStatus.SUCCESS, "Directory is Successfully set");

     // Sets the principle data that represents usually the message to be processed

     Audit.addAuditLogEntry(amk, AuditLogStatus.SUCCESS, "Message Successfully updated");

     inputModuleData.setPrincipalData(msg);

     return inputModuleData;

     }

     catch (Exception e) {

              ModuleException me = new ModuleException(e);

              throw me;

     }

    }

    /* (non-Javadoc)

     * @see javax.ejb.SessionBean#ejbActivate()

     */

     public void ejbActivate() throws EJBException, RemoteException {

     // TODO Auto-generated method stub

     }

     /* (non-Javadoc)

     * @see javax.ejb.SessionBean#ejbPassivate()

     */

     public void ejbPassivate() throws EJBException, RemoteException {

     // TODO Auto-generated method stub

     }

     /* (non-Javadoc)

     * @see javax.ejb.SessionBean#ejbRemove()

     */

     public void ejbRemove() throws EJBException, RemoteException {

     // TODO Auto-generated method stub

     }

     /* (non-Javadoc)

     * @see javax.ejb.SessionBean#setSessionContext(javax.ejb.SessionContext)

     */

     public void setSessionContext(SessionContext context) throws EJBException,RemoteException {

     }

     /* (non-Javadoc)

     * @see javax.ejb.TimedObject#ejbTimeout(javax.ejb.Timer)

     */

     public void ejbTimeout(Timer arg0) {

     // TODO Auto-generated method stub

     }

     public void ejbCreate() throws javax.ejb.CreateException {

     }

 

 

}

Set SOAP Action dynamically using Adapter Module

$
0
0

If you are having a requirement of setting SOAP action in single channel, we could go with custom adapter module. The code which I am using is as below:

 

package com.pi.module;

 

import javax.ejb.Stateless;

 

import java.rmi.RemoteException;

import java.util.Timer;

 

import javax.ejb.EJBException;

import javax.ejb.SessionBean;

import javax.ejb.SessionContext;

 

import javax.xml.parsers.*;

 

import org.w3c.dom.*;

 

import com.sap.aii.af.lib.mp.module.Module;

import com.sap.aii.af.lib.mp.module.ModuleContext;

import com.sap.aii.af.lib.mp.module.ModuleData;

import com.sap.aii.af.lib.mp.module.ModuleException;

import com.sap.aii.af.service.auditlog.Audit;

 

import com.sap.engine.interfaces.messaging.api.Message;

import com.sap.engine.interfaces.messaging.api.MessageKey;

import com.sap.engine.interfaces.messaging.api.MessagePropertyKey;

import com.sap.engine.interfaces.messaging.api.XMLPayload;

import com.sap.engine.interfaces.messaging.api.auditlog.AuditLogStatus;

 

/**

* Session Bean implementation class DynamicSOAPAction

*/

@Stateless

publicclassDynamicSOAPActionimplements DynamicSOAPActionRemote, DynamicSOAPActionLocal,SessionBean, Module {

 

    /**

     * Default constructor.

     */

    public DynamicSOAPAction() {

// TODO Auto-generated constructor stub

    }

 

    public ModuleData process(ModuleContext moduleContext,ModuleData inputModuleData)throws ModuleException {

Object obj = null;

Message msg = null;

MessageKey amk = null;

String soapAction = null;

 

      

          String createSOAPAction = (String) moduleContext.getContextData("CreateAction");

String deleteSOAPAction = (String) moduleContext.getContextData("DeleteAction");

String modifySOAPAction = (String) moduleContext.getContextData("ModifyAction");

String rootNode1 = (String) moduleContext.getContextData("CreateNode");

String rootNode2 = (String) moduleContext.getContextData("DeleteNode");

String rootNode3 = (String) moduleContext.getContextData("ModifyNode");

 

          try{

// Retrieves the current principle data, usually the message , Return type is Object

obj = inputModuleData.getPrincipalData();

// A Message is what an application sends or receives when interacting with the Messaging System.

msg = (Message) obj;

// MessageKey consists of a message Id string and the MessageDirection

amk = new MessageKey(msg.getMessageId(),msg.getMessageDirection());

// Audit log message will appear in MDT of Channel Monitoring

Audit.addAuditLogEntry(amk, AuditLogStatus.SUCCESS,"Dynamic SOAPAction Module called");

// Returns the main document as XMLPayload

XMLPayload xpld = msg.getDocument();

 

                // read XML Root node

                DocumentBuilderFactory factory;

                factory = DocumentBuilderFactory.newInstance();

                DocumentBuilder builder = factory.newDocumentBuilder();

Document document = builder.parse(xpld.getInputStream());

 

                String rootNode = document.getDocumentElement().getNodeName();

 

                Audit.addAuditLogEntry(amk, AuditLogStatus.SUCCESS,"Root Node Name is " + rootNode );

if (rootNode.equals(rootNode1))

soapAction = createSOAPAction;

            

                elseif (rootNode.equals(rootNode2))

soapAction = deleteSOAPAction;

 

                elseif (rootNode.equals(rootNode3))

soapAction = modifySOAPAction;

 

                //setting Action in the message header

MessagePropertyKey action = new MessagePropertyKey("THeaderSOAPACTION","http://sap.com/xi/XI/System/SOAP"); 

                msg.setMessageProperty(action, soapAction);

Audit.addAuditLogEntry(amk, AuditLogStatus.SUCCESS, "Soap action Set as" + soapAction );

Audit.addAuditLogEntry(amk, AuditLogStatus.SUCCESS, "Soap action successfully set");

// Sets the principle data that represents usually the message to be processed

Audit.addAuditLogEntry(amk, AuditLogStatus.SUCCESS, "Message Successfully updated");

inputModuleData.setPrincipalData(msg);

return inputModuleData;

          }

catch (Exception e) {

Audit.addAuditLogEntry(amk, AuditLogStatus.ERROR, "Message processing failed..");

ModuleException me = new ModuleException(e);

throw me;

}

    }

    /* (non-Javadoc)

     * @see javax.ejb.SessionBean#ejbActivate()

     */

     publicvoid ejbActivate() throws EJBException, RemoteException {

     // TODO Auto-generated method stub

     }

     /* (non-Javadoc)

     * @see javax.ejb.SessionBean#ejbPassivate()

     */

     publicvoid ejbPassivate() throws EJBException, RemoteException {

     // TODO Auto-generated method stub

     }

     /* (non-Javadoc)

     * @see javax.ejb.SessionBean#ejbRemove()

     */

     publicvoid ejbRemove() throws EJBException, RemoteException {

     // TODO Auto-generated method stub

     }

     /* (non-Javadoc)

     * @see javax.ejb.SessionBean#setSessionContext(javax.ejb.SessionContext)

     */

     publicvoid setSessionContext(SessionContext context) throws EJBException,RemoteException {

     }

     /* (non-Javadoc)

     * @see javax.ejb.TimedObject#ejbTimeout(javax.ejb.Timer)

     */

     publicvoid ejbTimeout(Timer arg0) {

     // TODO Auto-generated method stub

     }

     publicvoid ejbCreate() throws javax.ejb.CreateException {

     }

 

}


2.JPG



1.JPG

How to consume web services hosted by SAP PI / PO

$
0
0

This blog is about how to consume web services hosted by SAP PI / PO

 

 

Direct link: Consume web services hosted by SAP PI PO

 

Please test these web services in sandbox using SoapUI, as there is little SAP documentation of these web services. SAP may even add more web services in future.


Code used in the video:-

Java Language:-
-----------------------------
package com.web;
import java.net.Authenticator;
import java.net.HttpURLConnection;
import java.net.PasswordAuthentication;
import java.net.URL;
public class TestMain {  public static void main(String[] args) throws Exception {  Authenticator.setDefault(new Authenticator() {  // This method is called when a password-protected URL is accessed  @Override  protected PasswordAuthentication getPasswordAuthentication() {  return new PasswordAuthentication("UserId", "Password".toCharArray());  }  });  HttpURLConnection con = (HttpURLConnection) new URL("http://Server:50200/ChannelAdminService/ChannelAdmin").openConnection();  con.setRequestMethod("POST");  con.setRequestProperty("content-type", "text/xml");  con.setDoOutput(true);  String s = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:urn=\"urn:com:sap:netweaver:pi:monitoring\">" +  "   <soapenv:Header/>" +  "   <soapenv:Body>" +  "      <urn:getChannelAutomationStatus>" +  "         <!--Zero or more repetitions:-->" +  "         <channels name=\"CC_File_Sender\" service=\"BC_Test\" party=\"\">" +  "         </channels>" +  "      </urn:getChannelAutomationStatus>" +  "   </soapenv:Body>" +  "</soapenv:Envelope>";  con.getOutputStream().write(s.getBytes());  byte[] b = new byte[con.getInputStream().available()];  con.getInputStream().read(b);  System.out.println(new String(b));  }
}
-----------------------------------------------------------------------------------------------------------------------------------------------------
Java Language (using WSDL):-
-----------------------------
package com.web;
import java.net.MalformedURLException;
import java.util.ArrayList;
import java.util.List;
import javax.xml.ws.BindingProvider;
import com.sap.netweaver.pi.monitoring.ChannelAdminDescriptor;
import com.sap.netweaver.pi.monitoring.ChannelAdminStatus;
import com.sap.pi.monitoring.channel.ChannelAdminService;
import com.sap.pi.monitoring.channel.GetChannelAutomationStatusFault;
import com.sap.pi.monitoring.channel.IChannelAdmin;
public class MyMain {  public static void main(String[] args) throws MalformedURLException, GetChannelAutomationStatusFault {  IChannelAdmin ica = new ChannelAdminService().getChannelAdminPort();  BindingProvider bp = (BindingProvider) ica;  bp.getRequestContext().put(BindingProvider.USERNAME_PROPERTY, "UserId");  bp.getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, "Password");  ChannelAdminDescriptor cad = new ChannelAdminDescriptor();  cad.setName("CC_File_Sender");  cad.setService("BC_Test");  cad.setParty("");  List<ChannelAdminDescriptor> cadL = new ArrayList<ChannelAdminDescriptor>();  cadL.add(cad);  for (ChannelAdminDescriptor c : ica.getChannelAutomationStatus(cadL)) {  System.out.println(c.getName());  System.out.println(c.getService());  List<ChannelAdminStatus> status = c.getStatus();  System.out.println(status.get(0).getActivationState());  }  }
}
-----------------------------------------------------------------------------------------------------------------------------------------------------
Go Language:-
-----------------------------
package main
import (  "bytes"  "fmt"  "io/ioutil"  "net/http"
)
func main() {  in := `<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:com:sap:netweaver:pi:monitoring">   <soapenv:Header/>   <soapenv:Body>      <urn:getChannelAutomationStatus>         <!--Zero or more repetitions:-->         <channels name="CC_File_Sender" service="BC_Test" party="">                 </channels>      </urn:getChannelAutomationStatus>   </soapenv:Body></soapenv:Envelope>`  req, _ := http.NewRequest("POST", "http://Server:50200/ChannelAdminService/ChannelAdmin", bytes.NewBufferString(in))  req.SetBasicAuth("UserId", "Password")  req.Header.Set("content-type", "text/xml")  client := http.Client{}  res, _ := client.Do(req)  resB, _ := ioutil.ReadAll(res.Body)  fmt.Println(string(resB))
}

Helpful Links: -

User roles required to perform above actions Assigning Permissions - SAP Library

How to use Integration Directory API

Web service navigator: - http://<host>:<port>/wsnavigator .

Single Service Administration: - http://<host>:<port>/nwa/ssadmin

Near Zero Downtime Maintenance for SAP NetWeaver Process Integration (nZDM/PI)

$
0
0

In case that you require a minimized downtime for update/upgrade activities of your PI systems, here some good news. Several customers are already expounding the benefits of our near Zero Downtime Maintenance (nZDM) tool offering for importing Support Package Stacks with minimal business downtime of 30 to 60 minutes in average. The nZDM for SAP PI tool is provided free-of-charge as part of the SL Toolset. Considering upgrades to SAP PI 7.31 or PI 7.40, the nZDM feature in SUM might help to mitigate the downtime issue. Here you can expect a downtime reduction of 10 to 30 minutes. The nZDM in SUM for SAP PI is available on request.

View this Presentation

Process Integration - Previously Featured

$
0
0
Previously featured

/profile-image-display.jspa?imageID=3583&size=72What's new in SAP Process Orchestration 7.31 SP15 / 7.4 SP10

Read the blog by Alexander Bundschuh and get insight of the latest enhancements of SAP Process Orchestration that are available since March this year. April 2015

/profile-image-display.jspa?imageID=52207&size=72Innovate and Monetize with SAP HANA Cloud Integration as an SAP Partner

Read Vladimir Dinev's blog and register for the upcoming 5-webinar series to learn about SAP HANA Cloud Integration and explore the opportunities it opens up to you as a partner. April 2015

http://scn.sap.com/profile-image-display.jspa?imageID=33801&size=72Next stop of SAP HANA Cloud Integration Info Day Tour will be in Belgium - April 23th

Join us in Belgium on April 23th for a free Info Day and get in contact with the development team of SAP HANA Cloud Integration. We will share news on capabilities, supported scenarios and new editions. Follow Udo Paltzer to find out about other locations coming soon. April 2015

/profile-image-display.jspa?imageID=32145&size=72Customer Use Cases for SAP HANA Cloud Integration

Sujit Hemachandran has published a whitepaper about the current major customer use cases for SAP HCI. Read the blog for more information and check out the link to the whitepaper. Mar. 2015

SAP HANA Cloud Integration - a Complementary Offering to PO

Is HCI only PI in the sky? No! Read the blog by Piyush Gakhar that explains the differences and aims you with detailed decision arguments when to use what.

/profile-image-display.jspa?imageID=58202&size=72SAP HANA Cloud Integration Webinar

In this 60 minutes webinar presented by Sindhu Gangadharan you can understand the core product capabilities of SAP HANA Cloud Integration. You can also see how partners like Itelligence are building a SalesForce adapter using the adapter SDK of HCI. The webinar is part of a series hosted by SAPInsider and has already been broadcasted. Register now and get access to the OnDemand version. Jan. 2015

/profile-image-display.jspa?imageID=52207&size=72SAP HANA Cloud Integration for Application-Development Partners

Partners have now the possibility to use SAP HCI for application development to commercialize innovative cloud solutions. Read the blog by Vladimir Dinev to get first insight to the new SAP HANA Cloud Integration Partner Edition. Jan. 2015

/profile-image-display.jspa?imageID=32145&size=72Architectural Overview of SAP HANA Cloud Integration

SAP HANA Cloud Integration is SAP's strategic cloud-based integration as a service solution. Within his blogSujit Hemachandran presents an architectural overview and highlights also the advantages. Jan. 2015

Understanding Authentication and Testing Connectivity in SAP HANA Cloud Integration

This blog series explores the different options to connect systems to SAP HANA Cloud Integration. In the first 2 blogs the supported authentication types are presented, in the later you gain the understanding of the connectivity steps and the connectivity testing. Jan. 2015

Basic Monitoring and Administration with SAP HANA Cloud Integration

Integration Developers get now insight on message monitoring and administration with the Integration Operations plug-in. In this blogSujit Hemachandran explains the monitoring basics including also the status checks of the deployments and how to understand the logs in SAP HANA Cloud Integration. Jan. 2015

Ten Integration Developer Blogs on SAP HANA Cloud Integration

Sujit Hemachandran explains in extensive blogs important features for Integration Developers. Watch  the technical knowledge sharing  series and get access e.g. to several patterns that may be used in integration flows. Jan. 2015

http://scn.sap.com/profile-image-display.jspa?imageID=55640&size=72SAP PI Rest Adapter

Watch  Ivo Kulm's collection of blog entries for the PI REST Adapter that shows architectural concepts and configuration for integrating your SAP PI landscape with other REST services. Dec 2014

http://scn.sap.com/profile-image-display.jspa?imageID=3583&size=72SAP HANA Cloud Integration Web Tooling

Get insight how pre-packaged integration content that is available in the public content catalogue may be directly consumed and if necessary also be extended. Read this blog written by Anette Asmus to understand how to use the Web User Interface for SAP HCI. Dec. 2014

OData Adapter in SAP HANA Cloud Integration

Sabarish T S provides in his blog an excellent overview on the OData Adapter and OData support with the SuccessFactors Adapter that are offered with SAP HANA Cloud Integration. Dec. 2014

Watch the SAP TechEd && d-code Replays!

If you've missed the integration sessions @ TechEd && d-code in Las Vegas, October 20-24 take now the opportunity to watch the replays and receive the newest highlights of our SAP Process Orchestration / SAP Process Integration and HANA Cloud Integration. Nov.2014

Results of the Global SAP PI survey now available

The results of this year's global PI survey is now published. As every year the International Focus Group for Integration conducted a survey and 362 users from over 20 different user groups participated. Watch Holger Himmelmann's blog to see the first part of the results with the analysis of general questions. Nov. 2014

http://scn.sap.com/profile-image-display.jspa?imageID=52207&size=72New adapter in SAP Process Integration for consumption and provisioning of REST based services

With the latest SP of SAP Process Orchestration / SAP Process Integration our REST adapter is available. Read Alexander Bundschuh's blog to get more details. Nov. 2014

http://scn.sap.com/profile-image-display.jspa?imageID=12116&size=72Impact of Integration changes - How to talk to non-SAP systems

Read this third blog of a series by Owen Pettiford that gives an excellent view on the new world of SAP's solution set supporting process and data integration. He explains how to take the advantages of the long list of capabilities depending on existing integration reqirements and gives rules for futher decisions. Nov. 2014

http://scn.sap.com/profile-image-display.jspa?imageID=3583&size=72New Adapters for Running Hybrid Scenarios with SAP Process Integration

Get a comprehensive overview on recent enhancements in terms of connectivity for SAP Process Integration that facilitates support for hybrid scenarios. Alexander Bundschuh presents in his blog the new adapters for integrating on-premise applications with services provided in the cloud. Nov. 2014

SAP has released SP4 for B2B Add-on and Secure Connectivity Add-on

After SAP's announcement that B2B is now included in the SAP Process Orchestration license the Support Package 4 is now released with important enhancements. Get an overview on the major enhancements with the blog by Piyush Gakhar. Oct. 2014

http://scn.sap.com/profile-image-display.jspa?imageID=51093&size=72Reduce your integration efforts with the new solution "Integration Advisor"

The Integration Advisor is a new cloud based solution running on SAP HANA Cloud Integration (HCI) starting with its beta program in January 2015. This tool will tremendously improve and simplify the entire B2B integration project by bringing the different integration phases of business domain experts and integration experts together and by using crowd sourcing based intelligence. Read Gunther Stuhec's article to understand the new solution and have a look on his blog describing his believe how tomorrow's simplified environment for B2B integration will look like. Oct 2014

RKT Workshop on SAP HANA Cloud Integration

We are organizing a RKT workshop for SAP HANA Cloud Integration (SAP HCI) in Bangalore on Nov. 20+21, 2014. Visit us and get deep insight on SAP HCI with solution details, use cases and hands-on exercises. Find more information and the registration link in the blog by Piyush GakharOct. 2014

Results of Global Process Integration Survey 2014

The blog by Holger Himmelmann reveals the results of the 2014 global SAP PI survey. Thanks to everyone who participated and shared their feedback!
See also the central blog International Focus Group for SAP Process Integration (IFG for SAP PI) that gives you the background of the first initiative of SAP user groups around the globe in the area of SAP PI. Oct 2014

Build your SAP TechEd && d-code agenda!

Have you already finalized your agenda for TechEd && d-code Las Vegas? The event in Las Vegas is now just one week ahead. Don’t miss the integration sessions @ TechEd && d-code in Las Vegas, October 20-24. Take the advantage to meet the integration experts in person and receive the newest highlights of our on-premise and also cloud-based integration platform. Learn in demo rich lectures and hands-on trainings how SAP integration technologies, like SAP HANA Cloud Integration and SAP Process Orchestration are being used for the integration of SAP's cloud pillars. Get insights into the current solutions and road maps and get a preview on prepackaged content for jump-starting your integration projects. Get on overview on relevant SAP Middleware-related sessions with the blog by Smadar Ludomirski and read the blog by Gunther Stuhec to know all important sessions to understand the new tool of the Integration Advisor and see how it will work in real. Oct 2014

Meet SAP at “I love API 2014” Conference Sep 8 – 10 in San Francisco

I  Love APIs 2014 is the conference for business and technology leaders driving digital acceleration with big data and APIs hosted by Apigee. This year SAP has strong presence at the event following the recent strategic partnership announcement  made between SAP and Apigee at end of July. August 2014

http://scn.sap.com/profile-image-display.jspa?imageID=36535&size=72OData Adapter and SFSF Adapter (extensions) for SAP Process Integration

SP1 of the SAP Process Integration, connectivity add-on 1.0 has just been released. This release consists of an OData Adapter and extensions to the existing SFSF Adapter. Find out more in this blog by Finny Babu and reach out to him with any questions. July 2014

http://scn.sap.com/profile-image-display.jspa?imageID=33801&size=72 SAP HANA Cloud Integration Info Day Tour starting in Walldorf, Germany on July 30th

SAP HANA Cloud Integration (HCI) is SAP’s strategic integration platform to integrate SAP Cloud applications with other systems, SAP and non-SAP, on premise or on the cloud. The new SAP HANA Cloud Integration editions: Standard and Professional allow organizations to leverage SAP HCI in arbitrary (i.e. any system to any system) integration scenarios. Join us in Walldorf on July 30th for a free info day to learn more and try HANA Cloud Integration hands-on! Follow Udo Paltzer to find out about other locations coming soon. July 2014

2014 Global SAP Process Integration Survey

The yearly PI survey is open until August 19th and the 2014 special topics are BPM and Process Orchestration. The survey aims to collect information about the latest state of positioning, organization and use in companies using SAP PI or SAP Process Orchestration as an integration platform. You will find all details and survey access link in Holger Himmelmann’s blog. Participate and help beat the 2013 response record! July 2014

Get your free seat for the Intelligent Business Operations #IBO Tech Academy in the UK on 25/7

With this blog Tony Read invites you to join SAP and CompriseIT for a hands-on workshop on Intelligent Business Operations covering SAP Process Orchestration and SAP Operational Process Intelligence on HANA. The workshop is free for all SAP customers and prospects. Next opportunity in the UK is on 25/7. Seats are limited so mail Tony to book your seat today. June 2014

http://scn.sap.com/profile-image-display.jspa?imageID=32385&size=72HANA Cloud Integration: Webinar Series

In this blog Meghna Shishodiya announces a new HANA Cloud Integration (HCI) webinar series starting on May 29 with an overview, architecture and security aspects. Bookmark the blog for upcoming dates and join us to learn everything you wanted to know about hci and get your questions answered. May 2014

http://scn.sap.com/profile-image-display.jspa?imageID=9293&size=72 2014 Webcast Series: Tap into business agility with SAP Middleware solutions

These informative public webcasts will showcase the advantages of SAP Middleware offerings that build on the trusted SAP NetWeaver technologies and leverage SAP HANA and the cloud. Grab your seat for the 1st webcast on April 30 for a talk on Intelligent Business Operations: Infuse Big Data insights into your processes in real-time. April 2014

SAP HANA Cloud Integration (HCI) Roadmap Webinar - 3 July

How much do you know about SAP HCI? How it is leveraged for integration of SAP Cloud solutions, such as Cloud for Customers, SuccessFactors, Ariba etc. Join us for a roadmap session to learn the latest innovations and planning for HCI and get your questions answered. June 2014

SAP Process Orchestration Roadmap webinar - recording is now available!http://scn.sap.com/profile-image-display.jspa?imageID=9293&size=72

The webinar covers the latest innovations and planning for SAP Process Orchestration. You will also learn how Process Orchestration customers can benefit by enabling intelligent business operations ibo on the SAP HANA platform and how to take advantage of other Middleware offerings such as SAP Gateway and SAP HANA Cloud Integration hci. June 2014

12/6 - global webcast on Intelligent Business Operations: Infuse bigdata insights into your business processes in realtime

This webcast will showcase real-life examples of how to work smarter by infusing #BigData insights into your processes, how to take corrective actions when or even before issues occur, anticipate what will happen using predictive analytics, gain real-time visibility into your end-to-end operations. Register for the live event on 12/6 and/ or to get the slides and replay. June 2014

Middleware Tech Academies at Saphila 2014 - 9&10 Junehttp://scn.sap.com/profile-image-display.jspa?imageID=9293&size=72

If you plan to attend the conference do not miss the Intelligent Business Operations ibo hands-on workshops. On both 9 & 10 June you have the opportunity to learn more about the SAP IBO technology bundle and try the software. June 2014

http://scn.sap.com/profile-image-display.jspa?imageID=25498&size=72SP11 of SAP Process Orchestration 7.31 is now available in Public Cloud!

If you are using the SAP Process Orchestration trial offering on AWS, check this blog by Abhinag Palvadi. You can now access an instance with the latest available version - SP11 equivalent to SP6 of SAP Process Orchestration 7.4. May 2014

2014 Global SAP Process Integration Survey

The yearly PI survey is now open and the 2014 special topics are BPM and Process Orchestration. The survey aims to collect information about the latest state of positioning, organization and use in companies using SAP PI or SAP Process Orchestration as an integration platform. You will find all details and survey access link in Holger Himmelmann’s blog. Participate and help beat the 2013 response record! May 2014

May 27th - join us for an SAP Process Orchestration Roadmap Webinar!http://scn.sap.com/profile-image-display.jspa?imageID=9293&size=72

The webinar will be delivered by SAP Product Management and will cover the latest innovations and planning for SAP Process Orchestration. You will also learn how Process Orchestration customers can benefit by enabling intelligent business operations ibo on the SAP HANA platform and how to take advantage of other Middleware offerings such as SAP Gateway and SAP HANA Cloud Integration hci. May 2014

SP3 of B2B Add-On and Secure Connectivity Add-On Released!

In this blog Piyush Gakhar introduces all new features and improvements with the SP3 release, like secure PGP key storage, multiple directory support for SFTP adapter, SLA alerts, enhanced AS2 support, EDI content manager and more. April 2014

http://scn.sap.com/profile-image-display.jspa?imageID=29670&size=72New roadmap for SAP Process Orchestration is now available

In this blog Christian Loos announces that the former individual PI and BPM product roadmaps have been combined into one single Process Orchestration roadmap. Review all planned innovations and stay tuned for the upcoming roadmap webcast. April 2014

http://scn.sap.com/profile-image-display.jspa?imageID=36535&size=72SuccessFactors (SFSF) Adapter for SAP NetWeaver Process Integration

In this blog Finny Babu introduces the new “SFSF Adapter” released by SAP in February 2014. This adapter is now available as part of the release independent SAP NetWeaver Process Integration, connectivity add-on 1.0. Mar 2014

SAP Middleware newsletter – the newest addition to the SCN newsletters family!

Free monthly insight into all innovations in ALM, Software Logistics, Software Defined Data Center solutions, Virtualization & Cloud Management, Architecture, Process Orchestration, Decision Service Management,Operational Process Intelligence, SAP HANA Cloud Integration, Big Process and Big Data and powerful technology bundles like Intelligent Business Operations powered by SAP HANA. Mar 2014

http://scn.sap.com/profile-image-display.jspa?imageID=33801&size=72Survey: usage of cloud based business scenarios and their integration

Your opinion counts! With this blog Udo Paltzer invites you to invest 5-10 mins of your time to support a scientific study carried out by Itelligence AG, SAP and the University of Paderborn. Take the short survey to help us understand your requirements, knowledge, acceptance, complexity and safety concerns around using "services from the cloud". Mar 2014

Explained: the new B2B Trading Partner Management functionality

In this blog Shilpa Nair and Sarath Sasi provide a summary and links to all recent content on the new Trading Partner Management functionality shipped with SP2 of the SAP Process Orchestration B2B Add-on. Feb 2014

http://scn.sap.com/profile-image-display.jspa?imageID=3583&size=72 Improved monitoring of B2B scenarios running on SAP NetWeaver Process Orchestration - Part 1, Part 2 and Part 3

In this blog series, Alexander Bundschuh focuses on the new improvements which help enhance monitoring and tracking of your B2B business transactions and how SAP customers using the B2B add-on with SAP NetWeaver Process Integration & Orchestration may benefit from the latest enhancements shipped with SP02 of the B2B add-on. Also read about the new central monitor with SAP Solution Manager 1.0 SP10, the so called Message Flow Monitoring, which provides you with an end-to-end insight into the correct closure of A2A and B2B conversations. Feb 2014

http://scn.sap.com/profile-image-display.jspa?imageID=31689&size=72Your SAP PI 7.31 Demo System on Amazon Web Services

In this blog Arman Eker shares his “awesome experience” with the free Process Orchestration developer trial system which he used to learn how to build PI 7.31 on a single stack and to prepare a PI video course with over 3 hours of PI 7.31 content. Here is his Post configuration steps blog. Check it out and set up your own system - it’s easy and it’s fun! Feb 2014

IFG Survey: Central PI Monitoring with SAP Solution Manager

Monitoring is a key challenge according to the global 2013 PI survey. To gain a better understanding of the situation and requirements, the IFG for PI and SAP have launched a follow-up survey with focus on central PI monitoring with SAP Solution Manager. Read all details in Holger Himmelmann’s blog and participate. Jan 2014

SAP Orchestration and Integration Solutions: TechEd 2013 Replays

Missed TechEd? In this blog Gabriela Gahse highlights the available replays from TechEd Las Vegas 2013 and invites you to check the latest and greatest on B2B with Process Orchestration and HANA Cloud Integration hci , SAP Operational Process Intelligence opint, as well as Business Rules and Decision Service Management dsm with SAP. Jan 2014

Released: SAP NetWeaver Process Orchestration B2B Add-On SP2

In this blog Piyush Gakhar highlights the main enhancements with the latest SP like Trading Partner Management, new Messages Support for Tradacoms and EANCOM. Read this blog for a full overview of all new EDI and B2B features and enhancements. Dec 2013

http://scn.sap.com/profile-image-display.jspa?imageID=33801&size=72

Roadmap for SAP HANA Cloud Integration

In this presentation Udo Paltzer provides an overview of the current capabilities and uses cases, as well as the roadmap for SAP HANA Cloud Integration (HCI). Do not miss the HCI library on SCN where you can find everything about hci in one place. Dec 2013

http://scn.sap.com/profile-image-display.jspa?imageID=9293&size=72What's new in Process Orchestration 7.31 SP09 | 7.4 SP04

Key enhancements with SP09 are SAP NetWeaver Process Orchestration on HANA, co-deployment of SAP NetWeaver Process Orchestration and SAP OPInt opint  on the same HANA system and ValueHelp API. This blog by Mariana Mihaylova highlights all enhancements for customers running Business Process Management, Process Integration and Orchestration scenarios. Dec 2013

http://scn.sap.com/profile-image-display.jspa?imageID=3583&size=72SAP NetWeaver Process Orchestration @ SAP TechEd Bangalore 2013

If you are lucky to be in Bangalore this week, this blog by Alexander Bundschuh may help you to build your Integration and Orchestration agenda. Join our experts to find the latest and greatest about BPM | PI | Process Orchestration, SAP HANA Cloud Integration, Business Rules, B2B and SAP Operational Process Intelligence powered by SAP HANA. Dec 2013

Results: Global SAP NetWeaver PI Survey 2013 - Part 1 of 2 and Part 2 of 2

These two blogs by Holger Himmelmann reveal the results of the 2013 global SAP NetWeaver PI survey. Thanks to everyone who participated and shared their feedback! Nov 2013

http://scn.sap.com/profile-image-display.jspa?imageID=3091&size=72Integration: Extracts from TechEd LV 2013

Process Orchestration, HANA Cloud Integration, OData and more. Read the summary and key takeaways of SAP Mentor Shabarish Vijayakumar from the integration arena at this year’s teched_las_vegas. Nov 2013

http://scn.sap.com/profile-image-display.jspa?imageID=33801&size=72SAP HANA Cloud Integration – Early Customer and Partner Project

In this blog Udo Paltzer shares details about the opportunity to get hands-on experience with SAP HANA Cloud Integration. Join the program and become one of the early adopters! Nov 2013
http://scn.sap.com/profile-image-display.jspa?imageID=32385&size=72

SAP HANA Cloud Integration (HCI): Getting Started

The first set of projects are underway in the HCI space, and now is a good time to get a closer look at the HCI world. Review this blog by Meghna Shishodiya and also the SAP HANA Cloud Integration: An Intro by Sujit Hemachandran. Nov 2013

http://scn.sap.com/profile-image-display.jspa?imageID=3583&size=72SAP NetWeaver Process Orchestration @ SAP TechEd 2013

teched_amsterdam is in full swing now! Find out from Alexander Bundschuh which sessions are a must see in the areas of SAP NetWeaver BPM | PI | Process Orchestration, SAP HANA Cloud Integration, Business Rules, B2B and SAP Operational Process Intelligence powered by SAP HANA. Nov 2013

http://scn.sap.com/people/agasthuri.doss/avatar/46.png?a=26747Protocol Decision Tree Between SAP ECC and SAP Process Orchestration

In this blog, Agasthuri Doss introduces a decision tree to select the appropriate integration method between ECC and SAP Process Orchestration environments and between SAP Process Integration and client business systems.

http://scn.sap.com/profile-image-display.jspa?imageID=29670&size=72What's new in SAP Process Orchestration 7.31 SP8/7.4 SP3 + Video

In this blog Christian Loos shares all new enhancements for customers running Business Process Management, Process Integration and Orchestration scenarios. He has highlighted the most important new features in a short video.

Webcast: SP1 of B2B Add-on with SAP NetWeaver Process Orchestration> Overview and Roadmap

This session is part of the ramp-up knowledge transfer program and will be presented by Piyush Gakhar from SAP Product Management. Read this blog for details and join us on Sep 30 or Oct 1!

http://scn.sap.com/profile-image-display.jspa?imageID=25498&size=72Step by Step guide to update Advanced Adapter Engine System to Process Orchestration System

Upgrade of AEX to Process Orchestration System is supported from 7.31 SP0 onwards. In this article Abhinag Palvadi explains in detail the steps of the upgrade.

SAP NetWeaver Process Orchestration – the best is yet to come!

In this blog Volker Stiehl explains why you should opt in for Process Orchestration as your single Middleware platform from SAP. Also check in detail What is new in SP7 of SAP NetWeaver Process Orchestration 7.31 and see all new and continuous investments that make SAP’s Middleware platform best in class.

Global SAPNetWeaver PI Survey 2013: new record and 4 weeks to go!

The survey will be closed on August 24th. Read more in Holger Himmelmann’s latest blog and do not miss to share your feedback. Thanks to everyone who already participated.

How AmerisourceBergen uses SAP’s Process Orchestration technologies

In this blog Eduardo Chiocconi is sharing key takeaways from SAPPHIRE NOW 2013 and highlighting a great customer story. Watch the full session replay to learn how AmerisourceBergen,one of the world's largest pharmaceutical services companies is transforming their business with SAP NetWeaver Process Orchestration technologies.

SAP NetWeaver Process Orchestration Webcast Series 2013

Join us for a 5 webcast series to hear latest news about Process Management software from SAP: SAP NetWeaver Process Orchestration including B2B, SAP Operational Process Intelligence and SAP NetWeaver Decision Service Management. Please share with anyone who may be interested. We look forward to meeting you there.

Global Survey for SAP NetWeaver Process Integration 2013

The 2013 PI survey is now on and the focus this year is, not surprisingly, B2B and EDI. More details and survey access link in Holger Himmelmann’s blog. We look forward to your participation.

Try SAP NetWeaver Process Orchestration in Public Cloud!

SAP is now giving you a free license to try SAP NetWeaver Process Orchestration in the cloud. Read this blog to see how you can get started.

Simple use-cases with SAP NetWeaver Process Orchestration B2B Add-on

Check these new articles by Vikas Singh Rajpurohit providing use-cases and configuration options of OFTP; SFTP and PGP; AS2 and EDI Separator; Modules and X400 adapter available with the SAP B2B Add-on.

* What is new in SP6 of SAP NetWeaver Process Orchestration 7.31

Find out about the multiple new features and enhancements for Business Process Management, Process Integration and Orchestration scenarios. See how integration between SAP NetWeaver PI and BPM has been tightened further.

* Generate a Migration Report to estimate the migration effort from PI dual-stack to AEX

Migration from PI dual-stack to single-stack (Java-only) can be a daunting task. In this article William Li presents a java client program (read only) to be used to browse through all the configurations in the Integration Directory and produce a report helpful for the preliminary assessment of the migration task in your landscape.

* cbs PI MeMo App for MobiIe Message Monitoring

In this article Denny Schreber introduces a PI MeMo app for iPhone – an easy to use tool for monitoring SAP NetWeaver PI messages anytime and everywhere. The app is freely available in the Apple App Store.

* Released: SP1 of B2B Add-on and SFTP PGP with SAP NetWeaver Process Orchestration

In this blog Piyush Gakhar introduces SP1 of the B2B Add-on and Secure connectivity Add-on which bring variety of new features and enhancements.

* Upgrade options to the latest Process Integration or Process Orchestration

In this blog William Li provides guidance on licensing, installation and upgrade for customers who are looking to move on to a higher release of PI or to Process Orchestration.

* IFG for PI: Subscription process for new PI Features in SAP Customer Connection Program

In this blog Holger Himmelmannexplains about the participation of IFG for PI in the SAP Customer Connection Program and how you can contribute.

* Client Certificate based authentication while using ABAP Web Service for communication between ERP and SAP NET Weaver PI and The Myth of a Load Balancer - PI/Web Service Scenario

* Try SAP NetWeaver Process Orchestration in Public Cloud!

Our customers and prospects can now try SAP NetWeaver Process Orchestration and gain confidence in the solution before buying it. Read this blog to see how you can get started.

* Near Zero Downtime Management for SAP Netweaver Process Integration (nZDM/PI) available on Service Marketplace

* How to Load keys and certificates in SAP PI 7.3, SAP PO 7.3 EHP1 NWA's Key Storage

* Dynamic filename in mail receiver adapter made easier

* TechEd 2012: Process Orchestration session replays!

* SAP NetWeaver Process Orchestration technology in Healthcare

SAP NetWeaver PI brings tremendous value to Healthcare providers with the Health Level Seven (HL7) adapter. Read Bettina Lieske’s blog to find out how Haga Hospital connected more than 300 SAP and non-SAP apps benefitting patients, doctors and management.

* Consolidated view on release notes for Process Integration and Orchestration

Do you consider moving from a dual-stack installation towards Java-only to benefit from the latest improvements with SAP NetWeaver Process Orchestration?Alexander Bundschuh’s blog is a must read guide if you are looking for feature comparison, understanding on which installation option would match your requirements and what target release you should go for.
In this blog Katrin Ahsen explains the positioning of the B2B add-on and the new RDS for EDI with SAP NetWeaver Process Orchestration. Learn what are the benefits for new Customers and options for SAP Partners.
*SAP NetWeaver Process Orchestration SAPPHIRE NOW+TechEd Madrid 2012:
quick guides on sessions with PI focus by Alexander Bundschuh and on BPM focus by Benjamin Notheis. Build your PMC track agenda from here!

*SAP NetWeaver Process Orchestration PI | B2B | BPM | BRM on SCN - October

A newsletter-blog by Mariana Mihaylova with all highlights in the Process Orchestration area in October.

*SAP TechEd 2012 Sessions covering Process Orchestration with focus on Process Integration

Here is your Process Orchestration/Process Integration quick guide by SAP’s Alexander Bundschuh. Hurry up and build your playlist with the online broadcast schedule!

* Results: 1) 2012 Global PI Survey  2) PI Requirements Prioritization

In the first blog Holger Himmelmann summarizes the results of the 2012 global SAP NetWeaver PI survey. The second one reveals the results of the last PI requirements prioritization round with IFG for PI (formerly GSIG for PI).

* SAP’s B2B Integration Strategy

SAP has a 360 degree solution approach covering all aspects of the B2B integration needs of your organization: OnPremise, OnDemand and Hybrid. In his blog Piyush Gakhar introduces SAP’s Strategy for B2B Integration. Covering all available B2B solutions from SAP, this paper helps you determine when is best to use what.

* New SAP NetWeaver Process Orchestration RDS for EDI available now!

Migrate easily and cost efficiently from your legacy B2B integration solution to SAP NetWeaver Process Orchestration using the new Electronic Data Interchange rapid deployment solution. Read more in Katrin Ahsen’s blog.

* Getting Started with SAP NetWeaver Process Orchestration

A crisp SAP NetWeaver Process Orchestration overview by Piyush Gakhar including licensing and deployment options for new/existing customers. Feel free to reach out to him if any questions.

* IWAY adapters bundled within Process Integration / Orchestration

This blog by Piyush Gakhar contains useful details on which IWAY adapters are built-in the Process Integration/Orchestration license and where to find more information.

2012 Global SAP NetWeaver PI Survey

We welcome you to participate in the global PI survey for 2012. Read Holger Himmelman’s blog and feel free to post questions or feedback.
Register and join us for a series of webinars in July covering new capabilities of SAP NetWeaver PI, BPM and BRM, the road ahead and B2B!
SAP NetWeaver Process Orchestration 7.3 EhP1 is already generally available. In this blog  Meghna Shishodiya provides a useful summary of ramp-up feedback from our certified ramp-up coaches who worked closely with our customers during ramp-up.
Our teams worked around the clock and the unrestricted shipment was approved 2 weeks before the planned date. Read William Li’s blog to find out about all the new features and benefits available as of now to all our customers.
The long awaited article! In this blog William Li shares useful insights about using SAP NetWeaver BPM to replace ccBPM with PI. You will find a link to the article in the blog. Enjoy!
A blog about SAPPHIRE Now takeaways and more by SAP Mentor Prateek Raj Srivastava
Check out the two ‘simple guides’ by SAP Mentor Shabarish Vijayakumar.
GSIG for PI invites you to take part in the prioritization survey for functional requirements and enhancements for SAP NetWeaver PI. Read all details in Holger Himmelmann’s blog.
Join the hands-on workshop in Bangalore on May 21-24, 2012! Contact Piyush Gakhar for registration.
Installation and Deployment of SAP NetWeaver B2B Add-On with SAP NetWeaver PI 7.11+ Since March 2012, the B2B Add-On for Process Orchestration is available to our customers. In this blog William Li focuses on the installation and deployment of the Add-On with SAP NetWeaver PI 7.11+.
In this guide Piyush Gakhar provides a detailed overview of the two new add-on solutions for SAP NetWeaver Process Orchestration - Secure Connectivity and Business to Business add-on.
Both SAP NetWeaver Gateway and SAP NetWeaver Process Integration can provision RESTful services to SAP backend applications. Should your organization consider one or both? How can you evaluate each product and determine which is right for your landscape? In this article William Li is addressing all these questions.
In this very informative blog, Alexander Bundschuh describes in details the various installation options for customers running Process Integration and Orchestration use cases.
Advantco’s REST adapter for SAP NetWeaver PI announced in November 2011 has been already certified by SAP. William Li had the opportunity to also review and test Advantco's REST adapter and he’s sharing his findings in this blog.
Since the availability of AEX with SAP NetWeaver PI 7.3, many questions have been raised around migration of integration scenarios from PI 7.1 to AEX and if there are any tools to assist in the process. In this blog William Li provides answers and also features and functions comparison in the associated article.
Do you require a minimized downtime for the software maintenance of your PI systems? Are maintenance downtimes critical for your business? If so, then we have good news for you. Read details in this blog and contact Udo Paltzer if you are interested to join the near Zero Downtime Maintenance program.
SAP plans to release this supplementary component of SAP NetWeaver Process Orchestration (PI/ BPM/ BRM) at the beginning of Q2 this year. In this blog Katrin Ahsen provides an overview of the functional scope, technical architecture, and supported releases.

Featured Content in Process Integration (PI) & SOA Middleware

$
0
0

http://scn.sap.com/profile-image-display.jspa?imageID=33801&size=72Info Day on SAP HANA Cloud Integration in Germany - July 23rd

Save the date Thursday, July 23rd for the next Info Day on SAP HANA Cloud Integration. This event will take place in Rot, Germany, in the heart of SAP Cloud so to say. The development team will share exciting news on capabilities, supported scenarios and new editions. Follow Udo Paltzer's blog for agenda and registration information. June 2015

Live Expert Session on SAP HANA Cloud Integration

Piyush Gakhar of the SAP HCI Product Management team is conducting a 2 hours virtual live expert session as part of the Early Knowledge Transfer. Find the registration links in his blog. June 2015

Early Knowledge Transfer Workshops in Philadelphia and Bangalore

Beneath the Early Knowledge Transfer workshop offered June 11-12th by Piyush Gakhar in Philadelphia, he will also conduct one in Bangalore, July 2-3. This classroom workshops are opened for SAP Partners and provides deep insights and exercises on various SAP HCI components. Read the blogfor more information. April 2015

Cloud, On-Premise, or Hybrid? What is the Best for Your Business?

July 2nd, a new free of charge openSAP course will start - titled Transformation to Hybrid Landscapes. Read the blog by Claire Donelon that provides you a short introduction. May 2015

/profile-image-display.jspa?imageID=63232&size=72Redesigned Documentation Landing Page

The documentation landing page for SAP HANA Cloud Integration for Processes is redesigned. Watch the blog by Peter Gutsche and find information on how to get started. May 2015

2015 Global SAP Process Integration Survey

Since May, 4th the Annual Survey for SAP Process Integration is open. The survey aims to collect information about the latest state of positioning, organization and use in companies using SAP Process Orchestration as an integration platform. You will find all details and the survey access link in the blog by Holger Himmelmann, member of the International Focus Group for Integration. Participate and help beat the 2014 response record! May 2015

How to add attachment using JAVA Mapping (SAP PO)

$
0
0

Hi,

 

I was having a requirement to pick a PDF file from a file server, send it as attachment and PDF file name as field to the target server.

 

As a solution I created a JAVA code and used it as JAVA mapping in PI. I hope this code will help PI consultants if they have similar kind of requirement.

 

/*

* Created on May 14, 2015

*

* To change the template for this generated file go to

* Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments

*/

package attach;

 

 

/**

* @author ashutosh upadhyay

*

* To change the template for this generated type comment go to

* Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments

*/

 

import java.io.InputStream;

import java.io.OutputStream;

import com.sap.aii.mapping.api.AbstractTransformation;

import com.sap.aii.mapping.api.Attachment;

import com.sap.aii.mapping.api.DynamicConfigurationKey;

import com.sap.aii.mapping.api.OutputAttachments;

import com.sap.aii.mapping.api.TransformationInput;

import com.sap.aii.mapping.api.TransformationOutput;

import  com.sap.aii.mapping.api.DynamicConfiguration;

 

public class AddAttachment extends AbstractTransformation{

 

 

  private static final DynamicConfigurationKey KEY_FILENAME = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");

 

  public void transform(TransformationInput transformationInput, TransformationOutput transformationOutput) {

  //System.out.println("A");

  // access dynamic configuration

  InputStream inputstream = transformationInput.getInputPayload().getInputStream();

  OutputStream outputstream = transformationOutput.getOutputPayload().getOutputStream();

 

  DynamicConfiguration conf = transformationInput.getDynamicConfiguration();

  String fileName = "";

   fileName = conf.get(KEY_FILENAME);

  //System.out.println("C"+fileName);

 

  // set file name

  conf.put(KEY_FILENAME, fileName);

 

  try {

 

  // a) Populate XML for XIPAYLOAD

 

  String fresult= "";

  // creating the xml

  fresult="<?xml version=\"1.0\" encoding=\"UTF-8\"?>";

  fresult = fresult.concat("<ns0:MT_Payload xmlns:ns0=\"http://test\">");

  fresult = fresult.concat("<FileName>");

  fresult = fresult.concat(fileName);

  fresult = fresult.concat("</FileName>");

  fresult = fresult.concat("</ns0:MT_Payload>");

 

  outputstream.write(fresult.getBytes("UTF-8"));

 

// Write attachment

  OutputAttachments outputAttachments = transformationOutput.getOutputAttachments();

  byte[] b = new byte[inputstream.available()];

  inputstream.read(b);

  Attachment newAttachment = outputAttachments.create(fileName,"application/pdf", b);

  outputAttachments.setAttachment(newAttachment);

  }

  catch (Exception e) {

  getTrace().addDebugMessage(e.getMessage());

  }

  }

}

 

Output:

1.JPG

2.JPG


Base64EncodeConverter - Base64 encoding made easy!

$
0
0

Introduction

In my previous article Base64DecodeConverter - Base64 decoding made easy!, I introduced a new converter for FormatConversionBean to handle decoding of Base64 content.

 

This article covers Base64EncodeConverter, which handles encoding of content into a Base64 string in either plain text file or embedded in an XML payload.

 

 

Source Code and Deployment Archive

Refer to following blog on location of source code and/or EAR deployment file.

FormatConversionBean - One Bean to rule them all!

 

 

Usage of Module in Communication Channel

Module Processing Sequence

NumberModule NameTypeModule Key

<Depending on position of module in chain>

1) Asynchronous scenario,

Normally before the last module in channels

2) Synchronous scenario,

Before last module to convert request payload

After last module to convert response payload

Custom_AF_Modules/FormatConversionBeanLocal Enterprise Bean<Any Arbitrary Value>

 

 

Module Parameter Reference

Below are the parameters for configuration of the module for Base64 encoding. Certain parameters will automatically inherit the default values if it is not configured.

 

Parameter NameAllowed valuesDefault valueRemarks
converterClasscom.equalize.xpi.af.modules.base64.Base64EncodeConverterRequired field. Determines conversion class
outputTypeplain, xml

Required field. Indicates type of output data

  • plain = Base64 string as plain output text
  • xml = Base64 string embedded in XML element of XML payload
documentName

Required field when outputType = 'xml'.

Document name of root element of XML output

documentNamespace

Required field when outputType = 'xml'.

Namespace of root element of XML output

base64FieldNamebase64Content

Available when outputType = 'xml'.

Field name of  XML element containing Base64 string

compressY,NNCompress input content before encoding into Base64 string
messageLog

pre, post

Saves a log version of the message that is viewable in Message Monitor
  • pre = saves payload before conversion
  • post = saves payload after conversion
logLocationName of log version when messageLog is populated. Location defaulted to value in messageLog if logLocation not populated

 

 

Example Scenarios

Here are some example scenarios of the behavior of the conversion based on different configuration options.

 

Scenario 1

  • Encode content into Base64 string in plain output text
  • Content will be compressed before encoding into Base64

 

Module parameters

Parameter NameParameter Value
converterClasscom.equalize.xpi.af.modules.base64.Base64EncodeConverter
outputTypeplain
compressY

 

Result

Inputinput1.png
Outputoutput1.png

 

 

Scenario 2

Screenshot of actual configuration and testing are shown below.

  • Encode content into Base64 string, and embed in XML payload
  • Output XML's root element, namespace and field containing base 64 string specified

 

Module configuration on an SFTP receiver channel.

config.png

 

The input content to be encoded is sent via the Send Test message function.

testdata1.png

 

The log version 'b64embedxml' shows the content after encoding. The Base64 string is embedded into an XML payload.

encoded.png

 

The audit log shows the trace of steps being executed by the module.

log.png

 

The encoded output is verified using Base64 Decode - Online to decode the generated Base64 string to retrieve back the original content.

verify.png

 

 

Conclusion

With this new addition to FormatConversionBean, encoding of Base64 content can also now be easily handled without additional custom development

Multiple target directories dynamically using JAVA Mapping

$
0
0

Hi All,

 

I have a requirement where I need to pick files from multiple source directories and place it to on target file server using one file channel. The interface was passthrough interface so I created dummy structures as I would be needing service interfaces and operation mapping to call JAVA mapping.

 

To achieve this I prefer to write Adapter Module but sometimes due to BASIS dependency, we have to go for JAVA mapping. Here I am putting up my JAVA code but ADAPTER MODULE code will be shared soon.

 

 

Source directories were like

 

/a/b/c/X

/a/b/c/Y

/a/b/c/Z

 

and target directories were /X, /Y, /Z

 

PFB the code:

 

/*

* Created on May 26, 2015

*

* To change the template for this generated file go to

* Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments

*/

package global;

 

 

/**

* @author ashutosh.a.upadhyay

*

* To change the template for this generated type comment go to

* Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments

*/

 

 

import java.io.InputStream;

import java.io.OutputStream;

import java.util.Map;

 

import com.sap.aii.mapping.api.AbstractTransformation;

import com.sap.aii.mapping.api.DynamicConfiguration;

import com.sap.aii.mapping.api.DynamicConfigurationKey;

import com.sap.aii.mapping.api.StreamTransformationConstants;

import com.sap.aii.mapping.api.StreamTransformationException;

import com.sap.aii.mapping.api.TransformationInput;

import com.sap.aii.mapping.api.TransformationOutput;

 

public class DynamicDirectory extends AbstractTransformation {

 

  public void transform(TransformationInput transformationInput, TransformationOutput transformationOutput)throws StreamTransformationException{

  try {

    InputStream inputstream = transformationInput.getInputPayload().getInputStream();

      OutputStream outputstream = transformationOutput.getOutputPayload().getOutputStream();

 

    Map mapParameters = (Map) transformationInput.getInputHeader().getAll();

 

    // Dynamic Confguration

    mapParameters.put(DynamicConfigurationKey.create("http://sap.com/xi/XI/Dynamic", StreamTransformationConstants.DYNAMIC_CONFIGURATION), "");

    DynamicConfiguration conf = (DynamicConfiguration) mapParameters.get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);

    DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File", "Directory");

 

    //Check the input directory and set the output directory

    String inputDir = "";

    String outputDir = "";

 

    inputDir = conf.get(key);

 

    if(inputDir.endsWith("X")){

    outputDir = "/X/";

    }

 

 

    else if (inputDir.endsWith("Y")){

    outputDir = "/Y/";

    }

 

    else if(inputDir.endsWith("Z")){

    outputDir = "/Z/";

    }

 

 

  //Set the directory parameter

  conf.put(key,outputDir);

 

    //copy Input file content to Output file content

    byte[] b = new byte[inputstream.available()];

    inputstream.read(b);

    outputstream.write(b);

    }

    catch (Exception exception){

    getTrace().addDebugMessage(exception.getMessage());

    throw new StreamTransformationException(exception.toString());

    }

  }

}

Creating Multiple Files, Zipping, Sending as Email Attachments using Java Mapping

$
0
0

I have tried to consolidate all information along with the customizable code and issues in this document on the topic.

Please refer following diagram to understand the requirement and applied solution.

 

emailAtt.jpg     

 

Please find the sample code below.

 

Code:


import org.w3c.dom.Document;

import java.util.zip.ZipEntry;

import java.util.zip.ZipOutputStream;

import java.io.OutputStream;

import java.io.ByteArrayOutputStream;

import javax.xml.parsers.DocumentBuilder;

import javax.xml.parsers.DocumentBuilderFactory;

 

import com.sap.aii.mapping.api.AbstractTransformation;

import com.sap.aii.mapping.api.Attachment;

import com.sap.aii.mapping.api.OutputAttachments;

import com.sap.aii.mapping.api.StreamTransformationException;

import com.sap.aii.mapping.api.TransformationInput;

import com.sap.aii.mapping.api.TransformationOutput;

 

publicvoid transform(TransformationInput in, TransformationOutput out) throws StreamTransformationException

{

try{

//Getting reference of output attachment

     OutputAttachments outAtt = out.getOutputAttachments();


//Getting reference of output stream to write email package.Read Reference 1

     OutputStream os = out.getOutputPayload().getOutputStream();

//CRLF.Read Reference 2

     String CRLF = "\r\n";

//Getting Attachment Names (Parametrized java Mapping).Read Reference 11

     String zipName=  in.getInputParameters().getString("PARAM_ZIPNAME") //import parameter,Simple Type,xsd:string

         String file1Name=in.getInputParameters().getString("PARAM_FILE1NAME")//import parameter,Simple Type,xsd:string

     String file2Name=in.getInputParameters().getString("PARAM_FILE2NAME")//import parameter,Simple Type,xsd:string

     String file3Name=in.getInputParameters().getString("PARAM_FILE3NAME")//import parameter,Simple Type,xsd:string


//Getting Email Addresses (Parametrized java Mapping).Read Reference 11

     String fromEmail=  in.getInputParameters().getString("PARAM_FROM") //import parameter,Simple Type,xsd:string

         String toEmail=in.getInputParameters().getString("PARAM_TO")//import parameter,Simple Type,xsd:string

               

//Instantiating DocumentBuilderFactory to parse input stream into Document.Read Reference 3

    DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();

    DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();

    Document doc = dBuilder.parse(in.getInputPayload().getInputStream());

 

//Adding trace.Read Reference 4                                       

    getTrace().addInfo("Start of parsing input xml");


//File1 Parser:Creating a file "file1.txt"

    File1 F1= new File1();       //Instantiating Class File1

    String f1=F1.parseF1(doc);   //Calling parseF1 method of Class File1

  //String file1Name="file1.txt";//File Name, provide using parameters as above or hardcode here      

 

//File2 Parser: Creating another file "file2.txt"

    File2 F2= new File2();        //Instantiating Class File2

    String f2=F2.parseF2(doc);    //Calling parseF2 method of Class File2

   //String file2Name="file2.txt";//File Name, provide using parameters as above or hardcode here     

    

//File3: Creating file3.txt             

    String f3="This is my File 3 Content"; //Fix Content of file3

    //String file3Name="file3.txt";//File Name, provide using parameters as above or hardcode here

                

//Zipping file1.txt and file2.txt together. Read Reference 5

     ByteArrayOutputStream baos = new ByteArrayOutputStream();//ByteArrayOutputStream to read/write ZipOutputStream

     ZipOutputStream zos = new ZipOutputStream(baos);//Creating ZipOutputStream

     zos.putNextEntry(new ZipEntry(file1Name));//Creating new entry for file1.txt

     zos.write(f1.getBytes());         //Writing content of file1 into Zip Stream

     zos.putNextEntry(new ZipEntry(file2Name));//Creating new entry for file2.txt

     zos.write(f2.getBytes());         //Writing content of file2 into Zip Stream

     zos.closeEntry();                         //Closing Zip entry

     zos.close();                              //Closing Zip Stream

         

//Zip Name as appear in attachment

  //String zipName="Notification.zip";//Zip Name, provide using parameters as above or hardcode here


//Creating Attachment.Read Reference 6

     Attachment newzipAttachment = out.getOutputAttachments().create(zipName, baos.toByteArray());  

//Attaching Zip

     outAtt.setAttachment(newzipAttachment);         


//From and To Email addresses as appear in Email

  //String fromEmail="files@test.com";//From Email, provide using parameters as above or hardcode here

//String toEmail="ambuj.mishra@test.com;others@test.com"; //To Email, provide using parameters as above or hardcode here


//Forming Email Package. Read Reference 7

     String emailPackage=

             "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"+CRLF+

             "<ns:Mail xmlns:ns=\"http://sap.com/xi/XI/Mail/30\">"+CRLF+

             "<Subject>Delivery notes</Subject>"+CRLF+

             "<From>"+fromEmail+"</From>"+CRLF+

             "<To>"+toEmail+"</To>"+CRLF+

             "<Reply_To />"+CRLF+

             "<Content_Type>text/plain</Content_Type>"+CRLF+

             "<Content_Disposition>attachment; filename="+"\""+file3Name+"\""+"</Content_Disposition>"+CRLF+

             "<Content>"+f3+"</Content>"+CRLF+

             "</ns:Mail>";


//In case, you have incoming attachments in source.

//Read Reference 10.How to read and use them in your code.

     

//How to remove an attachment

        //outAtt.removeAttachment("Notification.zip");         


//Writing Email Package

     os.write(emailPackage.getBytes());//Writing Email Package in output stream                  

     os.flush();                       //Flushing output stream

     os.close();                      //Closing output stream

   }

catch (Exception e)

   {

          thrownew StreamTransformationException(e.getMessage());

   }     

}

 

publicclass File1

{

   public String parseF1(Document doc) throws ParseException {

                return"file 1 content";     //Read Reference 8 to create flat file using DOM

       }

}

 

publicclass File2

{

   public String parseF2(Document doc) throws ParseException {

                return"file 2 content";    //Read Reference 8 to create flat file using DOM

       }

}

 

Please read comments/refernces to explore the code. Leave a comment if you have any doubts/questions.

 

It's a working code and can be customized easily as per your requirement. I have provided the references, in case you want to customize it. For example, if you want to create a flat file using DOM from incoming xml, you can refer the code in provided link and add those in File1 or File2 class.

 

You can write above code, directly into ESR and test it for your understanding, as explained below.

 

Where to write this code?

I always prefer this approach for java mapping as you can test it right away like your graphical mapping.

Write Java Mapping directly in ESR!

MMJM.jpg

 

How to provide Parameters in mapping?

Please refer following blog, It has all necessary configuration details. And using parameters in java mapping is pretty simple as I showed you in above code.

SAP PI 7.1 Mapping Enhancements Series: Parameterized Message Mappings

 

Mail Channel Configuration:

Please find below mail channel configuration.

MailChannel.jpg

Test Result:

This is not the exact result of above code. But approach was same.

Version: PI 7.31 (single stack)

EmailAttachments.jpg

 

Open Ends:

 

1. I tried to achieve this requirement using following blog post, many times,but couldn't make it work.

XI Mail Adapter: An approach for sending emails with attachment with help of Java mapping

    Please let me know, if any one have detailed doc on this.


2. While forming Email package, If I am not providing <Content_Type/> and <Content/> tags. My email server is not triggering email.

    I don't know whether this issue is specific to my email server only or it's a general case? Please do comment, if you have any information regarding this.


3. Found one testing issue in operation mapping. Please refer http://scn.sap.com/thread/3742233.


References for detailed reading:

1. //Output Stream

https://docs.oracle.com/javase/tutorial/essential/io/streams.html

2. //CRLF

http://stackoverflow.com/questions/9260126/what-are-the-differences-between-char-literals-n-and-r-in-java

3. //Document Builder Factory

http://docs.oracle.com/javase/7/docs/api/javax/xml/parsers/DocumentBuilder.html

4. //Adding trace

https://help.sap.com/javadocs/pi/SP3/xpi/com/sap/aii/mapping/api/AbstractTrace.html

5. //Zip Output Stream

http://docs.oracle.com/javase/7/docs/api/java/util/zip/ZipOutputStream.html

6. //Creating Output Attachment

OutputAttachments

7. //Email package

Configuring the Receiver Mail Adapter - Advanced Adapter Engine - SAP Library

8. //Creating flat files using DOM

File Content Conversion in ESR using Java Mapping 

9. Package com.sap.aii.mapping.api

com.sap.aii.mapping.api

10. // Reading and Writing incoming attachments

Attachments zipping during Mapping

11. // Parametrized java mapping

Parameterized Mapping Programs - Managing Services in the Enterprise Services Repository - SAP Library

Parameterized Java Mappings - Managing Services in the Enterprise Services Repository - SAP Library

SAP PI to HANA Data Provisioning

$
0
0

There are various Data provisioning techniques for HANA and some of the recommended options are listed in the SAP HANA Master Guide. However, one of the customers I worked with wanted to leverage SAP PI to push data from external sources into HANA. One of the main reasons were to leverage the existing infrastructure and monitoring capabilities of SAP PI. This article covers most of the challenges we faced in several stages and I hope this is helpful.

 

Versions: SAP PI 7.1 (JVM 5) and SAP HANA Rev 85

 

Load Volume: 4 Million records

 

Load Schedule: Daily mornings

 

1.jpg

We decided take the PI – JDBC – HANA path.

 

On HANA, we had created a Schema and relevant tables which would be used during the Data acquisition process. The first challenge was “How to get PI talking to HANA”. We created a Stored Procedure in SAP HANA which would get the contents of a file and process it. The role of the Stored Procedure was to extract the records from the input and insert them into the target table.

 

Setup of JDBC Driver


There is a document on SCN (bit old) which refers to the steps for installing the driver.

http://scn.sap.com/docs/DOC-29889

 

We took JDBC Driver com.sap.ndb.studio.jdbc_1.85.0.jar file (from HANA Client Rev 85) and renamed it to com.sap.db.jdbc.Driver.jar. Added this jar file into the com.sap.aii.adapter.lib library and deployed in SAP PI via JSPM. This enabled the communication between PI and HANA via JDBC.


Using a CLOB data type to pass data from PI to HANA Stored Procedure


Though we were able to establish a communication from PI to HANA, we wanted to be able to pass large volume of records from PI. There would be multiple flat files amounting to 4 millions records.

 

Below are the data types which are supported by Receiver JDBC Adapter

INTEGER, BIT, TINYINT, SMALLINT, BIGINT, FLOAT, REAL, DOUBLE, NUMERIC, DECIMAL, CHAR, VARCHAR, STRING, LONGVARCHAR, DATE, TIME, TIMESTAMP, BINARY, VARBINARY, LONGVARBINARY, BLOB (input and output), CLOB (input and output), CURSOR (output; only in connection with the Oracle JDBC driver)

 

https://help.sap.com/saphelp_nw73/helpdata/en/44/7b72b2fde93673e10000000a114a6b/content.htm?frameset=/en/22/b4d13b633f7748b4d34f3191529946/frameset.htm&current_toc=/en/ca/b977f1c7814201954f20bb87ad7aab/plain.htm&node_id=72

 

We decided to use CLOB as a means to transfer all the file contents. Would have been great if there was a way to pass an internal table to the Stored Procedure.

 

We still had errors when trying to use CLOB objects during the communication. A SAP Incident suggested to take rt.jar from the SAPJVM folder(sapjvm_5/jre/lib) and add it into the com.sap.aii.adapter.lib library. This still didn’t resolve our problem.

 

Finally we took JDBC Driver ngdbc.jar that comes with HANA client revision 94 from HANA Studio and renamed it as com.sap.db.jdbc.Driver.jar and updated it in the library as mentioned above. This version of jar has fixes to address the issue with CLOB data type.

 

Parsing of the PI Payload in the Stored Procedure


We performed the message mapping in PI such that PI concatenates all the records in the file with a record delimiter (#) and passes the entire payload to HANA Stored Procedure. The SQL within the Stored Procedure parses the CLOB based on record delimiter and inserts the records into the target table. We bumped into an Out-Of-Memory (OOM) exception in the Stored Procedure due to the way we wrote the SQL. The SQL couldn’t handle more than 1000 records within the CLOB. There is a bug when using CLOB variable. Reassigning values to the same CLOB variable doesn’t release the memory for some reasons. Hence, we had to change the approach and wrote the below SQL

 

    -- Sample CLOB Data  'SAPSPAU06200100000001|2500000001#SAPSPAU06200100000002|2500000002#SAPSPAU06200100000003|2500000003#  DECLARE V_RECORD_DELIMT VARCHAR(10) := '#';  DECLARE V_FIELD_DELIMT VARCHAR(10) := '|';     V_POS := 1;     V_LOCATE := 0;     V_FLAG := '';     V_LEN := LENGTH(:p_payload); --payload variable contains the actual CLOB data       WHILE V_FLAG != 'X' DO        V_LOCATE := LOCATE(:p_payload, :V_RECORD_DELIMT, :V_LOCATE + 1, 12); -- Locate the 12th occurrence of record delimiter            IF V_LOCATE > 0 THEN                 V_PACKAGE := TRIM(SUBSTRING(:p_payload, :V_POS, (:V_LOCATE - :V_POS) + 1)); --Extract only 12 records in V_PACKAGE including record delimiter            ELSE                IF V_POS > V_LEN THEN --Reached End of File. The CLOB contains records in multiples of 12               BREAK;              END IF;  --Reached End of File. The CLOB does not contains records in multiples of 12. Extract the last few records into  V_PACKAGE                         V_PACKAGE := TRIM(SUBSTRING(:p_payload, :V_POS));                V_FLAG := 'X'; -- End of Loop reached            END IF;                     WHILE LENGTH(:V_PACKAGE) > 0 DO  -- In the below Loop, extract individual records and fields to insert into Table             V_RECORD := TRIM(SUBSTR_BEFORE(:V_PACKAGE, :V_RECORD_DELIMT)); -- Extract a record from CLOB             I := 1; -- Reset Array Counter             ARRAY_ID := ARRAY(); -- Clear the Array                      WHILE  V_RECORD != '' DO                                    V_FIELD := SUBSTR_BEFORE(:V_RECORD, :V_FIELD_DELIMT); -- Extract a field from Record                V_LENGTH := LENGTH (:V_FIELD);                IF V_LENGTH != 0 THEN                ARRAY_ID[:I] := V_FIELD;                ELSE                --Check if this is the last field in the record or if further fields exist                  V_FIELD := SUBSTR_AFTER(:V_RECORD, :V_FIELD_DELIMT);                  V_LENGTH := LENGTH (:V_FIELD);                  IF V_LENGTH != 0 THEN -- There are more fields in the records                  ARRAY_ID[:I] := NULL;                  ELSE  ARRAY_ID[:I] := :V_RECORD;                  END IF;                END IF;                                                     V_RECORD := SUBSTR_AFTER(:V_RECORD, :V_FIELD_DELIMT);                 I := :I + 1;         END WHILE;                   INSERT INTO <TARGET TABLE> VALUES(          :ARRAY_ID[1],          :ARRAY_ID[2]  );                   V_PACKAGE := SUBSTR_AFTER(:V_PACKAGE, :V_RECORD_DELIMT);                                   END WHILE;            V_POS := :V_LOCATE + 1; --skip the record delimiter    END WHILE;



Tuning the Data Load


When we tested the interface with 4 million records, we noticed that there was a high CPU Utilization for SAP PI. To avoid this problem, we set the following parameters based on our existing environment.

 

  • Integration Engine Configuration Parameter “EO_OUTBOUND_PARALLEL” : 20
  • JDBC Communication Channel Settings: poolWaitingTime - 180000
  • JDBC Communication Channel Settings: Maximum Concurrency - 4
  • File Communication Channel: Record Structure – Payload,8000 (To ensure that each message has no more than 8000 records)


Timings:

We were able to achieve a load time of 25 minutes for 4 million records and at the same time keeping the PI/HANA CPU Utilizations under 30%

 

Things to consider:

Though PI message monitoring could be used to track errors on PI, we had to set up an Error handling framework (Tables/Exception Handling) to capture issues when Stored Procedure is executing. Reporting of these errors/Alerting was a pain point.There are limited SQL functions which can be applied on a CLOB compared to a STRING.

 

We also managed to come up with an alternative solution, where SAP PI invokes an ABAP Proxy and the proxy calls an ABAP Managed Database Procedures (AMDP Class) which again invokes the Stored Procedure created in the new Schema. There wouldn’t be any CLOB objects used in this scenario as AMDP Class could pass an internal table to the Stored Procedure and there wouldn’t be any need to parse objects. Since we have a SoH system, we could have tried to explore this path. But didn’t have the time and was again not sure about the performance.

 

More info on AMDP: http://scn.sap.com/docs/DOC-51612

External Control of PI Communication Channel

$
0
0

Requirement:
In complex requirement where ECC system was creating multiple file and the requirement is like PI should start picking those file only once all the files are placed.

 

Initial Approach:

Initially we thought of going with Trigger file mechanism where we define an additional file in File List parameter, with same name as the source file name(only file extention needs to be different.)

 

Limitaion.

It works with a single file and with static file name.

 

On further digging we realised that we can levarage the External Control Option provided by SAP in such situation for starting/stopping channel.

 

Approach:

Step 1: We need to set "External Control On"

 

Image1.PNG

After Switching On the External Control for the Communication Channel we can Control this Communication Channel Externally.

 

Step 2: After this we have to write an executable report in ECC system that can start and stop the communication channel.

 

 

*&---------------------------------------------------------------------*
*& Report  Z_COMM_CHANNEL_START_STOP
*&
*&---------------------------------------------------------------------*

REPORT  Z_COMM_CHANNEL_START_STOP.
data: V_URL type STRING,
     
CLIENT type ref to IF_HTTP_CLIENT.
data: RESPONSE_CODE type  SYSUBRC,
      RESPONSE_TEXT
type  STRING.
data: FIELDS_TAB type TIHTTPNVP,
      STATUS_CODE
type STRING,
      STATUS_REASON
type STRING,
     
NUMBER type I.
data: W_RESULT type STRING,
      RESULT_TAB
type table of STRING,
      RESULT_WA
like line of RESULT_TAB.

"Set this v_url parameter as per your requirement(wether you want to start the channel or stop or just want the status)
"Get comm channel status
*V_URL = '/AdapterFramework/ChannelAdminServlet?party=*&service=*&channel=Test_CommChannel_ExtCtrl&action=status'.

"Start comm channel
v_url
= 'http://host:port/AdapterFramework/ChannelAdminServlet?party=*&service=*&channel=CC_File_Merch_Recv&action=start'.


"Stop comm channel
"v_url = '/AdapterFramework/ChannelAdminServlet?party=*&service=*&channel=Test_CommChannel_ExtCtrl&action=stop'.


call method CL_HTTP_CLIENT=>CREATE
 
exporting
    HOST              
= 'host'         "PI system name
    SERVICE           
= 'port'         "PI Port number
*      PROXY_HOST         =
*      PROXY_SERVICE      =
*      SCHEME             = SCHEMETYPE_HTTP
*      SSL_ID             =
*      SAP_USERNAME       =
*      SAP_CLIENT         =
 
importing
   
CLIENT             = CLIENT
 
exceptions
    ARGUMENT_NOT_FOUND
= 1
    PLUGIN_NOT_ACTIVE 
= 2
    INTERNAL_ERROR    
= 3
   
others             = 4.


*if SY-SUBRC <> 0.
*  message E000 with SY-SUBRC.
*endif.
*
*if SY-SUBRC <> 0.
*  message E000 with SY-SUBRC.
*endif.


*set header fields
call method CLIENT->REQUEST->SET_HEADER_FIELD
 
exporting
    NAME 
= '~request_method'
   
VALUE = 'POST'.


call method CLIENT->REQUEST->SET_HEADER_FIELD
 
exporting
    NAME 
= 'Content-Type'
   
VALUE = 'application/xml'. "; charset=UTF-8' .


*Set request protocol
call method CLIENT->REQUEST->SET_HEADER_FIELD
 
exporting
    NAME 
= '~server_protocol'
   
VALUE = 'HTTP/1.0'.


*Update url
call method CLIENT->REQUEST->SET_HEADER_FIELD
 
exporting
    NAME 
= '~request_uri'
   
VALUE = V_URL.


*Disable logon popup
CLIENT->PROPERTYTYPE_LOGON_POPUP = CLIENT->CO_DISABLED.
call method CLIENT->AUTHENTICATE
  
exporting
      USERNAME            
= ''        "PI System Username
      PASSWORD            
= ''  .     "PI System Password

CL_HTTP_UTILITY
=>SET_REQUEST_URI( REQUEST = CLIENT->REQUEST
                                  URI
= RESPONSE_TEXT ).
*Send http request to server
call method CLIENT->SEND
 
exceptions
    HTTP_COMMUNICATION_FAILURE
= 1
    HTTP_INVALID_STATE        
= 2
    HTTP_PROCESSING_FAILED    
= 3
   
others                     = 4.
if SY-SUBRC <> 0.
 
call method CLIENT->GET_LAST_ERROR
   
importing
     
CODE    = RESPONSE_CODE
     
message = RESPONSE_TEXT.

 
message I000(SR) with RESPONSE_TEXT.

 
exit.
endif.


*Get http response from server
call method CLIENT->RECEIVE
 
exceptions
    HTTP_COMMUNICATION_FAILURE
= 1
    HTTP_INVALID_STATE        
= 2
    HTTP_PROCESSING_FAILED    
= 3
   
others                     = 4.
if SY-SUBRC <> 0.

 
call method CLIENT->GET_LAST_ERROR
   
importing
     
CODE    = RESPONSE_CODE
     
message = RESPONSE_TEXT.

  STATUS_CODE
= CLIENT->RESPONSE->GET_HEADER_FIELD( '~status_code' ).
  STATUS_REASON
= CLIENT->RESPONSE->GET_HEADER_FIELD( '~status_reason' ).
 
concatenate RESPONSE_TEXT '(' STATUS_CODE STATUS_REASON ')'
 
into STATUS_REASON separated by SPACE.

 
message I000(SR) with STATUS_REASON.

 
exit.
endif.

*Get header_fields contents such status code, reason etc
"call method client->response->GET_HEADER_FIELDS
"   changing
"     FIELDS             =  Fields_Tab  .
clear: W_RESULT.
W_RESULT
= CLIENT->RESPONSE->GET_CDATA( ).
refresh RESULT_TAB.
split W_RESULT at CL_ABAP_CHAR_UTILITIES=>NEWLINE into table RESULT_TAB.

loop at RESULT_TAB into RESULT_WA.
 
write / RESULT_WA.
endloop.

*&---------------------------------------------------------------------*

 

 

Step 3: This reports needs to be called at the end of the report from where multiple files has been created.

 

Through this approach we can easily control SAP PI channel and start/stop as per the requirement from ECC end.

 

Regards,

Pradeep

Viewing all 571 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>