on 01-19-2015 2:45 PM
Dear Experts,
I have received a new requirement on File to File scenario.
PI has to pick a file from one network directory and place it on specific directory. Please note that there will not be any mapping as client does't want to change the file content...
File Names will be:
Partner1_001_Invoice.xml
Partner1_002_Invoice.xml
.........
Partner2_001_Invoice.xml
Partner2_002_Invoice.xml
.....
In Target System, the directories will be like following....
Partner1
---001
---002
Partner2
---001
---002
In this case, PI has pick the file 'Partner1_001_Invoice.xml' file and it should place file on following directory...
Partner1
---001
and so on...
Need help to configure the above interface....
Thanks-
Rams
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Dear Praveen,
I am trying to create java code by copying your code, however i am getting many errors. (shown on below screenshot). Could you please check and help me to resolve these?
For Instance the error is like...the import com.sap.aii.mapping.api.AbstractTransformation cannot be resolved
waiting for your feedback...
thanks-
Rams
Thanks Praveen,
Now i am trying to change the java code as per my requirement. However I am unable to do it.
Is it possible to you to help me to build the java code as per my requirement? I have to pick the Root and Subdirectory from the file name and place the file with same name as it picks from the source field.
It would be very thankful if you could help me in this case.
Best Regards,
Rams
Dear Praveen,
I am able to complete the JAVA mapping.
I am using File Adapters both ends and enabled 'Adapter-Specific Attributes' with 'File Name'. Also in the receiver File Adapter i mention * in the target Directory and also on Target File Name.
I ran the interface and it is failed on receiver file adapter with following error...
File processing failed with Target directory 'T:\usr\sap\XD1\DVEBMGS68\j2ee\cluster\server0\*' does not exist and cannot be created
However in the Java Code, for time being i have passed constant Target Directory name.
Following is the code....Could you please check and help me to resolve....
String targetDir= "//intsap/intpi/XD1";
// set the target root directory ends
String subDir ="/";
try {
InputStream inputstream = transformationInput.getInputPayload()
.getInputStream();
OutputStream outputstream = transformationOutput.getOutputPayload()
.getOutputStream();
Map mapParameters = (Map) transformationInput.getInputHeader()
.getAll();
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", "FileName");
DynamicConfiguration conf1 = (DynamicConfiguration) mapParameters.get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key1 = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File", "Directory");
String filename=conf.get(key);
// Setting the Directory and Filename
conf.put(key,filename);
conf1.put(key1,targetDir);
// Copying Input file and writing it as Output file
byte[] b = new byte[inputstream.available()];
inputstream.read(b);
outputstream.write(b);
} catch (Exception exception) {
getTrace().addDebugMessage(exception.getMessage());
throw new StreamTransformationException(exception.toString());
Hi Praveen,
It's strange, i could see the directory name on Message but it is trying to put it on different folder...
however in the Audit Log...
Adapter Framework caught exception: Target directory 'T:\usr\sap\XD1\DVEBMGS68\j2ee\cluster\server0\*' does not exist and cannot be created
Please help me...
regards,
Rams
>>>File processing failed with Target directory 'T:\usr\sap\XD1\DVEBMGS68\j2ee\cluster\server0\*' does not exist and cannot be created
Did you also select the check box for Directory name under adapter specific message attributes in your receiver channel.
I see that you are trying to create the files under "//intsap/intpi/XD1" ? Are you sure if this directory path exists?
is it a shared drive? "//intsap" ?
Hi Hareesh,
As of now, I have passed the target Directory as a constant. However as per the requirement I have get the Directory/SubDirectory names from the File Name and place the file on it...
As i am not JAVA resource, I am unable to write the logic on JAVA. It would be thankful if you could provide me some code to get the directory names from the file name....
After this i will close the thread...
Thanks-
Rams
Dears,
I have used array operation along with string operations to retrieve the target directory names from File Name...
String[] splitted = filename.split("_");
String Part1 = splitted[0];
String Part2 = splitted[1];
targetDirectory = "//" + Part1 + "/" + Part2;
config1.put(key1,targetDirectory);
thanks-
Rams
http://wiki.scn.sap.com/wiki/display/XI/Dynamic+file+name+for+pass-through+scenario
please follow steps mentioned in wiki. Use dynamic folder instead of filename.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Try with variable subtitution: http://help.sap.com/saphelp_nwpi711/helpdata/en/44/6a316af5a23672e10000000a114a6b/frameset.htm
Regards.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Here you go.
Dynamic file name in a File to File pass through scenario - Code Gallery - SCN Wiki
You can create a java mapping as per this blog. Using this option, you can create both dynamic file name and dynamic folder with some manipulations in this java code.
Regards,
Kedar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.