Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
Showing results for 
Search instead for 
Did you mean: 
Active Contributor

If you have a field in your database that is in binary format and you're also developing a Crystal Report off of that data, then you'll need a way to convert that data into text...unless of course you want to leave it as binary format.

If you wish to convert binary data to text then this blog will help you out as there's a sample report attached that has a Custom Function that will do the conversion. You can also convert text into binary if you need to. The way that the Custom Function works is that it takes 8 characters at a time of the binary data record and then converts that set of 1's and 0's into a text character. The function will loop through the record and the final output will be the translation of the entire record. It doesn't matter if there are spaces in your binary data. For converting text to binary, the function loops through the record one character at a time converting that character into its binary equivalent.

As mentioned before, there is a sample report that has the Custom Function in the Report > Formula Workshop > Report Custom Functions folder. To use the report, extract the contents of the BinaryCharConverter file and change the .txt extension to .rpt. Also attached to this blog post is the binary and text data that the report was based off of. The chartable file is an Excel file so please change the .txt extension to .xls.

If you don't have Crystal Reports Server or BusinessObjects Enterprise and still want to do this type of conversion (i.e. you don't have a Repository to add the Custom Function to), on the Report Footer there's a formula that you can copy to your reports that will also work. Both the formula and the function will convert some line based commands like chr(9) or chr(13) properly as well.