Hi All,

Trigger File creation with same name as inputIn my previous blog I shared learning of creation of empty trigger file at receiver side in passthrough scenario.

you can access the same here:

https://blogs.sap.com/2017/04/18/empty-trigger-file-creation-at-receiver-side-in-sap-po/

Now in this blog I will share how to create empty trigger file with same name as input but different extension where mapping is involved:

Problem statement: create  zero (0) byte trigger file after creation of file successfully at receiver side in when mapping is involved.

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 creating “ multiple.txt” file using graphical mapping and after creation ,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 : multiple.txt
  2. Output file name : multiple.txt (timestamp 20170419 04:26:00)
  3. Trigger file name : multiple.trg (timestamp 20170419 04:26:00)

Enterprise Service Repository development :

  1. Create DATATYPE for input message (as per your input file)
  1. Create DATATYPE for output message
  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 ,output and Trigger File data type
  2. Create Service interfaces for all 3 Message types
  3. Create mapping as per your requirement for data file.
  4. Create message mapping for trigger file

Map root node of output structure UDF created (dynamicFileName).

Here is the code for replacing .txt with .trg for trigger file.

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

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;

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

No other mapping required.

  1. Create 2 different operation mappings.

Save all objects and activate them.

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. In advanced tab:check ASMA
    2. File Construction mode :create
    3. In the module tab,provide these modules in the mentioned sequence in pdf link below.
    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 operation mapping for main data file in 1st
    2. Add operation mapping for trigger file in 2nd
    3. Don’t forget to check Maintain Order at runtime check box
  1. Create Receiver Determination
  2. Create sender and receiver agreement for respective channels.
  3. Save all objects and activate it.
  4. Now test the scenario

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


To access the document with all screen shot,go to the link below

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


Please share your comments if any improvements required.

Thanks and regards,

Pooja Tiwari

New NetWeaver Information at SAP.com

Very Helpfull

 

 

User Rating: Be the first one !