Skip to Content
avatar image
Former Member

Convert Binary data into readable content

Hi,

Could anyone tell me how i can convert Binary data into a readable content?(.xlsx/.txt)

I tried all the Function modules to convert BINARY_TO_STRING, BINARY_TO_TEXT and also XSTRING to String. But all of them gives data in readable format.

Also, i need to perform this function in background and hence cannot use 'GUI_DOWNLOAD'

Please help me provide the solution.

Thanks,

Deepika

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

5 Answers

  • Best Answer
    avatar image
    Former Member
    Dec 30, 2014 at 10:16 AM

    Hi all,

    An update. I was able to resolve that issue by writing the XSTRING directly to file in .xslx extension using OPEN DATASET. No more pop-up appear. 😊

    Thank you all for the help. really appreciate.

    Thanks,

    Deepika

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Dec 30, 2014 at 04:22 AM

    You could try methods of class  CL_BCS_CONVERT

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Dec 30, 2014 at 04:59 AM

    Hi Deepika,

    Did you try FM SCMS_BINARY_TO_STRING?

    If you need to download the file in background, you will need to use open dataset method and write the files on application server. You can't use GUI_DOWNLOAD in background.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Dec 30, 2014 at 05:39 AM

    the data i am pulling is of Rate table in TM system. There is std FM which will read the table and get the output in XSTRING (Solix) format.

    Add comment
    10|10000 characters needed characters exceeded

    • Hi Deepika,

      Could you provide a sample text file? so we can try and provide the solution.

      Because we don't know what kind of file you have and what kind of data it's contains.

      We only can provide you the FM or Class name which are available in SAP system.

      May be you are not passing any of the parameters of any of the given FM.

      Regards.

      Praveer.

  • avatar image
    Former Member
    Dec 30, 2014 at 06:11 AM

    Hi Praveer,

    Here is the sample file. Please remove the file extension (.txt) from file as other extensions are not allowed to be attached in this message

    1. From the Table, the std SAP program gets the data in XSTRING,

    2. Using OPEN DATASET in BINARY MODE, the contents are written to Binary file in AS

    3. I am converting this file to Text or .xlsx file types.

    Thanks,

    Deepika


    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      The file generated by the standard program seems to be text (I assume based on your open dataset and read dataset statement).


      In order to make your file readable by excel you have to download the file in text format as a .csv file (which is comma delimited) or use xml transformation and convert your internal table to excel format.

      You can find a lot of material on scn on how to transform an internal table as excel file.

      But reading text data converting it to binary and saving it as .xls wont create an excel file