on 10-02-2015 7:59 PM
HI guys,
I'm working in PI 7.1 and I have to create a target file that contains the names of source files. Is this possible?
For example:
Source Directory:
Archive_1.txt
Archive_2.txt
Archive_3.txt
Content of target file:
Archive_1.txt, Archive_2.txt, Archive_3.txt
Regards
Martin
Hello Martin,
It is possible.
Use the below UDF in mapping to get the input file name and map it to the target fields
try {
String filename = "";
String timestamp = "";
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);
return filename;
}
catch(Exception e)
{
String exception = e.toString();
return exception;
}
You can use append mode in the receiver file adapter to write all the filenames in the single file
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Raghuraman/Ramkumar,
The Receiver channel is configured as follows:
The XML I get the channel receiver is:
<ns0:MT_FILE xmlns:ns0="http://test.com/pi/test/">
<LINE>Archive_1.txt</LINE>
</ns0:MT_FILE>
And the target file is created but empty.
I need help to set the destination channel for my flat file containing the file name "Archive_1.txt".
Regards.
Martin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Refer thread - https://scn.sap.com/thread/3371847
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
ok you can use dynamic configuration ASMA in mapping and get the source file name and map it to target field.
<MT_Target>
<data> source file name </data>
</MT-Target>
in the channel you need to use File content conversion to take only data values.. .and mode should be "append"..
or you can use Java mapping and create a file.
Sample Code - Dynamic Configuration in Java and ABAP Mapping - Process Integration - SCN Wiki
User | Count |
---|---|
84 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.