Skip to Content

Problem statement: create  zero (0) byte trigger file after creation of file successfully at receiver side in pass through scenario.

Business Requirement: many times we have requirement to create 1 trigger file without any data after PI creates any data file successfully at receiver side.

In this blog I will be transferring “ testing_successful.txt” file from X location to location Y using pass through scenarios and after transfer ,trigger file with 0 byte size will be created at receiver location with the same time stamp as the main file.

 

Assumptions

  1. Input file name : testing_successful.txt
  2. Output file name : testing_successful.txt             (timestamp 20170417 09:07:00)
  3. Trigger file name : testing_successful.trg             (timestamp 20170417 09:07:00)

Enterprise Service Repository development :

  1. Create DATATYPE for input message (as per your input file)
  1. Create DATATYPE for trigger file (it will be same for all trigger file not dependent on your input and output data structure)
  1. Create Message type for Input and Trigger File data type
  2. Create Service interfaces for both Message types
  3. Create message mapping for trigger file

Map root node of output structure with UDF.

Here is the code for UDF

—————-

String filename = new String(“”);

 

DynamicConfiguration conf1 = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);

DynamicConfigurationKey key1 = DynamicConfigurationKey.create(“http:/”+”/sap.com/xi/XI/System/File”,”FileName”);

 

filename = conf1.get(key1);

filename = filename.replaceAll( “.txt” ,”.trg” );

 

conf1.put(key1,filename);

 

return filename;

—————————————

replace input file extension with any other extension. (here I am replacing .txt with .trg)

No other mapping required.

  1. Create operation mapping

Activate all objects.

Here ESR development completed.

——————————————————-

Integration Directory Configuration:

 

  1. Create Configuration scenario.
  2. Create Business System for sender and receiver (I have used the same BS for both)
  1. Create sender channel as per given details(I have used File (NFS) adapter)
    1. Use ASMA option checked
  1. Create Receiver channel for file1 (main file with data) (I have used File(NFS)adapter)
    1. ASMA should be checked
  1. Create receiver channel for empty trigger file (file (NFS) used)
    1. File Construction mode :create
    2. In the advanced tab :Use ASMA
    3. Now go to Module tab and module in the given sequence :

localejbs/AF_Modules/MessageTransformBean

4. Now provide parameter value for above mention modules (all values here are independent of your input message so just copy them as it is.

  1. Create interface determination
    1. While adding Receiver Interface details provide dummy values for 1st row(as its pass-through scenario)
    2. Add operation mapping for trigger file in 2nd
    3. Don’t forget to check Maintain Order at runtime check box
  2. Create Receiver Determination
  3. Create sender and receiver agreement for respective channels.
  4. Save all objects and activate it.
  5. Now test the scenario

2 files successfully created ,1 with data  and other one empty file

————————————————————————————————————————————–

Please go through the link to access the document with screen shots :

https://drive.google.com/open?id=0B7Pvel0dS_4nOTF2LUxVMXBjUXM

 

 

Thanks,

Pooja Tiwari

To report this post you need to login first.

Be the first to leave a comment

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

Leave a Reply