on 12-21-2009 9:54 PM
PI Experts,
Is it so difficult to acheive in SAP PI? I hope I made the requirement clear.
Scenario: Sender AS2 adapter --> PI --> Receiver File (NFS) Adapter. Just a file pass through, no mapping
Requirement: Irrespective of sender adapter in a file pass through scenatio where we wont read the file (payload just contains the flat file), I want to delivery the same file with the naming convention C1.yyMMdd.C2 where C1, C2 are constants and yyMMdd is cuurent date. So sum up, need to have current date in a file name on receiver side with out reading the payload.
1) Variable substituation works on if we are are receiving the variable value from the payload.
2) Looks like ASMP works only same filename from a sender to a receiver file adapter, because if you are not using sender adapter or using sender adapter without selecting ASMP - File Name, there no way you can receive DynamicConfiguration under SOAP Header. Please correct me if I am worng.
3) Running the OS command after file processing to re-name the file, may be its the last resort, but I would expect and would like to do in PI.
What is the best possible solution?
- Riya Patil
.
Edited by: RaghuVamsee on Jan 13, 2010 2:51 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
.
Edited by: RaghuVamsee on Jan 13, 2010 2:51 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
import com.sap.aii.mapping.api.*;
import java.io.*;
import java.util.Map;
public class DataSubString implements StreamTransformation
{
private Map map;
String s;
public void setParameter(Map map1)
{
}
public void execute(InputStream inputstream, OutputStream outputstream) throws StreamTransformationException
{
try
{
// a) Set ouput File name
DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File" , "FileName");
String Outputfile = conf.put(key,("C1" + new Date() + "C2"));
// b) Just copy input file to output file
byte[] b = new bytehttp://inputstream.available();
inputstream.read(b);
String strContent = new String(b);
outputstream.write(strContent.getBytes());
} catch (Exception exception)
{
exception.printStackTrace();
}
}
}
Edited by: Raghu Vamsee on Jan 13, 2010 2:49 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I understand:-
1. File content is not read. So we can send a flat file, JPG file or any binary file.
2. Target file name should be C1 CurrentData C2.
Solutions:-
A. Write a Adapter Module in receiver file channel, it should change the file name as required. In this case, there is no need of ESR at all, we can just do configuration in ID.
/people/william.li/blog/2006/09/08/how-to-send-any-data-even-binary-through-xi-without-using-the-integration-repository
Disadvantage:- Adapter module coding is difficult. Requires more memory to run. Difficult to maintain. When there is other way, why to go with Adapter module :).
B. This is simple solution possible (Using Java Mapping).
Step 1:- In Sender File channel check u201CAdapter u2013 Specific Message Adapteru201D in Advanced tab. File Name should be checked.
Step 2:- In Receiver File channel check u201CAdapter u2013 Specific Message Adapteru201D in Advanced tab. File Name should be checked. Step 3:- Create dummy DT , MT (structure is not all important) in ESR.
Step 4:- Create OM using dummy MT ( sender and receiver MT is same), then MM as Java mapping.
What this Java mapping will do a) change the File Name using DynamicConfiguration (This is an element in SOAP header, you can see this one in SXI_MONITOR). b) Copy input payload to output payload without any change.
Hope you know how to implement Java Mapping. http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/8138. [original link is broken] [original link is broken] [original link is broken]
Edited by: Raghu Vamsee on Jan 13, 2010 2:48 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
package raghu;
import com.sap.aii.mapping.api.*;
import java.io.*;
import java.text.*;
import java.util.*;
public class DynamicFileName_JavaMapping implements StreamTransformation {
private Map param;
public void setParameter(Map map1) {
this.param = map1;
}
public void execute(InputStream inputstream, OutputStream outputstream) throws StreamTransformationException {
try {
// a) Set ouput File name
param.put(DynamicConfigurationKey.create("http://sap.com/xi/XI/Dynamic", StreamTransformationConstants.DYNAMIC_CONFIGURATION), "");
DynamicConfiguration conf = (DynamicConfiguration) param.get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File", "FileName");
DateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
conf.put(key, ("C1" + dateFormat.format(new Date()) + "C2"));
// b) Just copy input file to output file
byte[] b = new byte[inputstream.available()];
inputstream.read(b);
outputstream.write(b);
} catch (Exception exception) {
exception.printStackTrace();
}
}
}
Edited by: Raghu Vamsee on Jan 14, 2010 12:25 AM
Requirement: Irrespective of sender adapter in a file pass through scenatio where we wont read the file (payload just
contains the flat file), I want to delivery the same file with the naming convention C1.yyMMdd.C2 where C1, C2 are constants and
yyMMdd is cuurent date. So sum up, need to have current date in a file name on receiver side with out reading the payload.
Suppose C1 = Priya, C2 = Patil.....in mapping have the below logic:
Constant1(Riya.) -->
--> Concat1 -->
currentDate -->
Concat2 --> DyncamicUDF --> AnyTargetNode (can be even target Root Node)
Constant2(.Patil) -->
currentDate is present under the Date functions of Message Mapping.....double-click on currentDate and enter the date format (in your case it will be yyMMdd)
Input to Concat2 will come from Concat1 and Constant2.
UDF for Dynamic Configuration will be:
DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
String File_Name = var1 + ".txt";
conf.put(key, File_Name);
return " ";
In above UDF var1 represents the input to UDF....i.e. O/P of Concat2
You do not need to check ASMA in Sender channel.....it should be checked in receiver channel.
Regards,
Abhishek.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Abhishek,
We are getting the following error in SXMB_MONI:
Fatal Error: com.sap.engine.lib.xml.parser.Parser~
<SAP:Stack>com.sap.aii.utilxi.misc.api.BaseRuntimeException thrown during application mapping com/sap/xi/tf/_MM_Filename_: Fatal Error: com.sap.engine.lib.xml.parser.Parser~</SAP:Stack>
So looks like UDF is not working and it is failing in mapping. If I could make it work, I think there is good chance that I can see DynamicConfiguration under SOAP Header, which what required for the error we see in out test-2.
Can someone please help me to straighten this UDF and make it work.
Thanks in advance.
- Riya Patil
Hi Abhishek,
I have done the following tests:
Test-1) Select ASMP with 'File Name' on both sender and receiver file adapters without any mapping (UDF)
It works great. No UDF or mapping required. It is just pass through of file having the receiver file name same as in sender channel.
Test-2) Select ASMP with 'File Name', only on receiver file adapter without any mapping (UDF)
It is obvious, it doesn't work. I am getting the following error:
Could not process due to error: com.sap.aii.adapter.file.configuration.DynamicConfigurationException: The Adapter Message Property 'FileName' was configured as mandatory element, but there is no 'DynamicConfiguration' element in the XI Message header
Test-3) Select ASMP with 'File Name', only on receiver file adapter with mapping (using DynamicConfiguratio UDF)
We are getting the following error message in SXMB_MONI:
Fatal Error: com.sap.engine.lib.xml.parser.Parser~
<SAP:Stack>com.sap.aii.utilxi.misc.api.BaseRuntimeException thrown during application mapping com/sap/xi/tf/_MM_Filename_: Fatal Error: com.sap.engine.lib.xml.parser.Parser~</SAP:Stack>
Here is the code we have in UDF:
-
DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
String SourceFileName = "C1." + a + ".C2";
conf.put(key, SourceFileName);
return " ";
-
So looks like UDF is not working and it is failing in mapping. If I could make it work, I think there is good chance that I can see DynamicConfiguration under SOAP Header, which what required for the error we see in out test-2.
Can someone please help me to straighten this UDF and make it work.
Thanks in advance.
- Riya Patil
Test-1) Select ASMP with 'File Name' on both sender and receiver file adapters without any mapping (UDF)
Yes it should work with the same file name getting populated from Sender_File to Receiver_File
Test-2) Select ASMP with 'File Name', only on receiver file adapter without any mapping (UDF)
It should not work.
Test-3) Select ASMP with 'File Name', only on receiver file adapter with mapping (using DynamicConfiguratio UDF)
Your UDF looks good....can you tell me what does a stand for in your UDF.....as per my understanding it should be the Date....have you used the CurrentDate standard function and the input to the UDF is this Date function?
Have you mapped the output of the UDF to some target node properly....you can map it to even the root node.
Regards,
Abhishek.
Hi Abhishek,
You are right that a in UDF is the current date that I am passing to the UDF (CurrentDate standard function in the format yyMMdd) and I have mapped the output to the UDF to some target node properly.
I am still getting the following error:
<SAP:Stack>com.sap.aii.utilxi.misc.api.BaseRuntimeException thrown during application mapping com/sap/xi/tf/_MM_Lockbox_Filename_: Fatal Error: com.sap.engine.lib.xml.parser.Parser~</SAP:Stack>
<SAP:Retry>M</SAP:Retry>
Any help would be great.
- Riya Patil
Hi Raj,
I have tested end-to-end. I have sender file adapter (didn't turn on ASMP, bec this will be sender AS2 in reality) which is picking up the test file and receiver file adpter with ASMP turned on and interface mapping (message mapping) with the UDF. I still get the mapping error in SXMB_MONI. Sender file adapter picks the file correct, I can see the file contects in the moni.
Thanks for your help.
- Riya Patil
Hi Riya,
You are not returning target file name in your UDF.
===========================================================================================
//write your code here
DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
String ourSourceFileName = "C1." + a + ".C2";
String ourTargetFileName = ourSourceFileName;
conf.put(key, ourTargetFileName);
return ourTargetFileName;
===========================================================================================
Regards,
Gouri
Hi Shabarish
Please find below the my UDF code:
-
DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
String SourceFileName = "C1." + a + ".C2";
String TargetFileName = SourceFileName;
conf.put(key, TargetFileName);
return TargetFileName;
-
And mapping trace:
-
<Trace level="1" type="T">com.sap.aii.utilxi.misc.api.BaseRuntimeException: Fatal Error: com.sap.engine.lib.xml.parser.ParserException: XMLParser: No data allowed here: (hex) 54, 45, 53(:main:, row:1, col:3) at com.sap.aii.mappingtool.tf3.Transformer.checkParserException(Transformer.java:187) at com.sap.aii.mappingtool.tf3.Transformer.start(Transformer.java:174) at com.sap.aii.mappingtool.tf3.AMappingProgram.execute(AMappingProgram.java:118) at com.sap.aii.ibrun.server.mapping.JavaMapping.executeStep(JavaMapping.java:64) at com.sap.aii.ibrun.server.mapping.Mapping.execute(Mapping.java:92) at com.sap.aii.ibrun.server.mapping.MappingHandler.run(MappingHandler.java:90) at com.sap.aii.ibrun.sbeans.mapping.MappingRequestHandler.handleMappingRequest(MappingRequestHandler.java:95) at com.sap.aii.ibrun.sbeans.mapping.MappingRequestHandler.handleRequest(MappingRequestHandler.java:68) at com.sap.aii.ibrun.sbeans.mapping.MappingServiceImpl.processFunction(MappingServiceImpl.java:79) at com.sap.aii.ibrun.sbeans.mapping.MappingServiceObjectImpl0_0.processFunction(MappingServiceObjectImpl0_0.java:131) at sun.reflect.GeneratedMethodAccessor1102.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at com.sap.engine.services.ejb.session.stateless_sp5.ObjectStubProxyImpl.invoke(ObjectStubProxyImpl.java:187) at $Proxy182.processFunction(Unknown Source) at sun.reflect.GeneratedMethodAccessor12384.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at com.sap.engine.services.rfcengine.RFCDefaultRequestHandler.call(RFCDefaultRequestHandler.java:277) at com.sap.engine.services.rfcengine.RFCDefaultRequestHandler.handleRequest(RFCDefaultRequestHandler.java:219) at com.sap.engine.services.rfcengine.RFCJCOServer$J2EEApplicationRunnable.run(RFCJCOServer.java:254) at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37) at java.security.AccessController.doPrivileged(Native Method) at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:102) at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:172) Root Cause: com.sap.aii.utilxi.misc.api.BaseRuntimeException: Fatal Error: com.sap.engine.lib.xml.parser.ParserException: XMLParser: No data allowed here: (hex) 54, 45, 53(:main:, row:1, col:3) at com.sap.aii.mappingtool.tf3.rt.xparser.MTSaxHandler.run(MTSaxHandler.java:157) at com.sap.aii.mappingtool.tf3.rt.xparser.XParser.run(XParser.java:73) at java.lang.Thread.run(Thread.java:534) Root Cause: com.sap.engine.lib.xml.parser.NestedSAXParserException: Fatal Error: com.sap.engine.lib.xml.parser.ParserException: XMLParser: No data allowed here: (hex) 54, 45, 53(:main:, row:1, col:3)(:main:, row=1, col=3) -> com.sap.engine.lib.xml.parser.ParserException: XMLParser: No data allowed here: (hex) 54, 45, 53(:main:, row:1, col:3) at com.sap.engine.lib.xml.parser.XMLParser.scanProlog(XMLParser.java:2787) at com.sap.engine.lib.xml.parser.XMLParser.scanDocument(XMLParser.java:2832) at com.sap.engine.lib.xml.parser.XMLParser.parse0(XMLParser.java:231) at com.sap.engine.lib.xml.parser.AbstractXMLParser.parseAndCatchException(AbstractXMLParser.java:145) at com.sap.engine.lib.xml.parser.AbstractXMLParser.parse(AbstractXMLParser.java:160) at com.sap.engine.lib.xml.parser.AbstractXMLParser.parse(AbstractXMLParser.java:261) at com.sap.engine.lib.xml.parser.Parser.parseWithoutSchemaValidationProcessing(Parser.java:280) at com.sap.engine.lib.xml.parser.Parser.parse(Parser.java:342) at com.sap.engine.lib.xml.parser.SAXParser.parse(SAXParser.java:125) at javax.xml.parsers.SAXParser.parse(SAXParser.java:345) at com.sap.aii.mappingtool.tf3.rt.xparser.MTSaxHandler.run(MTSaxHandler.java:155) at com.sap.aii.mappingtool.tf3.rt.xparser.XParser.run(XParser.java:73) at java.lang.Thread.run(Thread.java:534) -
at com.sap.engine.lib.xml.parser.SAXParser.parse(SAXParser.java:144) at javax.xml.parsers.SAXParser.parse(SAXParser.java:345) at com.sap.aii.mappingtool.tf3.rt.xparser.MTSaxHandler.run(MTSaxHandler.java:155) at com.sap.aii.mappingtool.tf3.rt.xparser.XParser.run(XParser.java:73) at java.lang.Thread.run(Thread.java:534) Caused by: com.sap.engine.lib.xml.parser.ParserException: XMLParser: No data allowed here: (hex) 54, 45, 53(:main:, row:1, col:3) at com.sap.engine.lib.xml.parser.XMLParser.scanProlog(XMLParser.java:2787) at com.sap.engine.lib.xml.parser.XMLParser.scanDocument(XMLParser.java:2832) at com.sap.engine.lib.xml.parser.XMLParser.parse0(XMLParser.java:231) at com.sap.engine.lib.xml.parser.AbstractXMLParser.parseAndCatchException(AbstractXMLParser.java:145) at com.sap.engine.lib.xml.parser.AbstractXMLParser.parse(AbstractXMLParser.java:160) at com.sap.engine.lib.xml.parser.AbstractXMLParser.parse(AbstractXMLParser.java:261) at com.sap.engine.lib.xml.parser.Parser.parseWithoutSchemaValidationProcessing(Parser.java:280) at com.sap.engine.lib.xml.parser.Parser.parse(Parser.java:342) at com.sap.engine.lib.xml.parser.SAXParser.parse(SAXParser.java:125) ... 4 more</Trace>
<Trace level="1" type="T">Runtime exception occurred during execution of application mapping program com/sap/xi/tf/_MM_Lockbox_Filename_: com.sap.aii.utilxi.misc.api.BaseRuntimeException; Fatal Error: com.sap.engine.lib.xml.parser.ParserException: XMLParser: No data allowed here: (hex) 54, 45, 53(:main:, row:1, col:3)</Trace>
<Trace level="1" type="T">com.sap.aii.ibrun.server.mapping.MappingRuntimeException: Runtime exception occurred during execution of application mapping program com/sap/xi/tf/_MM_Lockbox_Filename_: com.sap.aii.utilxi.misc.api.BaseRuntimeException; Fatal Error: com.sap.engine.lib.xml.parser.ParserException: XMLParser: No data allowed here: (hex) 54, 45, 53(:main:, row:1, col:3) at com.sap.aii.ibrun.server.mapping.JavaMapping.executeStep(JavaMapping.java:73) at com.sap.aii.ibrun.server.mapping.Mapping.execute(Mapping.java:92) at com.sap.aii.ibrun.server.mapping.MappingHandler.run(MappingHandler.java:90) at com.sap.aii.ibrun.sbeans.mapping.MappingRequestHandler.handleMappingRequest(MappingRequestHandler.java:95) at com.sap.aii.ibrun.sbeans.mapping.MappingRequestHandler.handleRequest(MappingRequestHandler.java:68) at com.sap.aii.ibrun.sbeans.mapping.MappingServiceImpl.processFunction(MappingServiceImpl.java:79) at com.sap.aii.ibrun.sbeans.mapping.MappingServiceObjectImpl0_0.processFunction(MappingServiceObjectImpl0_0.java:131) at sun.reflect.GeneratedMethodAccessor1102.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at com.sap.engine.services.ejb.session.stateless_sp5.ObjectStubProxyImpl.invoke(ObjectStubProxyImpl.java:187) at $Proxy182.processFunction(Unknown Source) at sun.reflect.GeneratedMethodAccessor12384.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at com.sap.engine.services.rfcengine.RFCDefaultRequestHandler.call(RFCDefaultRequestHandler.java:277) at com.sap.engine.services.rfcengine.RFCDefaultRequestHandler.handleRequest(RFCDefaultRequestHandler.java:219) at com.sap.engine.services.rfcengine.RFCJCOServer$J2EEApplicationRunnable.run(RFCJCOServer.java:254) at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37) at java.security.AccessController.doPrivileged(Native Method) at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:102) at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:172) Root Cause: com.sap.aii.utilxi.misc.api.BaseRuntimeException: Fatal Error: com.sap.engine.lib.xml.parser.ParserException: XMLParser: No data allowed here: (hex) 54, 45, 53(:main:, row:1, col:3) at com.sap.aii.mappingtool.tf3.Transformer.checkParserException(Transformer.java:187) at com.sap.aii.mappingtool.tf3.Transformer.start(Transformer.java:174) at com.sap.aii.mappingtool.tf3.AMappingProgram.execute(AMappingProgram.java:118) at com.sap.aii.ibrun.server.mapping.JavaMapping.executeStep(JavaMapping.java:64) at com.sap.aii.ibrun.server.mapping.Mapping.execute(Mapping.java:92) at com.sap.aii.ibrun.server.mapping.MappingHandler.run(MappingHandler.java:90) at com.sap.aii.ibrun.sbeans.mapping.MappingRequestHandler.handleMappingRequest(MappingRequestHandler.java:95) at com.sap.aii.ibrun.sbeans.mapping.MappingRequestHandler.handleRequest(MappingRequestHandler.java:68) at com.sap.aii.ibrun.sbeans.mapping.MappingServiceImpl.processFunction(MappingServiceImpl.java:79) at com.sap.aii.ibrun.sbeans.mapping.MappingServiceObjectImpl0_0.processFunction(MappingServiceObjectImpl0_0.java:131) at sun.reflect.GeneratedMethodAccessor1102.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at com.sap.engine.services.ejb.session.stateless_sp5.ObjectStubProxyImpl.invoke(ObjectStubProxyImpl.java:187) at $Proxy182.processFunction(Unknown Source) at sun.reflect.GeneratedMethodAccessor12384.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at com.sap.engine.services.rfcengine.RFCDefaultRequestHandler.call(RFCDefaultRequestHandler.java:277) at com.sap.engine.services.rfcengine.RFCDefaultRequestHandler.handleRequest(RFCDefaultRequestHandler.java:219) at com.sap.engine.services.rfcengine.RFCJCOServer$J2EEApplicationRunnable.run(RFCJCOServer.java:254) at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37) at java.security.AccessController.doPrivileged(Native Method) at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:102) at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:172) Root Cause: com.sap.aii.utilxi.misc.api.BaseRuntimeException: Fatal Error: com.sap.engine.lib.xml.parser.ParserException: XMLParser: No data allowed here: (hex) 54, 45, 53(:main:, row:1, col:3) at com.sap.aii.mappingtool.tf3.rt.xparser.MTSaxHandler.run(MTSaxHandler.java:157) at com.sap.aii.mappingtool.tf3.rt.xparser.XParser.run(XParser.java:73) at java.lang.Thread.run(Thread.java:534) Root Cause: com.sap.engine.lib.xml.parser.NestedSAXParserException: Fatal Error: com.sap.engine.lib.xml.parser.ParserException: XMLParser: No data allowed here: (hex) 54, 45, 53(:main:, row:1, col:3)(:main:, row=1, col=3) -> com.sap.engine.lib.xml.parser.ParserException: XMLParser: No data allowed here: (hex) 54, 45, 53(:main:, row:1, col:3) at com.sap.engine.lib.xml.parser.XMLParser.scanProlog(XMLParser.java:2787) at com.sap.engine.lib.xml.parser.XMLParser.scanDocument(XMLParser.java:2832) at com.sap.engine.lib.xml.parser.XMLParser.parse0(XMLParser.java:231) at com.sap.engine.lib.xml.parser.AbstractXMLParser.parseAndCatchException(AbstractXMLParser.java:145) at com.sap.engine.lib.xml.parser.AbstractXMLParser.parse(AbstractXMLParser.java:160) at com.sap.engine.lib.xml.parser.AbstractXMLParser.parse(AbstractXMLParser.java:261) at com.sap.engine.lib.xml.parser.Parser.parseWithoutSchemaValidationProcessing(Parser.java:280) at com.sap.engine.lib.xml.parser.Parser.parse(Parser.java:342) at com.sap.engine.lib.xml.parser.SAXParser.parse(SAXParser.java:125) at javax.xml.parsers.SAXParser.parse(SAXParser.java:345) at com.sap.aii.mappingtool.tf3.rt.xparser.MTSaxHandler.run(MTSaxHandler.java:155) at com.sap.aii.mappingtool.tf3.rt.xparser.XParser.run(XParser.java:73) at java.lang.Thread.run(Thread.java:534) -
at com.sap.engine.lib.xml.parser.SAXParser.parse(SAXParser.java:144) at javax.xml.parsers.SAXParser.parse(SAXParser.java:345) at com.sap.aii.mappingtool.tf3.rt.xparser.MTSaxHandler.run(MTSaxHandler.java:155) at com.sap.aii.mappingtool.tf3.rt.xparser.XParser.run(XParser.java:73) at java.lang.Thread.run(Thread.java:534) Caused by: com.sap.engine.lib.xml.parser.ParserException: XMLParser: No data allowed here: (hex) 54, 45, 53(:main:, row:1, col:3) at com.sap.engine.lib.xml.parser.XMLParser.scanProlog(XMLParser.java:2787) at com.sap.engine.lib.xml.parser.XMLParser.scanDocument(XMLParser.java:2832) at com.sap.engine.lib.xml.parser.XMLParser.parse0(XMLParser.java:231) at com.sap.engine.lib.xml.parser.AbstractXMLParser.parseAndCatchException(AbstractXMLParser.java:145) at com.sap.engine.lib.xml.parser.AbstractXMLParser.parse(AbstractXMLParser.java:160) at com.sap.engine.lib.xml.parser.AbstractXMLParser.parse(AbstractXMLParser.java:261) at com.sap.engine.lib.xml.parser.Parser.parseWithoutSchemaValidationProcessing(Parser.java:280) at com.sap.engine.lib.xml.parser.Parser.parse(Parser.java:342) at com.sap.engine.lib.xml.parser.SAXParser.parse(SAXParser.java:125) ... 4 more</Trace>
<Trace level="1" type="E">CL_XMS_PLSRV_MAPPING~ENTER_PLSRV</Trace>
</Trace>
-
Thanks for helping me on this.
- Riya Patil
Hi Gouri,
I have changed mu UDF as you mentioned to
-
DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
String SourceFileName = "C1." + a + ".C2";
String TargetFileName = SourceFileName;
conf.put(key, TargetFileName);
return TargetFileName;
-
I am still getting message mapping error.
Thanks,
Riya Patil
Hi Riya,
Just curiosity, what is your source file format? Is it XML? If its text file, are you using FCC or not (as you are saying its pass through interface)?
Because mapping will execute only if source payload is XML.
R u using mapping just to add UDF?
IDOC to file scenario works perfectly fine with dynamic configuration even though u dont set any ASMA parameters at sender as we dont have sender communication channel.
-Gouri
Hi Riya,
Please do following steps.
Define Source Data Type as follows.
DataType
->Row
---> Data
Define message type corresponding to this.
Now in mapping use same message type for source and target. Constant to Data Type, Map Row --> UDF --> Row and Data to Data directly.
(Please use UDF the one which I gave)
In Sender and receiver channel, again use FCC as follows.
Row.fieldNames = Data
Row.fieldSeparator = 'nl'
Row.ProcessFieldNames = fromConfiguration
Row.LastFieldsOptional = YES
ignoreRecordsetName = TRUE
Please activate ASMA parameters in receiver channel. Please create other objects like Message Interface, Sender Agreement, Receiver Agreement, Interface determination, Receiver Determination as per these details.
This should solve your problem.
_Gouri
Hi Riya,
As you are using mapping, you have to pass XML payload. With text payload mapping will not execute.
Secondly, Sorry I forgot you want to pass date.
Do following mapping for Row.
If
Date --> UDF --> = (Constant with value constant)
Then Pass Row to target else pass Row to target.
This will ensure your UDF will get executed and Row will also be mapped to Row.
Your UDF output will never be equal to "Constant " and hence Row will always be mapped to Row.
For Date, you can use standard function with whatever format you need. Let me know output.
-Gouri
Just try this UDF it should work.. I don't have system with me so cannot check it but this is well known solution, so it should work.
DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
String SourceFileName = "C1." + a + ".C2";
conf.put(key, SourceFileName);
return "";
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
> How does this UDF work with out selecting in both sender, receiver file adpters ASMP?
This will not work without selecting the ASMA settings.
> I mean how do you pass this value "C1." + a + ".C2" to file name schema in receiver file adapter?
Use any temp name which will be overwritten because of ASMA settings.
User | Count |
---|---|
93 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.