on 02-23-2011 4:15 AM
Hi All,
I have a scenario where i am using java mapping. In this i am doing following
1)Read file name from input message header
2)set file name in output message Header
3) set Directory name in output message Header
i have used following code .. but iit is not working... when i test end to end... in reciver communication channel it is failing stating " message failed as "Directory is not set in Header. Also i checked in SXMB_MONI "dynamic configuration".It is not showing Directory.
this is code.
public void transform(TransformationInput transformationInput,TransformationOutput transformationOutput)
throws StreamTransformationException {
private Map para;
String Directory ;
String inputFileName;
String var1 = "ABC";
para = transformationInput.getInputHeader().getAll();
DynamicConfiguration conf = (DynamicConfiguration) para
.get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey keyFileName1 = DynamicConfigurationKey
.create("http://sap.com/xi/XI/System/File", "FileName");
inputFileName = conf.get(keyFileName1);
DynamicConfigurationKey keyFilename = DynamicConfigurationKey
.create("http://sap.com/xi/XI/System/File", "FileName");
DynamicConfigurationKey keyDirecory = DynamicConfigurationKey
.create("http://sap.com/xi/XI/System/File", "Directory");
Directory = "tmp/"+var1;
conf.put(keyFilename,inputFileName);
conf.put(keyDirecory, Directory);
}
I am in PI 7.1 , and in eclipse its showing warning that Para is not used.
Can anyone show some lights.
Also is there any way to debug this?? like is there any function by which i can write the trace for each step to see those in MONI.
Method name: public void createDirectory(Resultlist result, Container container)throws StreamTransformationException
//Use Simple UDF and do the following lines
String Directory ;
String inputFileName;
String var1 = "ABC";
DynamicConfiguration conf = container
.getTransformationParameters()
.get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey keyFileName1 = DynamicConfigurationKey
.create("http://sap.com/xi/XI/System/File", "FileName");
inputFileName = conf.get(keyFileName1);
DynamicConfigurationKey keyFilename = DynamicConfigurationKey
.create("http://sap.com/xi/XI/System/File", "FileName");
DynamicConfigurationKey keyDirecory = DynamicConfigurationKey
.create("http://sap.com/xi/XI/System/File", "Directory");
Directory = "tmp/"+var1;
conf.put(keyFilename,inputFileName);
conf.put(keyDirecory, Directory);
}
and remove these 3 lines
//private Map para;
//para = transformationInput.getInputHeader().getAll();
//DynamicConfiguration conf = (DynamicConfiguration) para.get(StreamTransformationConstants.DYNAMIC_CONFIGURATION
>>I am in PI 7.1 , and in eclipse its showing warning that Para is not used.Can anyone show some lights.
You can simply remove declaring Map Para line... The eclipse gives warning because you dont assign values for it and you are trying to use...
For using the same input file name in output side, you dont need coding ... you need only for the directory...
Enable ASMA attributes in the channel.
Edited by: Baskar Gopal on Feb 24, 2011 10:58 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
Here is a link from the wiki explaining how to use the PI 7.1 Java Mapping api
http://wiki.sdn.sap.com/wiki/display/XI/UsingPI7.1APIforJavamapping
Here is also a sample code as well,
https://wiki.sdn.sap.com/wiki/display/XI/SampleJAVAMappingcodeusingPI7.1+API
In your case, instead of using
private Map para;
para = transformationInput.getInputHeader().getAll();
DynamicConfiguration conf = (DynamicConfiguration) para
.get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
You could try using
DynamicConfiguration conf = transformationInput.getDynamicConfiguration();
Hope this helps,
Mark
Edited by: Mark Dihiansan on Feb 23, 2011 11:41 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Please check the below link:
http://help.sap.com/javadocs/pi/SP3/xpi/com/sap/aii/mapping/api/DynamicConfiguration.html
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
You can throw the exception explicitly using the following statement in catch block.
throw new StreamTransformationException("", exeption_obj);
1. Implement your mapping program, when ever handling exceptions throw StreamTransformationException in catch block.
2. Create Instance for MappingTrace or AbstactTrace (as shown in above statement).
3. Add your message by using methodu2019s of above classes by category (Info/Warning/Debug).
4. Pass the fields from the program to trace message, in order to check the status in SXMB_MONI.
In addition Please refer following link.
1. http://help.sap.com/saphelp_nw04/helpdata/en/e2/e13fcd80fe47768df001a558ed10b6/content.htm
Hope this helps
Regards,
Deepak
Edited by: Deepak Shah on Feb 23, 2011 10:43 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Have you ticked the option of Set Adapter-Specific Mesage Attributes and under that File Name and Directory in the Communication channel?
If you just want the source file name as the target file name you need not write the code. Just ticking the Set ASMA and File Name in communication channel is enough.
Regards,
Aravind
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
9 | |
7 | |
6 | |
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.