Trigger File creation with same name as input with different extension in SAP PO
In my previous blog I shared learning of creation of empty trigger file at receiver side in passthrough scenario.
you can access the same here:
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.
- Input file name : multiple.txt
- Output file name : multiple.txt (timestamp 20170419 04:26:00)
- Trigger file name : multiple.trg (timestamp 20170419 04:26:00)
Enterprise Service Repository development :
- Create DATATYPE for input message (as per your input file)
- Create DATATYPE for output message
- Create DATATYPE for trigger file (it will be same for all trigger file not dependent on your input and output data structure)
- Create Message type for Input ,output and Trigger File data type
- Create Service interfaces for all 3 Message types
- Create mapping as per your requirement for data file.
- 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” );
No other mapping required.
- Create 2 different operation mappings.
Save all objects and activate them.
Here ESR development completed.
Integration Directory Configuration:
- Create Configuration scenario.
- Create Business System for sender and receiver (I have used the same BS for both)
- Create sender channel as per given details(I have used File (NFS) adapter)
- Use ASMA option checked
- Create Receiver channel for file1 (main file with data) (I have used File(NFS)adapter)
- ASMA should be checked
- Create receiver channel for empty trigger file (file (NFS) used)
- In advanced tab:check ASMA
- File Construction mode :create
- In the module tab,provide these modules in the mentioned sequence in pdf link below.
- Now provide parameter value for above mention modules (all values here are independent of your input message so just copy them as it is.)
- Create interface determination
- While adding Receiver Interface details provide operation mapping for main data file in 1st
- Add operation mapping for trigger file in 2nd
- Don’t forget to check Maintain Order at runtime check box
- Create Receiver Determination
- Create sender and receiver agreement for respective channels.
- Save all objects and activate it.
- 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
Please share your comments if any improvements required.
Thanks and regards,