on 05-29-2013 10:30 PM
Hi All,
Kindly help me to get the solution for the below requirement:
1> I have to do conversions such as Ascii to Hexadecimal, Little Enidan, Binary Coded Decimal at field level ie at mapping level.
2> Then generate a file of binary type extension as .sad, which should be unreadable.
For example if I open the binary file the below data will display.
"T { “3
“3
Ð’@ 4Ÿ@ l
"T ™ “3
“3 p
"T [1] w “3 (
I completed the first requirement using UDFs. But unable to generate binary file. Please guide.
Regards,
Nutan
Hi Nutan,
Do you have file format information of .sad file? Ask the business for the file format of the binary file. All binary file has a fixed format. First thing is to find the format and then use a java mapping to create the output format in SAP PI. Do not use receiver FCC in communiction channel. From your post it seems the input to the scenario is also a binary file content. Anyways you can check one of my articles on binary file in this thread http://scn.sap.com/thread/1983926. Please check response to the query and the link to the article.
Regards
Anupam
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Anupam,
Thanks for your valuable reply. Before posting this query here, I went through your blog. You showed how to read a binary file of .MDEF through java mapping. My requirement is to generate a binary file as output file.
This scenario is Proxy to File. As you asked for format, whether it means output structure. If so, below is the output structure:
· The file to be created consists of the following:
1 header record
1 header extension record
1 header sub record
n data records
in binary format without any control line-feeds.
Regards,
Nutan
Hi Nutan,
The process of generating a binary file such as MDEF is exactly reverse of the process of reading the same. The information needs to be converted into byte from string then writtten to the binary file. The header record or extension record, each of these has a apecific size in bytes. They have to be written down to the file in a byte array of same size. In case you have fully understood the code I wrote then I feel you can do this one too. In the code I had to dig deep into each bit of the file to understand its content , in your case this might not be required. In case business has provided you detailed structural information about the file please go through the document and try to create a small sample file.
Regards
Anupam
Hi Anupam,
I tried to parse a small xml file and did all the necessary conversions. But as per the suggestion convert the data from string to bytes and then write in a file, is not happening. While writing in a file if I use FileOutputstream then it gives the same text data. I open the file in notepad but it's in readable format.
Regards,
Nutan
Hi Nutan,
Need to check file format information before I can comment further on this issue.
The flow should be like this
string---->binary---->restructure binary according to file format----> write output.
If you have link or ducuments regarding this file please forward me the same. Need to study and then I can be in position to comment on the issue.
Regards
Anupam
Hi All,
I am able to write a binary file in eclipse, but donot know how to replicate that in java mapping. I am using sax parser to read the XML payload and then in character method I am doing all the specific conversions as mentioned above. Then writing in DataOutputStream as Short,Int,Long as per the field byte size. Kindly let me know how to write the file through java mapping, as we cannot use public static void main method there, so I am confused how to use DataOutputstream and create a binary file. Please suggest.
Regards,
Nutan
User | Count |
---|---|
82 | |
10 | |
10 | |
9 | |
6 | |
6 | |
5 | |
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.