on 12-12-2006 1:44 PM
Hi all!
I try to configure scenario:
Get all files from directory (it will not be the same number of file every time) and mapping this file to the ERP system. I use File adapter to do this. But what Is necessary I need to mapp the file name to the element in target message.
I mean: When I have got the RFC structure imprted from ERP and there I have got the element "filename". I would like to put the file name of file which I mapping to this element. Next put the all file contents with file name to the ERP table.
It is possible to do that??
I found in sap help that I can keep file name in the message header to get the same target file name, but I wont to put file contents (with file name) to the ERP table not to another file.
THX for all your opinions.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The DynamicConfiguration fin inbound message:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
- <!-- Inbound Message
-->
- <SAP:DynamicConfiguration xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="1">
<SAP:Record namespace="http://sap.com/xi/XI/System/File" name="Directory">/usr/sap/PXD/put/archive</SAP:Record>
<SAP:Record namespace="http://sap.com/xi/XI/System/File" name="FileEncoding">ISO646-US</SAP:Record>
<SAP:Record namespace="http://sap.com/xi/XI/System/File" name="SourceFileTimestamp">20061212T121622Z</SAP:Record>
<SAP:Record namespace="http://sap.com/xi/XI/System/File" name="FileType">txt</SAP:Record>
<SAP:Record namespace="http://sap.com/xi/XI/System/File" name="FileName">200610.TXT</SAP:Record>
<SAP:Record namespace="http://sap.com/xi/XI/System/File" name="SourceFileSize">124</SAP:Record>
</SAP:DynamicConfiguration>
and for Response:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
- <!-- Response
-->
- <SAP:DynamicConfiguration xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="1">
<SAP:Record namespace="http://sap.com/xi/XI/System/File" name="SourceFileSize">124</SAP:Record>
<SAP:Record namespace="http://sap.com/xi/XI/System/File" name="FileType">txt</SAP:Record>
<SAP:Record namespace="http://sap.com/xi/XI/System/File" name="SourceFileTimestamp">20061212T121622Z</SAP:Record>
<SAP:Record namespace="http://sap.com/xi/XI/System/File" name="FileEncoding">ISO646-US</SAP:Record>
<SAP:Record namespace="http://sap.com/xi/XI/System/File" name="FileName">200610.TXT</SAP:Record>
<SAP:Record namespace="http://sap.com/xi/XI/System/File" name="Directory">/usr/sap/PXD/put/archive</SAP:Record>
</SAP:DynamicConfiguration>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
The SOAP haeader contains the filename as needed. So, I guess the problem has to be with the code.
Can you give us your UDF code here. Also add a trace to your UDF code to see if the UDF is actually called.
You can add a trace inside the UDF using the following line of code,
AbstractTrace trace= container.getTrace();
trace.addWarning("");
Now, whatever you give withing the trace.addWarning will be visible inside the TRACE in MONI under APPLICATION Trace.!
Regards,
Bhavesh
"Test it during the run time. Just make sure that in the Sender File Adapter --> Adapter Specific Identifiers --> FileName is selectd. It should work."
Yes It should but it doesn't. Adapter Specific Identifiers --> FileName is selected.
When I test the communication channel there is no error, but I still can not see the file name in the target message.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
ok. I just create User defined function "getfilename" and I put there:
"DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
String ourSourceFileName = conf.get(key);
return ourSourceFileName; ".
But In test mapping I have worning:
"Runtime exception during processing target field mapping /ns1:Z_KBFI_INPUT_FILE/IS_IFILE/FILE_NAME. The message is: Exception:[java.lang.NullPointerException] in class com.sap.xi.tf._KBFIMsgMapping_ method get_fname$[com.sap.aii.mappingtool.tf3.rt.Context@37d4662c] com.sap.aii.mappingtool.tf3.MessageMappingException: Runtime exception during processing target field mapping /ns1:Z_KBFI_INPUT_FILE/IS_IFILE/FILE_NAME. The message is: Exception:[java.lang.NullPointerException] in class com.sap.xi.tf._KBFIMsgMapping_ method get_fname$[com.sap.aii.mappingtool.tf3.rt.Context@37d4662c] at com.sap.aii.mappingtool.tf3.AMappingProgram.processNode(AMappingProgram.java:284) at com.sap.aii.mappingtool.tf3.AMappingProgram.processNode(AMappingProgram.java:238)...."
And in RWB in Communication Channel Monitoring I can not see file name in the payload.
Maby I do something wrong, please tell me.
Message was edited by:
Grzegorz Stankiewicz
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
You cannot test this using the test tab of the message mapping as the filename does not exist and is populated in the runtime.
Test it during the run time. Just make sure that in the Sender File Adapter --> Adapter Specific Identifiers --> FileName is selectd. It should work.
Regards,
Bhavesh
"In your message mapping you can access this header information using following code
DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
String ourSourceFileName = conf.get(key);
return ourSourceFileName; "
OK. but where exactly in message mapping I have to put this code. I don't know?
And how then make the dependencie to correct element in my target message?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi You have two questions here:
1) how to get the filename :
<i>DynamicConfiguration conf = (DynamicConfiguration) container
.getTransformationParameters()
.get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create(
http://sap.com/xi/XI/System/File,
FileName);
String valueOld = conf.get(key);
return valueOld;</i>
2) How to populate SAP table:
if your standard RFC does not take care you have to write a custom RFC that will accept the filename as well and populate the table you desire...
Cheers,
Himadri
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
You have to check the 'Adapter specific Message Attribute' in the sender file adapter .
In your message mapping you can access this header information using following code
DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
String ourSourceFileName = conf.get(key);
return ourSourceFileName;
Regards
Vijaya
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
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.