Skip to Content
avatar image
Former Member

Download Image Base64 to a JPEG file in BSP application

Good Afternoon everyone,

I know there is a lot of information on the web regarding this topic but I couldn't land the correct solution on my case.

I created a BSP solution where I'm sending some information and an image in Base64 format via string data. Once I on the ABAP side, I'm trying to download this information to some share directory I have on the application server. The problem shows at the moment the image is placed on this directory, the image it is always corrupted.

I tried using different methods without any result:

1. I tried using the OPEN DATASET directly with the first string i received

2. I tried using FM to convert the Base64 information to XSTRING, then convert the XSTRING to Binary table and finally download the table via OPEN DATASET

3. Once I have the Binary table I tried to download this table via download FM and method from the front end services, but as I working with the BSP I cannot use these methods (via background)

Have somebody achieve this solution? .... If yes, do you have any suggestion/ideas on why the image is getting corrupt at the moment I save it?

Thanks in advance for your inputs.

Have a great day,

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Apr 25, 2017 at 04:49 AM

    You can directly write the XSTRING to the file on the SAP file system in one shot (OPEN DATASET ... IN BINARY MODE FOR OUTPUT + TRANSFER xstring TO dataset).

    You should give the name of the FM you use to convert the base 64.

    To make sure the file on the application server is correct, you should make sure that you always use the binary mode to upload/download it. You have tools to look at the server directly without need of making a buggy ABAP program (direct access to the OS, or tools like ZAL11)

    Add comment
    10|10000 characters needed characters exceeded

  • Apr 25, 2017 at 09:36 AM

    Hi,

    maybe something like what is proposed in this thread would do:

    File Upload in BSP Applications and store in Application server

    Best regards,

    Pablo

    Add comment
    10|10000 characters needed characters exceeded