cancel
Showing results for 
Search instead for 
Did you mean: 

Save Image in SAP using OData

Former Member
0 Kudos

Hi All,

          Please guid me how to save base64 string to sap.

I created Data , model for odata and i added in service.

I am using javascript and html5 to consume sap data.

I am using post method in URL. I can post data from my html file to SAP.

Now i want to extend my application to save image also in sap.

In javascript i have base64 string.

I have following doubts.

1. which data type i need to use in SAP entity structure to read base64 string data.

2.How to save Base64 string data in table.

Accepted Solutions (1)

Accepted Solutions (1)

arunchembra1
Participant
0 Kudos

Hi Suresh,

1. You have to use STRING data type in SAP to receive base64 string data.

2. In sap you have to call method utility->decode_base64 to convert the base64 data to binary .

3.Once data is converted to binary you can directly to save to sap table.

Thanks,

Arun Chembra

Former Member
0 Kudos

Hi Arun,

          Thanks for input, How to display in sap the decode_base64 image.

Some text is saving in table. How to confirm it is xstring of image.

Thanks

suresh

Answers (1)

Answers (1)

ray_lv
Explorer
0 Kudos

Hi Suresh,

Currently I have also face the same scenario, and I would like to know that if you have already find a solution? could you kindly share your experience to me?

  Best regards,

   Ray.

Former Member
0 Kudos

Hi Ray,

Which error your are getting?

If you want to save image in ztable.

create a field with datatype xstring ( XSTRINGVAL ) and pass image.dataURL using Odata.read POST method

before saving into table pass string data from OData to FM SSFC_BASE64_DECODE

Thanks

Suresh