cancel
Showing results for 
Search instead for 
Did you mean: 

Upload Image Captured from Android to SAP

Former Member
0 Kudos

Hi All,

I'am new to SAP Mobility, what I'm trying to do is Upload an Image captured from Android Phone Camera to SAP system.

I'm Using PhoneGap with Eclipse to Build the app, I have done till capturing the picture using camera and I dont know how to proceed, that is how to Send it to SAP system.

I have searched a lot on this topic and I found in infocenter.sybase.com that you can use "MBO from file" to send an Image to SAP system.

I'm using SUP 2.2 and I'm not able to find this option(MBO from file) can anyone please guide me on this. I'm really stuck and has been trying many things.

Any kind of help would be appreciated

Regards,

Pratheek

Accepted Solutions (1)

Accepted Solutions (1)

Aashish28
Contributor
0 Kudos

Hiii pratheek ,

                      You need to follow simple steps for storing data in SAP system

1) Create one Bapi with input parameter type XSTRING and create its MBO.

2) Once you android app capture image convert that bitmap image to BASE64 encoded string and send this string to MBO's (Xstring in MBO bigbinary) BigBinary parameter.

3) In your bapi write down logic for Decoding it into xstring ( Use FM SSFC_BASE64_DECODE or  CL_HTTP_UTILITY class )  and than save it to rawstring format in database .

BR,

Ashish

Former Member
0 Kudos

Hi Ashish,

Thanks a Lot for your reply and your simple answer, now I created an MBO but what operation should i call?

How will I set the Importing Parameter of the BAPI in MBO to my Image? where should I set this value?

Please excuse my ignorance, I'm new to this Mobility Topic

Thanks again for your reply

Regards,

Pratheek

Aashish28
Contributor
0 Kudos

Hiii Pratheek,

                     use CREATE operation for your BApi and pass your image into that , when you create CREATE operation you will find your BApi import parameter is available in that that means you don't need to create personalization key and don't need to map them , once you generate code , see you generated class for you MBO you will find BApi import parameter as attribute of class just set value of image(base64 image ) and than call submit and synchronize.

and inside BApi as told you in my earlier replay follow steps , by this you can easily put your image inside Sap database or in your custom table.

Former Member
0 Kudos

Hi Ashish,

Thanks a Lot

Regards,

Pratheek

Former Member
0 Kudos

Hi Ashish,


" once you generate code , see you generated class for you MBO you will find BApi import parameter as attribute"


1.   In which .js file we can find input parameter MBO.

2. How to pass out image to this parameter

I did following

called customGetPictureDataFromCamera() in customBeforeMenuItemClick(screen, menuItem) of custom.js

in customGetPictureDataSuccess(fileName, imageData ) i want to set this imageData to MBO input paramete. how can i set....

Thanks

Suresh

Former Member
0 Kudos

Hi SUresh,

You need to use CLient Parameter and Map it to the import parameter of MBO

Regards,

Pratheek

Former Member
0 Kudos

Hi Pratheek,

          Thanks for the input..

I am totally new to SUP..

Could you please elaborate.

customGetPictureDataSuccess(fileName, imageData )

i have imageData, how to pass it to MBO input field. in custom.js


where CLient Parameter available ?

Thanks

Suresh

Former Member
0 Kudos

Hi Pratheek,


               I did the following.

function customGetPictureDataSuccess(fileName, imageData ){

          var pictureDataValue = new MessageValue();

          pictureDataValue.setKey("key21");                                                  // Must be set by the user.

          pictureDataValue.setValue(imageData);

          pictureDataValue.setType(MessageValueType.TEXT);

          var mvc = getWorkflowMessage().getValues();

          if( mvc ) {

                    mvc.add( pictureDataValue.getKey(), pictureDataValue );

Thanks

Suresh

Former Member
0 Kudos

Hi Pratheek,

          Is i did anything wrong?

Answers (0)