on 12-06-2013 5:13 PM
Hello guys,
I created interface FTP to FTP without integration repository, the interface is ok but now, I need know if is possible to create the file of destination like this:
Input File:
GYLABRS_RH_ADPxGY_OUT_PYRB0653_20130205_203046_001.txt
output file:
PYRB0653_20130205_203046_001.dat
It´s possible? If yes, how can I do that?
Thanks a lot.
Felipe
Hello,
U have to use either Java mapping or Adapter module to rename file name.
Dynamic file name for pass-through scenario - Process Integration - SCN Wiki
Thanks
Amit Srivastava
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Amit Srivastava,
I´m try to develop this solution
But I not understand in javamapping where this code, get the input name?!
Java Mapping
// a) Set Output File name 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");
Regards
Felipe
Hello,
Below code will get the input name
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");
//Getting Source FileName
getFileName = conf.get(key);
//and for setting new filename use below statement
conf.put(key,newtFileName); Thanks Amit Sriivastava |
Hi Guys,
The problem got solved!
Thanks All for help me!
Regards,
Felipe Martin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Guys,
I did this java mapping like this post
I followed all steps, but now the sxi_moni returned this error.
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
- <!-- Request Message Mapping
-->
- <SAP:Error xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="">
<SAP:Category>Application</SAP:Category>
<SAP:Code area="MAPPING">LINKAGE_ERROR</SAP:Code>
<SAP:P1>DynamicFileName_JavaMapping</SAP:P1>
<SAP:P2>java.lang.NoClassDefFoundError: DynamicFileName_Ja</SAP:P2>
<SAP:P3>vaMapping (wrong name: com/javaMapping/DynamicFile</SAP:P3>
<SAP:P4>Name_JavaMapping)</SAP:P4>
<SAP:AdditionalText />
<SAP:Stack>Linkage error while loading class DynamicFileName_JavaMapping; java.lang.NoClassDefFoundError: DynamicFileName_JavaMapping (wrong name: com/javaMapping/DynamicFileName_JavaMapping)</SAP:Stack>
<SAP:Retry>M</SAP:Retry>
</SAP:Error>
Please suggest??
attached java mapping and imported File in PI
.
package com.javaMapping;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Map;
import com.sap.aii.mapping.api.AbstractTransformation;
import com.sap.aii.mapping.api.DynamicConfiguration;
import com.sap.aii.mapping.api.DynamicConfigurationKey;
import com.sap.aii.mapping.api.StreamTransformationConstants;
import com.sap.aii.mapping.api.StreamTransformationException;
import com.sap.aii.mapping.api.TransformationInput;
import com.sap.aii.mapping.api.TransformationOutput;
public class DynamicFileName_JavaMapping extends AbstractTransformation
{
public void transform(TransformationInput transformationInput, TransformationOutput transformationOutput)
throws StreamTransformationException
{
try
{
InputStream inputstream = transformationInput.getInputPayload().getInputStream();
OutputStream outputstream = transformationOutput.getOutputPayload().getOutputStream();
Map mapParameters = (Map) transformationInput.getInputHeader().getAll();
// a) Set Output File name
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");
//Depending on your requirement edit this logic. Here, NewDynamicName + CurrentDate will be output file name.
String filename_in = conf.get(key);
filename_in = filename_in.substring(filename_in.indexOf("PYRB0653")).replaceAll(".txt", ".dat");
conf.put(key, filename_in);
// b) Just copy Input file content to Output file content
byte[] b = new byte[inputstream.available()];
inputstream.read(b);
outputstream.write(b);
} catch (Exception exception)
{
getTrace().addDebugMessage(exception.getMessage());
throw new StreamTransformationException(exception.toString());
}
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
Which version of PI u r using?
I think u r not importing archives files properly?
Open ur exported project zip file -> unzip it -> then search and open "bin" folder -> once u do that u will find a folder name with "com" inside it-> zip that folder and import the same in PI and then test ur JM
Thanks
Amit Srivastava
one more way is to set OS command in receiver communication channel that will rename your file.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Felipe,
Kindly use this udf for dynamic file name.
public
class
DynamicFileName_JavaMapping
extends
AbstractTransformation
{
public
void
transform(TransformationInput transformationInput, TransformationOutput transformationOutput)
throws
StreamTransformationException
{
try
{
InputStream inputstream = transformationInput.getInputPayload().getInputStream();
OutputStream outputstream = transformationOutput.getOutputPayload().getOutputStream();
Map mapParameters = (Map) transformationInput.getInputHeader().getAll();
// a) Set Output File name
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"
);
//Depending on your requirement edit this logic. Here, NewDynamicName + CurrentDate will be output file name.
DateFormat dateFormat =
new
SimpleDateFormat(
"yyyyMMdd"
);
conf.put(key, (
"NewDynamicName_"
+ dateFormat.format(
new
Date())) +
".pdf"
);
// b) Just copy Input file content to Output file content
byte
[] b =
new
byte
[inputstream.available()];
inputstream.read(b);
outputstream.write(b);
}
catch
(Exception exception)
{
getTrace().addDebugMessage(exception.getMessage());
throw
new
StreamTransformationException(exception.toString());
}
}
}
Best Regards,
Monikandan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Felip,
you can create a filename without dynamic configuration and without ESR using the variable substitution, but you need to define the file name format.
Please cehck the variable substitution section in below link.
But if you want to use modified source file name then you need to implement that in ESR or adapter mudule.
Regards,
Harish
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
83 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
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.