Receive zipfile with sender file adapter
Hello,
I need to receive one zipped file (binary data) with the file sender adapter. This zipped file contains an xml file that I need to process.
What is the best way to do this?
I have looked into writing an adapter module to unzip or base64 encode the file before sending it further into xi from the module chain.
However, it looks like only xmlpayload is available to the adapter modules (and attachments, but in this case there are none). In the module I have the following relevant code (lots of try catch surrrounding)
Object obj = null;
Message msg = null;
obj = inputModuleData.getPrincipalData();
msg = (Message) obj;
XMLPayload xmlpayload = msg.getDocument();
I end up with an xml payload, that is the zip file in my case.
Is it safe to do something like this
InputStream is = xmlpayload.getInputStream();
// zip data into string
String str = is.toString();
// base64 encode
str = MimeUtility.encodeText(str,"base64");
xmlpayload.setContent(str.getBytes());
// send the base64 encoded data to XI
// that is now at least utf-8 text
return inputModuleData;
What do you recommend?
Best regards
/Otto
Otto,
Go through this links which may help you:
Multi Attachments with ZIP or Mail Adapter (Outbound)
Re: How to read ZIP files(having PDFs,Image) using IDoc without XI
---Satish
Similar Messages
-
Is there any way to send Attachements with Sender file adapter
Hi,
I am Using File to Proxy communication model. Is there any way I can use file attachments with Sender file adapter with communication protocol "FTP". Please on suggest this.
Regards,
Daniel.LAHi,
I think there is no Option with FTP Protocol to send the files as Attachments.
Try this
http://help.sap.com/saphelp_nw04/helpdata/en/e3/94007075cae04f930cc4c034e411e1/frameset.htm
Regards
Seshagiri -
System error when send file with Sender File Adapter
Hi all,
I have configured a "File To ABAP Proxy" scenario. After configuring, i executed a "Test Configuration" in Integration Directory and it's all OK. But this file unable to reach into ABAP Proxy Target. In the Runtime WorkBench\Message Monitoring, I get an error message in below:
Engine: Adapter Engine
Status: *System Error *
Start: 15.08.2008 14:04:01
End: 15.08.2008 14:19:01
Sender Service: BS_XI_SERVER
Interface Servic: urn://FILE_TO_PROXY
MI_EMPLOYEE_OB
In this case, I don't know why my Sender File Adapter is error and why status is "System Error" and why it can't reach into Target System. Can it concern a role user?
( For more clearly: I configured the source file and the path correctly. And i used the xml file with the content and the document name correctly. In general, the Sender Adapter File don't convert the sender file and its content is same as the Payload in the "Test Configuration", i think it is all OK.)
Could anyone please help me to resolve this problem, anyone can explain this error, how can i resolve this error?
Thanks a lot in advance,
Vinh VoHi Chirag,
1.I source structure is very simple as below:
<ns0:MT_MATERIAL xmlns:ns0="urn://FILE_TO_PROXY">
<MATERIAL>
<WERKS>1000</WERKS>
<MATNR>MAT00001</MATNR>
<MAKTX>Chemical Material</MAKTX>
</MATERIAL>
</ns0:MT_MATERIAL>
2. the Communication Channel Monitoring in Runtim WorkBench\Adapter Engine is OK for my Sender File Communication Channel, it's in Blue Light.
However, i don't know what's FCC?
Thanks and best regards,
Vinh Vo -
Issue with Sender File Adapter
Hi,
In Sender File Adapter I have used content convertion. If the content convetion fails or the channel goes to error state, the sender file channel stops polling. The channel is not polling in the next interval once it goes to error state.
Please help.
Thanks
AravindHi,
That's true.
If one file fails to process due error in content coversion or for any other reason, the channel would stop polling for the next time and also would not process the files following it.
Please correct the content conversion and process the file.
Regards,
Subbu -
How to read files with codepage UTF16LE with "Sender File Adapter"
Hi everybody,
I am using a XI-Filesender-Adapter to get a (UTF-16LE encoded) file und process it in XI-Mapping.
This is my File-Content:
Cost Centre,Cost Code,Page Count (B&W),Page Count (Colour),Job Count
Unknown,Lexmark,"37,480",334,"11,968"
Unknown,Unknown,312,0,177
110000,Lexmark,128,228,43
The HEX-representation of this content is:
FF FE 43 00 6F 00 73 00 74 00 20 00 43 00 65 00
(The starting 2 Bytes FF FE represent UTF16-LE )
And this is the payload I get for mapping:
<?xml version="1.0" encoding="utf-8" ?>
<ns:MT_POM_KOSTEN xmlns:ns="http://aua.com/pom">
<POM_REC>
<COSTCENTER>uFEFFCost Centre</COSTCENTER>
<COSTCODE>Cost Code</COSTCODE>
<PAGECOUNT_BW>Page Count (B&W)</PAGECOUNT_BW>
<PAGECOUNT_COL>Page Count (Colour)</PAGECOUNT_COL>
<JOBCOUNT>Job Count</JOBCOUNT>
</POM_REC>
<POM_REC>
<COSTCENTER>Unknown</COSTCENTER>
<COSTCODE>Lexmark</COSTCODE>
<PAGECOUNT_BW>37,480</PAGECOUNT_BW>
<PAGECOUNT_COL>334</PAGECOUNT_COL>
<JOBCOUNT>11,968</JOBCOUNT>
</POM_REC>
<POM_REC>
<COSTCENTER>Unknown</COSTCENTER>
<COSTCODE>Unknown</COSTCODE>
<PAGECOUNT_BW>312</PAGECOUNT_BW>
<PAGECOUNT_COL>0</PAGECOUNT_COL>
<JOBCOUNT>177</JOBCOUNT>
</POM_REC>
<POM_REC>
<COSTCENTER>110000</COSTCENTER>
<COSTCODE>Lexmark</COSTCODE>
<PAGECOUNT_BW>128</PAGECOUNT_BW>
<PAGECOUNT_COL>228</PAGECOUNT_COL>
<JOBCOUNT>43</JOBCOUNT>
<POM_REC>
I can see the correct strings (for example Cost Centre) in payload, but the string-comparison in the user defines function cannot recognize the equality of the strings:
for (int i =0; i < a.length; i++) {
if (
(a<i>.equals("Cost Centre")) )
result.addSuppress();
else
result.addValue("");
Actually I am using UTF-8 as codepage in Fileadapter (and Text as type)
When I try to use UTF16 (or UTF-16LE) as Codepage, I am getting unreadable characters.
I also tried binary, UTF16-BE,...
The only way is to covert the file to ANSI before I use it with XI. Then my function does work correctly.
Does anybody have an idea, how I can read a UTF16-LE File and process it correctly in XI?
I am using XI 7.00 0023 and JSDK 1.4.2-34
Thanks a lot
ArminHello Armin,
I have gone through some SAP notes and blogs to find solution to your problem, here is what I found
1. SAP NOTE 821267
q) How do I correctly configure the File Encoding used by the File
Adapter?
Flat Files with File Content Conversion
For a File Sender channel, configure the encoding of the source
file. The file will be interpreted according to the configured
encoding and converted to XML with an UTF-8 encoding.
For a File Receiver channel, configure the encoding to match
the encoding you would like to be written to the target flat
file.
- Flat Files without File Content Conversion
Whether to configure an encoding in this case depends on if you
want to pass through the file "as is", e.g. within a File
Sender to File Receiver scenario, or if you want to convert the
file's encoding on its way through the Integration Server. For
"as is" processing, configure both the sender and the receiver
using the File Type setting "Binary".
To apply an encoding conversion, configure the respective
source and target encoding in both the sender and receiver
channel.
Important: Configuring an encoding in the receiver channel
will only lead to the expected results if the payload sent to
the receiver channel is in UTF-8 format (e.g., by having
specified an encoding conversion in the Sender channel).
So as per this note if you configure the encoding scheme of sender communication channel to UTF-16LE, adapter should be able to convert it to UTF-8 by default. But you have posted that this encoding scheme is leading to unreadable charcters
2) SAP note 880173
This speaks of use of module XMLAnonymizerBean which can be applied to XML payload to change its encoding.
3) How to guide on encoding : http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/502991a2-45d9-2910-d99f-8aba5d79fb42?QuickLink=index&overridelayout=true
4) SAP note:960663
http://help.sap.com/saphelp_nw04/helpdata/en/45/da2deb47812e98e10000000a155369/content.htm
TextCodePageConversion Bean details which might solve your problem.
5) Finally if nothing above works you need a java mapping code to convert to target XML structure without any File content conversion. The mapping will convert the received file to proper target XML in "UTF-8" encoding. Please let us know if you need help on the code with this final option.
Regards
Anupam -
Problem with sender file adapter
Hi all,
I am having a problem in reading file with complex structure,
my structure is like this:
Header - 1
rows - 0 - unbound
Footer 1
In the recordset Structure - Header,1, Row,*, Footer,1
The file is not being read, only if I cahnge the * to the exact number of roes type ROw it is working,
Thnaks,
Naama.Hi,
I tried it on a simple file and it works,
But for some reason it doesnt work on my file, I think it because the structure of the segments.
the first line is the header and its key value is H u2013 it should appear once in the file
the second line is the header2 and its key value is D u2013 it should appear once in the file
the 3+4 lines is the details and its key value is L u2013 it should appear * times
the last line is the footer and its key value is D u2013 it should appear once in the file
Header1.
T H T150380149462.DAT 30/07/08 13:05:04 7 014946/2i`cpei driaz
Header2.
T D D06AA038H08052587014946245-519-60 045000WKMHDN41BP6U122056 0807230807236915 1000000 000000000000000000H,28910,22040 2828910R0000000200000000000000004830800100000001P
Details.
T D D06AA038_L_08052587014946210128910R00010020002000
T D D06AA038_L_08052587014946210128910R00010020002000
Footer.
T T T150380149462.DAT 00008 014946/2*** seq ****
I think that because the beginning of header2 and detail is the same it does not work,
Any Ideas? -
Issue with Sender File Adapter file content convertion
Hi Everybody,
I am facing an issue in FCC at the sender side.
Below is sender text message which contains 9 rows.Each row represents one node in the source structure.
ROUASIS.MLASIS.A02001COMASN1.1.2
HDR7072396166N^MAEU/SZH3PA288200707248IF07082007090311CAFXSYATFXS^20070903
PPL5705150010506YAT254915402713586045162543971730000002723.000C2750000000024.1602007081120070903^^
SIM3020070711^20070730Y^^^00
CONTTNU946652840CN0579566 7335
CTN100069350800012609166209.850.08068.5830.4838.10
DTL520^01
CTN200069350800012609173209.850.08068.5830.4838.10
DTL520^01
In the above message CTN row is repeating after each DTL because of which i am getting the error.
<b>Conversion of file content to XML failed at position 0: java.lang.Exception: ERROR consistency check in recordset structure validation</b>
Can somebody help me out in resolving this issue.
Thanks in Advance,
ArvindHi Arvind
plas use the following parametes in the sender communication channel.
i have tried one scenario
my source structure is like that:
data (0..unbounded)
record (0..unbounded)
key (1..1)
fname (1..1)
lname (1..1)
age (1..1)
detail (0..unbounded)
key (1..1)
salary (1..1)
empid (1..1)
so use the following parameters at the sender side
document name: messge type name
document namespace: ur message type namespace
Recordset name: data(as per according to my source structure)
RecordsetStructure: record,,detail,
recordsetsequence: variable
recordsetpermessage: *
keyfieldname: key
and different parameters:
RECORD.fieldSeparator ,
RECORD.fieldNames KEY,FNAME,LNAME,AGE
RECORD.keyFieldValue 1
DETAIL.fieldSeparator ,
DETAIL.fieldNames KEY,SALARY,EMPID
DETAIL.fieldNames 2
if you still have the problem pleas reply back.
Thanks
Rinku -
Sender File Adapter always "Polling interval started" without complete
Hi,
I have problem with sender file adapter suddenlty the status from Communication Channel Log monitoring always with polling started without completed.
4/25/11 11:40:33 AM Polling interval started. Length: 10.0 seconds
4/25/11 11:40:23 AM Polling interval started. Length: 10.0 seconds
4/25/11 11:40:13 AM Polling interval started. Length: 10.0 seconds
4/25/11 11:40:03 AM Polling interval started. Length: 10.0 seconds
Normal :
4/25/11 11:41:50 AM Polling interval started. Length: 10.0 seconds
4/25/11 11:41:50 AM Processing finished successfully
4/25/11 11:41:50 AM Processing started
4/25/11 11:41:40 AM Polling interval started. Length: 10.0 seconds
4/25/11 11:41:40 AM Processing finished successfully
4/25/11 11:41:40 AM Processing started
I have tried to stop and start the channel but still no luck. This problem only happen for this particular communication channel others channel is working fine.
Please advise other solution before i need to restart the java engine since this in the production environment. The problem is some of the process was delayed because this issue. CC was delayed to pickup the file.
Thank You in advance.
FLHi Abhistek,
Thank you for your correction. It was typo.
Which assumption is correct ?
1. All 3 instance running together in the same time ? or
2. Either 1 of the instance running once time manage by clustering setting.
Example :
15:01:00 ---> A
15:02:00 -
> A
15:03:00 -
> B
15:04:00 -
> B
Currently :
15:01:00 -
> A
15:01:00 -
> B (lock)
15:02:00 -
> A
15:02:00 -
> B (lock)
It seems all 3 instance lose control from clustering ?
Regards
FL -
Sender file adapter with content conversion Simple XML
Hi experts,
I'm trying to parametrize my sender file adapter content conversion.
I'm receiving a text file with one single line like:
AA1;AA2; AA3;
and I want to convert it to an XML like
<MT_A1>
<field1>AA1</field1>
<field2>AA2</field2>
<field3>AA3</field3>
</MT_A1>
Actually I know how to do somenthing like
<MT_A1>
<LINE>
<field1>AA1</field1>
<field2>AA2</field2>
<field3>AA3</field3>
<LINE>
</MT_A1>
What I want is remove the <LINE> tag from my XML.
Regards
Gonzalo
Edited by: Gonzalo del Castillo on Nov 28, 2008 2:18 PMHi
Use this help document for receiver FCC
http://help.sap.com/saphelp_nw04/helpdata/en/d2/bab440c97f3716e10000000a155106/content.htm
Content Conversion (Pattern/Random content in input file)
File conversion text to xml (Few Last Post) -
Archive file with errors in sender file adapter not working! please help!
Hi Experts,
I have a file to RFC scenario. the input is a XML file. I have setup the flag in sender file adapter channel for archiving the input files with errors. But it is not working.
For testing I have used an invalid xML file for example without the main XML tag. I have also tested with a MSWORD file saved with.xml extension. But in both the cases the files are not getting archived.
My archive location permissions are fine and in fact normal archive operation is happening. That is, if I select the processing mode as "Archive" and gave the Archive directory then files are getting archived. The problem is only with the "Archive faulty source files" option.
What am I missing? DO I need to do some more configurations?
What are the prerequisites if any for this option?
How to test this?
Please help me! I will be greatfull to you all!
Thanks & Regards
Gopaland go thru this links
Creating a Single Archive of the Version Files
http://help.sap.com/saphelp_nw04/helpdata/en/79/1e7aecc315004fb4966d1548447675/frameset.htm
http://help.sap.com/saphelp_nw04/helpdata/en/31/8aed3ea86d3d67e10000000a114084/frameset.htm
Note: reward points if solution found helpfull
Regards
Chandrakanth.k -
Problem in Sender File Adapter using FCC with Variable structure
Hi Experts,
Hi Experts,
I have facing an issues while using FCC in Sender File adapter. Below are the configs for the same:-
Recordset structure required is ==HEADER,1,DATA,*,TRAILER,1
Recordset per message == *
Key Field Name == Key
(Sorry i dont know how to insert screen shot here..pls tell me how can i insert screen shots here on sdn)
HEADER.fieldSeparator ,
HEADER.endSeparator u2018nlu2019
HEADER.fieldNames Key,x,y,zu2026
HEADER.keyFieldValue 1
HEADER.keyFieldInStructure ignore
HEADER.fieldContentFormatting trim
HEADER.additionalLastFields ignore
HEADER.missingLastFields ignore
DATA.fieldSeparator
DATA.endSeparator
DATA.fieldNames
DATA.keyFieldValue
DATA.keyFieldInStructure
DATA.fieldContentFormatting
DATA.additionalLastFields
DATA.missingLastFields
Using same variables for Trailer record as well.
Source CSV file which i am picking:-
ADSE ,RASD,replan Contact ,2 0080509 0 8:43:25 ,
EMPL ,0011111, S Top Up ,20080401 ,20080430 ,sdf , 00000000431250 ,2007 , , , , , ,20080414 18:07:35,
EMPL ,0222222, r Cash Award ,20070701 ,20070703 ,ded , 00000000023509 ,2007 , , , , , ,20080414 18:09:31,
EMPL ,0233333, Cash Award ,20070801 ,20070831 ,df , 00000000044057 ,2007 , , , , , ,20080414 18:10:56,
EMPL ,0244444, Cash Award ,20080101 ,20080111 ,sf , 00000000026717 ,2007 , , , , , ,20080414 18:08:29,
BTRL , 5140,
When i tested the scenario and monitored it using MDT in CC monitoring tool its giving me below mentioned error.
The XML page cannot be displayed
Cannot view XML input using style sheet. Please correct the error and then click the Refresh button, or try again later.
XML document must have a top level element. Error processing resource 'http://myurlname/mdt/me...
However if i change the occurence of DATA as some specific value for eg 4 instead of * it works fine.
Kindly help me in solving this problem.
Thanks,
Aditya VermaHi Madan,
Thanks a lot for giving me the way to this. But when i tested this with the below file its giving me the same error. Please let me know if i need to do any changes to the parameters mentioned above:-
ADSE ,ASDA,Sha replan Fr ont Feed Contact ,2 0080509 0 8:43:25 ,
EMPL ,0011111, Cash Top Up ,20080401 ,20080430 ,TPV , 00000000431250 ,2007 , , , , , ,20080414 18:07:35,
EMPL ,0222222, r Cash Award ,20070701 ,20070703 ,TPV , 00000000023509 ,2007 , , , , , ,20080414 18:09:31,
EMPL ,0233333, r Cash Award ,20070801 ,20070831 ,TPV , 00000000044057 ,2007 , , , , , ,20080414 18:10:56,
EMPL ,0244444, Cash Award ,20080101 ,20080111 ,TPV , 00000000026717 ,2007 , , , , , ,20080414 18:08:29,
EMPL ,0255555, Cash Award ,20080301 ,20080320 ,TPV , 00000000027870 ,2007 , , , , , ,20080414 18:08:25,
EMPL ,0266666, Cash Award ,20071001 ,20071020 ,TPV , 00000000020681 ,2007 , , , , , ,20080414 18:09:31,
EMPL ,0877777, Cash Top Up ,20080401 ,20080430 ,TPV , 00000000036000 ,2007 , , , , , ,20080414 18:07:05,
EMPL ,0888888, Leaver Cash Award ,20071201 ,20071231 ,TPV , 00000000157200 ,2007 , , , , , ,20080414 18:11:29,
EMPL ,0899999, S Leaver Cash Award ,20080301 ,20080331 ,TPV , 00000000153530 ,2007 , , , , , ,20080414 18:07:42,
EMPL ,0800000, S Leaver Cash Award ,20070701 ,20070731 ,TPV , 00000000012234 ,2007 , , , , , ,20080414 18:08:34,
BTRL , 5140,
This the original csv file which i'll get in live. Kindly suggest as ur solution worked with other file but not working with this scv file.
Thanks a lot,
Aditya. -
Vaildating File name with the data in the file using sender file adapter
Hi,
Below is the scenario
1) Pick up files from a FTP server, the file name is dynamic, how do I put dynamic name in sender file adapter?
2) Determine if the user correctly named the file based on data in the file.
a. File naming structure that we will be concerned with is <company_code><accounting_time_period>.<extension>
b. The company code and the time period in the file name have to match the data in the file.
i. For example. If the file name is 1001_200712.csv and the data in the file is for company code 1005, time period 200712, the file is incorrectly named. Both values must be correct.
How do we do this?Hi Sachin,
As Rightly said by Krishna, You can not put Dynamic name in sender File Adapter .You have to provide the name of the file like "*.txt" in Sender Adapter and at runtime you can access this file name by using following UDF:
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);
As now you have picked up the file name at runtime.
Now concatenate source file fields Company_code and Accounting_timeperiod using "_" as delimiter in properties.Also concat the extension .Now you have required file name.
So using EQUALS standard function ,compare it with File Name fetched at runtime using above given UDF, and pass result as you desire to process further or not or to raise Alert to resend the file.
Thanks & Regards,
Anurag Garg
You can validate this file name in Mapping itself. -
Sender File Adapter with file conversion
Hi guys,
Im using a Sender File adapter with file conversion. The message to be processed has a structure with fixed lengths and in your content are some values that needs to be ignored.
An example:
value1 <b>value2</b> value3
I want to ignore <b>value 2</b> but I cant find a parameter for that! Do I need to define dummy fields on my data type and ignore those fields during mapping? Or there is a specific parameter for that?
Thanks in advance,
Ricardo.hi,
there always is another way:)
you can import the whole line to one field
and cut it inside the adapter module
(then you can define start and stop of the substring that you need to use)
but of course it's not standard even though it's quite easy to achieve in java
Regards,
michal
<a href="/people/michal.krawczyk2/blog/2005/06/28/xipi-faq-frequently-asked-questions"><b>XI / PI FAQ - Frequently Asked Questions</b></a> -
Sender file Adapter, problem with proxy authentication
HI all,
i'm having some problems with the following scenario, i need to configure a sender file adapter which connects to a FTP server. To connect this FTP server i need to set a proxy (and so a username and a password), and i don't know how to do.
From note 821267 seems that the proxy is not supported for an FTP adapter, but the are some workaround like the ones described in the following link
Re: Proxy server inFTP adapter
http://wiki.sdn.sap.com/wiki/pages/viewpage.action?pageId=57137
They don't work in my case as i need to se two username (the one for proxy and the one for the ftp server) and i cannot force the proxy use for all XI applications.
Can anyone help me?
Thanks a lot
AldoProxy is necessary to exit the customer local intranet. It's not possible to go outside network without going through the proxy server.
I cannot set the proxy server in file adapter as it's not supported like described in SAp note, a possible workarounf is to force the proxy server in the J2ee stack but in this way all PI calls would use that proxy.. -
Sender file adapter Adapter with out Key field
Hi All
i do have have a requirment ,Sender file adapter , for FCC but file is with out Key field
HEADER>
<DATA1>
<DATA2>
<DATA3>
<HEADER> file structure
<ITEM>
<ITEM1>
<ITEM2>
<ITEM3>
<ITEM
and the file si
'10001,20081902,US
10,soda,1
30,soda,4
40,soda,5
10002,20081902,US
10,steel,1
30,steel,4
40,steel,5
, and i need to identify the Header and Item using there lenght only , please anyone as idea abt this help meWhy to post the same question TWICE... in 30 min ? you don't like the answers ?
File content Conversion Issuse for a Sender File Adapter
Maybe you are looking for
-
How to permanently stop Safari Webpage Preview Fetcher process?
Since the Safari Webpage Preview Fetcher process takes up to 10% of my CPU on occasion and and it uses bandwidth and it's just dumping loads of images into ~/Library/Caches/com.apple.safari/Webpage Previews is there a way to permanently stop this pro
-
A big shout out to Apple's Disk Utility
Anyone who has seen my last two threads on disk problems and Disk Warrior - here - http://discussions.apple.com/thread.jspa?threadID=2494488&tstart=0 and here- http://discussions.apple.com/thread.jspa?threadID=2497398&tstart=0 knows I'm becoming a bi
-
Missing rotated text in PDF created via FPDF
Hi guys, I have a weird problem which is preventing some rotated text to be viewed in adobe reader, while every other reader like foxit, google pdf viewer and scrib are doing just fine! if you create a flyer using following link http://www.erupert.ca
-
HT5312 How can I change rescue e-mail address
hi, pls. advice how can I change rescue e-mail address. I totally forgot security info answer.
-
I have used my force9 emails for a few years with now problem on my laptop and also for maybee 6 months on my iphone4s but after syncing with itunes on my laptop i have lost all the emails & email setting of my phone. I also back up on icloud and tri