How to ignore a recordset in receiver file adapter
Hi, all.
I am trying to get PI to write a fixed length file via the reciever file adapter. Here is a test data structure I put together:
In the output file, I want the file adapter to ignore the recordset PAYPERIOD and field PERIOD. Only fields in DATA will be written to the file. Here is what I configure in the CC:
The problem is that the CC will not work unless I put in the recordset PAYPERIOD which starts printing the data in the PERIOD field. The data in PERIOD is only used to generate the output file name as a perameter.
Here is the error:
Attempt to process file failed with java.lang.Exception: Exception in XML Parser (format problem?):'java.lang.Exception: Message processing failed in XML parser: 'java.lang.Exception: Column value 'Y1406' too long (>4 for 0. column) - must stop', probably configuration error in file adapter (XML parser error)'
Please help. Note that Y1406 is the data in the field PERIOD. The PI file adapter is a rather primitive tool to use.
Thanks,
Jonathan.
Hi Jonathan,
can you try using the paramter ignoreRecordsetName = TRUE. refer the below sap help
https://help.sap.com/saphelp_nw04/helpdata/en/2c/181077dd7d6b4ea6a8029b20bf7e55/content.htm
ignoreRecordsetName
A
<Recordset> element is inserted in the XML structure for each recordset
structure. This level is not always required, particularly if the recordset only
contains one structure definition.
If you set the
parameter to true, the <Recordset> element is not
inserted.
regards,
Harish
Similar Messages
-
How to ignore some fields on Receiver File?
Hi folks,
I have this inbound structure example:
<?xml version="1.0" encoding="UTF-8"?>
<ns0:MT_ObrasAdjud_Out xmlns:ns0="http://pt.edp/r3/obrasadjudicadas">
<codforn>123543</codforn>
<numdoc>000003</numdoc>
<tipodoc>CAO</tipodoc>
<encoding_scheme>UTF-8</encoding_scheme>
<filetype>pdf</filetype>
<filedata>01010101001001</filedata>
</ns0:MT_ObrasAdjud_Out>
Using File Conversion with my Receiver File Adapter I want to convert this xml file to a flat file, but only using the element <b><filedata></b> and ignore the others. However, I also need the others elements to use as variable substitution.
Anybody knows how to do it?
Thanks in Advance,
Ricardo.Hi Ricardo,
>>>>Using adapter specific attributes I can use the elements of source message to do it?
or course!!! that's the idea and you do it all in message mapping
(very small advanced function as shown in many blogs)
>>>>But using variable substitution, I cant ignore those fields with file conversion?
don't know I stopped working with variable substitution
as soon as I learned about adapter specific attributes
as they are sooo much better
>>>>I can do a map excluding all the others elements for target message, my target message will be one element <filedata>.
that's the main idea
Regards,
michal -
Receiver file adapter command line
hi,
i am just wondering how to use command line on receiver file adapter.
i am not clear how to use this.
please modify on the following command!
anyway, i have to call java application after put some files by receiver file adapter.
cmd.exe %Fjava ./javacalltest
it did not work..
please guide me.
Command Line
An operating system command specified here is executed before or after a file has been successfully processed. The default value is an empty character string (no command).
When the operating system command is called, the file name currently being processed can be specified with the following placeholders:
%f (file name)
%F (absolute file name including path)Hi Ogawa and Laurence,
Have look at :: /people/michal.krawczyk2/blog/2007/02/08/xipi-command-line-sample-functions
1)Windows batch Commands::
http://labmice.techtarget.com/articles/batchcmds.htm
2)Linux:
/people/michal.krawczyk2/blog/2005/08/17/xi-operation-system-command--error-catching
Note:: First try using the comands on O.S if they work then only use them in Adapters.
Hope it will help.
regards
Piyush
Pl:reward some points if it is usefull. -
Append in Receiver File Adapter
Hi All,
i want to append data into the same file in the receiver file Adapter.
<b>for Example ..</b>I have given XYX a file name in the target directory ..for the first execration it puts the data in to the file..
for the Next execution its not appending data to that file..
<b>the Requirement is</b>
for the first time XYX has data 1234
for the next time XYZ need to add
1234 and below this the next data must come
2345 like this
how can i archive this in receiver file adapter,?
thanks
shakifhello,
if you put that question into the correct forum (i.e. XI) you'll probably get an answer within minutes.
kind regards, anton -
How to create an Excel file from XML in the Receiver File Adapter Comm Ch
How do I create an Excel file from XML in the Receiver File Adapter Communication Channel? I have my mapping done and I am outputting the file as a comma delimited csv file. However, the target can only process an Excel file (.xls). How can I generate an Excel in XI?
I saw this blog, but I don't know how to create a XSLT transformation.
/people/michal.krawczyk2/blog/2005/12/10/xi-generating-excel-files-without-the-java-nor-the-conversion-agent-not-possible
Any help would be appreciated. Thanks.Here are the steps I took to create an XSLT transformation in XI 3.0:
1. I created my source and target XSDs using XMLSpy.
2. I created the XSLT mapping from source to target in XMLSpy (referencing the souce XSD schema).
3. I created another XSLT mapping to format the target into Excel XML.
4. Import the source and target XSDs in the IR's External Definitions
5. Zip each XSLT mapping (.xls) and import it into the IR's Imported Archives
6. Reference the XSL mappings in the Interface Mapping -
How to create multiple files with Receiver File Adapter in SAP PI 7.31 Java Stack
Dear Friends,
I am using Sender JDBC Adapter and Receiver File Adapter in Integration Flow in SAP PI 7.3 EHP 1 SP08 Java Stack environment. The requirement is that we need to create multiple files based on the row count in jdbc resultset. If there are 5 rows in resultset, we need to create 5 XML files with one row elements in one file. Similarly if there are 10 rows, we need to create 10 XML files.
So how can we create multiple files in this scenario. I tried placing a for loop in the Java Mapping as below in the transform method:
DynamicConfiguration conf = arg0.getDynamicConfiguration();
StringBuffer sbFileData = new StringBuffer();
for (int i =0; i < record.size(); i++ {
. // Create XML for each row and Marshal the object into to the String Buffer
String strFileName = "DC_" + new SimpleDateFormat("ddMMyyyyHHmm").format(new java.util.Date())+"_"+i+".xml";
conf.put(KEY_FILENAME, strFileName);
arg1.getOutputPayload().getOutputStream().write(sbFileData.toString().getBytes("UTF-8"));
arg1.getOutputPayload().getOutputStream().flush();
So here I'm flushing the OutputStream for each record. But it's not creating the multiple file, instead it creates only one file will all record XMLs appended to each other.
Please let me know if I missing something or need to do some thing else.
Regards,
Shreyansh ShahHi
You can easily achieve this using graphical mapping. Create your target message type like below
MT_Target
Details 0 to 1
Data 0 to 1
Source sample structure
<resultset>
<row>
<column-name>column-value</ column-name>
</row>
Then do the message mapping like below
map <row> with MT_Target
contant ----> Deatils
column-name ------>Data
In the signature tab of message mapping, choose the occurrence of your target message type as
0 to unbounded.
This will generate multiple files from multiple rows.
Let me know if you have any doubt. -
How to generate file name dynamically in receiver FIle adapter? Please help
Dear Experts,
I have a scenario where I need to generate output file with the name dynamically pulled from the XI payload.
In receiver File communication channel I don't see any option where we can specify the XML path for the file name.
For example:
If my inbound XML structure (inbound interface) is like below:
<filename>file123.txt</filename>
<RootNode>
<Element1>Product123</Element1>
<RootNode>
From this I need to pick the filename value and generate the output file with the same value.
How can I achieve this? Please help!
Thanks & Regards
Gopal
Edited by: gopalkrishna baliga on May 3, 2011 1:10 PMGopal,
You can use DynamicConfiguration class for this.
You need to write UDF for this and with input of filename you want to set and map this UDF to the top level node.
Refer the below famous blog from Micheal:
/people/michal.krawczyk2/blog/2005/11/10/xi-the-same-filename-from-a-sender-to-a-receiver-file-adapter--sp14
You can also use Variable substitution to get value from payload, search SDN on this.
--Divyesh Vasani -
How to give field name to Receiver File Name.
Hi ,
In my source target structure there is a field name
"job id" .
I need that value coming in that field name to be given to
Receiver File Name.
Thanks in AdvanceHi,
You could use the field name to the File Name. For that you could go ahead with variable substituiton in receiver communication channel.
In receiver Communication channel use variable substitution as
In file name -- %Var1%
In Variable substitution parameter give Var1 ---> payload:<field Name>
Refer
SAP Network Blog: An interesting usage of Variable Substitution in XI
/people/sameer.shadab/blog/2005/09/23/an-interesting-usage-of-variable-substitution-in-xi
variable substitution
http://help.sap.com/saphelp_nw2004s/helpdata/en/8e/464442c1a1c253e10000000a1550b0/content.htm
Also see the below links to use the dynamic variable substitution
/people/michal.krawczyk2/blog/2005/03/29/xi-error--unable-to-convert-the-sender-service-to-an-ale-logical-system
/people/michal.krawczyk2/blog/2005/11/10/xi-the-same-filename-from-a-sender-to-a-receiver-file-adapter--sp14
Also
/people/jayakrishnan.nair/blog/2005/06/20/dynamic-file-name-using-xi-30-sp12-part--i - Dynamic File Name Part 1
/people/jayakrishnan.nair/blog/2005/06/28/dynamic-file-namexslt-mapping-with-java-enhancement-using-xi-30-sp12-part-ii - Dynamic File Name Part 2
Thanks
swarup -
Receiver file adapter creates empty files, Empty-Message Handling SP19
Hello,
We have just upgraded the system to SP19.
One of the new features is that it should be possible to determine how XI messages with an empty main payload are to be handled in the receiver file adapter.
If the parameter Empty-Message Handling is set to 'Ignore' no file should be created if the main payload is empty. In our case an empty file (size 0 kb) is still created even though the main payload is empty and the flag is set to 'Ignore'.
Has anybody experienced the same problem?
// Best regards HansThis should work:
Use your own adapter module that parses incoming message and checks if it has any record sets in the document. If it does not have any record sets, then set the message to empty and then give this modified message to File receiver.
For example, see the example code below:
Module imports..
Audit log import..
DOM imports/SAX imports..
public ModuleData process(ModuleContext moduleContext, ModuleData inputModuleData) throws ModuleException {
try {
// get the XI message from the environment
Message msg = (Message) inputModuleData.getPrincipalData();
AuditMessageKey amk = new AuditMessageKey(msg.getMessageId(),AuditDirection.INBOUND);
Audit.addAuditLogEntry(amk, AuditLogStatus.SUCCESS,"RemoveRootTag: Module called");
XMLPayload payLoad = msg.getDocument();
Document doc = parseXmlFile(payLoad.getInputStream());
if(doc != null){
if(!doc.getDocumentElement().hasChildNodes()){
Audit.addAuditLogEntry(amk, AuditLogStatus.SUCCESS, "Document is empty!!");
payLoad.setContent("".getBytes());
msg.setDocument(payLoad);
// provide the XI message for returning
inputModuleData.setPrincipalData(msg);
} catch (Exception e) {
// raise exception, when an error occurred
ModuleException me = new ModuleException(e);
throw me;
// return XI message
return inputModuleData;
private Document parseXmlFile(InputStream xmlpayload) {
try {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setValidating(false);
// Create the builder and parse the file
Document doc = factory.newDocumentBuilder().parse(xmlpayload);
return doc;
} catch (SAXException e) {
} catch (ParserConfigurationException e) {
} catch(IOException e){
return null; -
Tab delimitter in HeaderLine in FCC in receiver file adapter
Hi Folks,
I want to use tab as a field separator for (eg) NameA.Headerline.
instead of comma in file content conversion in receiver File adapter communication channel.
example:
Recordset structure : NameA
NameA.addHeaderLine : 3
NameA:headerLine : MaterialID,Price,Quantity
PS: In NameA.headerline i want to use tab instead of comma.
How can i do that?
Thanks
PrabaharanHi Beena,
could you explain on which context we should use that option:
NameA.addHeaderLine - 1 ( Header line with column names from the XML document )
what it does exactly?
Thanks
Prabaharan
Edited by: Prabaharan on Aug 21, 2008 12:02 AM -
Blank line in receiver file adapter content conversion
Hi,
I am using a receiver file adapter. Everything is working fine. Except that a blank line is put by the file adapter between each records. It is a flat file format.
I have used the stting below. How do we remove the blank line?
Recordset : ACCTHDR,BATCHDR,TRANSREC,BATCHTLR,FILETLR
ACCTHDR.fieldFixedLengths 1,7,4,9,8,665
ACCTHDR.absoluteRowWidth 694
ACCTHDR.addHeaderLine 0
Thanks
Sachin KHi,
.endSeparator
The default value is a line break (no explicit separator after the last column; instead the structures are arranged line-by-line).
If you enter a character string here, the system adds it to the last column as a closing character. You can also make this specification in addition to NameA.fieldFixedLengths. To include a line break following the closing character, you must explicitly define it by attaching ´nl´ (including the quotation marks) to the string.
Regards
Agasthuri Doss -
Receiver File Adapter - Tab delimited Text file
I am using receiver file adapter to convert message created by ABAP PROXY to convert tab delimited text file format.
XML message is in following format.
- <DT_R3_ROLES_OUTBOUND_REC>
<LIST_CATEGORY>SAP_HR</LIST_CATEGORY>
<USRID>MRUDULAP</USRID>
<EMAIL>[email protected]</EMAIL>
<NAME>MRUDULA PATEL</NAME>
</DT_R3_ROLES_OUTBOUND_REC>
- <DT_R3_ROLES_OUTBOUND_REC>
<LIST_CATEGORY>SAP_HR</LIST_CATEGORY>
<USRID>HCHD</USRID>
<EMAIL>[email protected]</EMAIL>
<NAME>H CHD</NAME>
</DT_R3_ROLES_OUTBOUND_REC>
I have used file content conversion in the adapter configuration.
Recordset structure = DT_LISTSERV_INBOUND_REC
DT_LISTSERV_INBOUND_REC.addHeaderLine = 0
DT_LISTSERV_INBOUND_REC.fieldSeparator = ','
How to use Tab as the delimiter in the fieldSeparator field?
Now the output in the file is as follows :
[email protected]'MRUDULA PATEL
[email protected]'H CHD
What I need to do to make the file as the tab delimited file?
Thanks in advance!
Mrudula PatelHi Mruddula,
Use fieldSeparator: '0x09' for horizontal tab
<b>DT_LISTSERV_INBOUND_REC.fieldSeparator: '0x09'</b>
Naveen -
Process different structure in receiver file adapter
Hi, all XI&PI masters
We have a trouble of processing a file in receiver file adapter, converting to tab deliminated file.
Scenario: Proxy to File
We've configured PI to process following data and we've got flat file successfully.
<ns1:MT_test_s xmlns:ns="http://...">
<recordset>
<data>
<value1>test1</value1>
<value1>test2</value1>
</data>
</recordset>
<info>
<value1>test0</value1>
</info>
<ns1:MT_test_s>
We also want to process a data without <data> structure below.
So we've already set occurence of recordset and zsdata to 0..unbound.
However, we are getting an error from receiver file adapter, since there is the recordset structure.
(No problem if recordset is not included...)
<ns1:MT_test_s xmlns:ns="http://...">
<recordset/>
<info>
<value1>test0</value1>
</info>
<ns1:MT_test_s>
Please help me if anyone know how to solve this problem.
Thank youcreate your target data type without the recordset node.
Then do the mapping from source to target and configure your scenario.
This is the ideal solution
/people/shabarish.vijayakumar/blog/2007/08/03/file-adapter-receiver--are-we-really-sure-about-the-concepts -
Output CSV File Naming Convention - Receiver File Adapter
Dear SAP experts,
I need help regarding my scenario.
My scenario is this, Customer will send EDI message to XI. XI will then translate the message and convert it into XML.. After, a Receiver File Adapter will receive the XML then convert it into .csv file.
I've already configured the Receiver File Adapter to convert the XML into .csv file.
But, my problem now is how will I configure to have my output .csv file has a File Naming Convention.
The output .csv file must be "CustomerName_YearMonthDate".
From the EDI message, there is indicated Sender GLN in which, each customer has its own Sender GLN.
E.g., Globus --> 200, Karstadt --> 300, Metro --> 400.
How will I configure so that I can have an output .csv file of,
If Globus sends the EDI message, the output .csv file is Globus_20080304.csv.
If Karstadt, Karstadt_20080304.csv.
If Metro, Metro_20080304.csv.
Kindly advise for a clear and complete solution.
Thank you very much for your usual support.
FredHi Nisar,
My target message (XML) in the mapping is this,
- <ns0:CSV>
- <SLI>
<PERIO> </PERIO>
<ILN> </ILN?
<EAN> </EAN>
perio, iln, and ean was rooted on SLI field. and the CSV is the rootnode of the target message.
I have created a UDF on the message mapping to accomodate the output customer name, here is the codes:
String fname="";
if(GLN.equals("23456"))
fname ="Globus" +dat;
else if(GLN.equals("5678"))
fname ="Karstadt"+dat;
else if(GLN.equals("6789"))
fname ="Metro"+dat;
DynamicConfiguration conf = (DynamicConfiguration) container
.getTransformationParameters()
.get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create(
"http://sap.com/xi/XI/System/File",
"FileName");
conf.put(key,fname );
E.g.,
Globus --> 23456 (Sender GLN)
Karstadt --> 5678 (Sender GLN)
Metro --> 6789 (Sender GLN)
This UDF i've made in the Message Mapping was mapped in the root node CSV.
Is this UDF correct?
Then on the File Receiver Configurations, here are the configs,
Transport Protocol: File System (NFS)
Message Protocol: File Content Conversion
Adapter Engine: Integration Server
File Access Parameters
Target Directory: /var/opt/gsss/sample/csv
File Name Scheme: .csv
Processing Parameters
File Construction Mode: Create
- Overwrite Existing File
Write Mode: Directly
File Type: Text
Variable Substitution --> ???
Adapter Specific Message Attributes
- Use Adapter-Specific Message Attributes
- Fail if Adapter-Specific Message Attributes Missing
- File Name
Run Operating System Command After Message Processing
Command Line: chmod 664%F
Content Conversion Parameters
Recordset Structure: SLI
SLI.addHeaderLine: 3
SLI.headerLine: PERIO;ILN;EAN
SLI.fieldSeparator: ;
SLI.endSeparator: 'nl'
Adapter Status:
Status: Active
Kindly advise if my configs are correct.
Thank you very much!
Fred -
Receiver file adapter settings
Hi,
I have a scenario in which I need to generate a file in tab delimited format. But in the receiver file adapter configuration we have only text/binary file creation mode. By setting the File Type in TEXT mode will I be able to do a tab de-limited file?? Or is there any other configuration settings need to be done?
-KenHi Amanda,
Thank you so much for the great info. I think I can find some stuff but still it would be helpful if you could forward the doc to [email protected] Also, yeah it looks like the receiving file format would be complex with header and footer. In the content conversion can we specify header and footer?? or is there any other way to define...FYI my source file also contains header and footer..I am just a little confused on how to set up the message types for mapping...
Many thanks..
-ken
Maybe you are looking for
-
Agent Desktop logging out frequently !!
User is reporting that they periodically get logged out from the agent desktop application every 30 minutes. This happens frequently. A message appears on our desktop(cisco agent desktop application) in a grey box saying the time and connection lost
-
InDesign reverting back to basic colour scheme after crash
I am new at this software, how do I get my orignal colours on my design back - also the printers come up with different colours
-
I have been using Firefox for a long time with no problem! Then my provider Comcast went from Smartzone to XfinityConnect and now I can not open my E-mails and the people for Comcast say they don't know why?
-
Is there a limit to how many devices I can use with wifi / fibre?
We are a large household and might have 8 people connecting laptop/TV/phone to wifi / fibre at any one time. Is there a limit / recommended maximums and is it wifi/router or the internet itself that is the controlling factor?Any advice much appreciat
-
Select single to RSEG with very low performance
Hello experts, We have recently upgraded our sap basis from 701 to 740 and we are experiencing a very low performance with the following abap instruction: select single * from rseg into lw_rseg where ebeln = lw_output-pedido and