cancel
Showing results for 
Search instead for 
Did you mean: 

Upload a picture to SAP System

stefan_heitzer
Participant
0 Kudos

Hi everybody,

I try to create an application which should be able to take a picture and afterwards upload it to a SAP System. I can already make a picture and safe it in my application. The path to the image is always something like this:


file:///storage/sdcard0/Android/data/MYPACKAGE/cache/1390895377066.jpg

My application has a simple synchronize button and everytime when you press this button all the changed data (including my picture) should go to the SAP System. Just for your information: Im developing with Cordova on an Android Device. The picture is made through the following code:


navigator.camera.getPicture(onPhotoSuccess, onPhotoError, {

            quality: 50,

            destinationType: Camera.DestinationType.FILE_URI,

            sourceType: Camera.PictureSourceType.Camera

});

Does anybody know how it is possible to take the picture and deliver it to the system? Looking forward to your answers!

Greetings

Stef

Accepted Solutions (1)

Accepted Solutions (1)

stefan_heitzer
Participant
0 Kudos

Hi everybody,

in case you haven't noticed. I wrote a blog post for solving this issue

Here is the link to it:

Don't hesitate to ask if you have any problems

Kind regards

Stef

Answers (2)

Answers (2)

stefan_heitzer
Participant
0 Kudos

Hi again,

I have a small news update for you. I was able to send the base64 code to the SAP system.   What I want to achieve now is to save the image as an attachement for a special notification. SAP allows to save images and other attachement as a "Service for Object". I know that notifications etc. are saved in the table "QMEL". Is there now a special association? How am I able to save it as a "Service for Object"? Has anybody of you done this before? Looking forward to your answers. Greetings!

stefan_heitzer
Participant
0 Kudos

Hi again,

I read something about building a RFC which takes a xString as an import parameter. This xString should include the Base64 Code of the image afterwards.

It's no problem for me to get that Base64 Code. There is a special function for that which does it for me. The question that I have is how to call the RFC. Where does the RFC store the image? Really hope that you can help me solving this problem.

Greetings

Stef

midhun_vp
Active Contributor
0 Kudos

You are right you need to keep the input of the RFC as Xstring. The ABAP developer can save the image in any server based on the requirement,ex.application server. If you are developing a cordova app you have to go with Odata services. You have option to create Odata service from RFC.

Some helpful links:

Convert images to base64 strings for HTML/CSS embedding

- Midhun VP

stefan_heitzer
Participant
0 Kudos

Hi,

why through oData? Couldn't I just make a request from javascript and calling an URL???

Greetings

Stef

midhun_vp
Active Contributor
0 Kudos

You can use NW gateway to integrate mobile app with SAP system. NW gateway is capable to expose Odata service. Odata is a service (URL) that you can use just like a request in javascript.

How you are integrating the app with SAP?

- Midhun VP

stefan_heitzer
Participant
0 Kudos

Well I understand that but the only thing what I want to do is to send the base64 code + the other data to the sap system. save the base64 code as img in the mime repository and create an entry in a database. oData only delivers me data doesn't it? If no, how would you make this oData service calll???

Looking forward to your answer

Greetings