cancel
Showing results for 
Search instead for 
Did you mean: 

Binary to XML/string conversion

former_member206760
Active Contributor
0 Kudos

Hi

I have a binary file from mainframe(sender) system...How can i convert it into XML/string in PI...

If I use abap mapping ....when the data reaches abap class ...will it be in UTF-8 encoding?

Accepted Solutions (1)

Accepted Solutions (1)

anupam_ghosh2
Active Contributor
0 Kudos

Hi T Shah,

                If you are using a binary file and you want to convert it into XML then you either need an adpater module or java mapping. I am not sure if this is possible with ABAP mapping since sometimes to interpret binary files you need to access the bit level information. Java has low level features to help you, ABAP might lack those features. This answers your first question. When data reaches ABAP class it will not be in UTF-8 encoding. As you are not using FCC the entire binary file data will flow into ABAP class. If you need more information on how to tackle this kind of situation please refer to my article on the same http://wiki.sdn.sap.com/wiki/x/SQxeDw .

Please also let the forum know more details of the file type you are trying to work with, and if possible upload an sample so that experts can have a look into it too.

Regards

Anupam

former_member206760
Active Contributor
0 Kudos

sample MV90 binary file is attached. Pls have a look at it

anupam_ghosh2
Active Contributor
0 Kudos

Hi T Shah,

                 I have gone through the file you have uploaded. Definitely you need java to tackle this kind of file. Please upload as much information you have got about the structure of this file, without structural information its very difficult to decode this file types. If you have reference to any program/editor to read such kind of files please upload that too.

Regards

Anupam

former_member206760
Active Contributor
0 Kudos

Hi Anupam ,

I am refering to your wiki as my req is similat to yours

http://wiki.sdn.sap.com/wiki/display/XI/Decoding+meter+data+exchange+format+%28MDEF%29+files+of+type...

however i tried downloading the XSD of the DT that you created and uploaded it in my system...but when i drag it in say Service interface it shows up as blank....what may be the reason??

highly appreciate your reply

anupam_ghosh2
Active Contributor
0 Kudos

Hi T Shah,

                 The file you are trying to decode might have a lot diffrent structure than the file I have writen about. Thus trying to apply the downloaded XSD might not help in your case. You can refer to my wiki only if you want to know how we can read a binary file type. Thus its important to know the detailed structural information about the file and the scenario u are trying to achieve. Please explain the details. Agian if you still insist to copy the XSD you can create one XSD. Then there is a tab in data type where you can view the source. Open this tab and try pasting the XSD you have downloaded. save it and I hope u will be able to work with it.

All the best.

Regards

Anupam

former_member206760
Active Contributor
0 Kudos

Hi Anupam,

Many thanks can you send me your email address as it will be difficult to send the table structure over sdn

anupam_ghosh2
Active Contributor
0 Kudos

Hi T Shah,

               The binary files come with variety of structures. Thus the XSD and the java mapping codes will differ with each type. the general process to read such file has been explained in my article. If you need my email id , it should be visible if you place mouse cursor on my name over each post. I have made my email details public.

Regards

Anupam

Answers (1)

Answers (1)

former_member184681
Active Contributor
0 Kudos

Hi,

The sender file adapter has an option to read the file contents in binary mode:

Whether after conversion it will be XML depends on what is the binary content of the file. And yes, while reading the file PI will treat it as UTF8-encoded, so if your file is written with a different encoding, use e.g. MessageTransformBean to convert the encodings.

Regards,

Greg