Skip to Content

Upload Image to SAP

Hi Friends,

As I am currently working on uploading image to SAP from Signature Pad, I am stuck in below point and require you guys help.

1. I am able to get the Signature Pad (canvas) content and the content looks below:

data:image/png;base64,iVBORw0KGgoAAAANSUhEU........... (attached)

2. I am stuck to go ahead how I would need to take this format to backend SAP and store in DMS as png Image.

Kindly help me to know or point blog if there are steps on the same.



PNG_Base64.JPG (111.8 kB)
Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Posted on Jun 16, 2016 at 06:12 PM

    I could able to find the resolution. It's just a decode of base 64 Value.



    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Your Data is in Base64 Encoded Format. You have to decode it and then store it as an XString in SAP.
      For example, if you want to put it in MIME Repository,

      DATA: l_content TYPE xstring.

      CALL METHOD cl_http_utility=>if_http_utility~decode_x_base64


      encoded = lv_input


      decoded = lv_decoded_xstring.

      IF o_mr_api IS INITIAL.

      o_mr_api = cl_mime_repository_api=>if_mr_api~get_api( ).


      lv_filename = 'test.png'.

      l_content = lv_decoded_xstring.

      CONCATENATE mimepath lv_filename INTO l_url.

      TRANSLATE l_url USING '\/'.

      CALL METHOD o_mr_api->put


      i_url = l_url

      i_content = l_content

      i_suppress_package_dialog = 'X'


      parameter_missing = 1

      error_occured = 2

      cancelled = 3

      permission_failure = 4

      data_inconsistency = 5

      OTHERS = 6.

      IF sy-subrc = 0.

      lv_json_output = 'Success'.



Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.