on 05-22-2013 4:26 PM
Hello Experts,
I want upload an image using mobile camera or gallery to SAP system.
Regards
Sumeet S
Hello Midhun
I have created one custom RFC for testing purpose is as shown below. For IMPORTING value I am passing "base64" type as STRING.
Source Code is:
FUNCTION Z_IMG_UPLOAD.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" VALUE(IM_DATA) TYPE STRING OPTIONAL
*" EXPORTING
*" VALUE(EX_MSG) TYPE CHAR1
*"----------------------------------------------------------------------
DATA: lr_mime_rep TYPE REF TO if_mr_api.
DATA: lv_content TYPE xstring.
DATA: lv_length TYPE i.
DATA: lv_rc TYPE sy-subrc.
DATA: lt_data TYPE STANDARD TABLE OF x255,
p_path TYPE string VALUE 'SAP/public/test1.jpg'. "<<-- Mime path, save to path
lr_mime_rep = cl_mime_repository_api=>if_mr_api~get_api( ).
CALL FUNCTION 'SSFC_BASE64_DECODE'
EXPORTING
b64data = im_data
IMPORTING
bindata = lv_content
EXCEPTIONS
OTHERS = 8.
lr_mime_rep->put(
EXPORTING
i_url = p_path
i_content = lv_content
I_DEV_PACKAGE = '$TMP'
EXCEPTIONS
parameter_missing = 1
error_occured = 2
cancelled = 3
permission_failure = 4
data_inconsistency = 5
new_loio_already_exists = 6
is_folder = 7
OTHERS = 8 ).
if sy-subrc = 0.
ex_msg = '0'.
endif.
ENDFUNCTION.
Then I have created MBO as shown below
MBO
Then created one Personalization KEY.
Assigned Load Argument with
and generated code for android.
After this What to do???
Am I on right path???
Regards
Sumeet S
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sending image from the native app will be an operation of the MBO.
In that case you need keep the load parameter of the RFC as the Xstring. And there is no need to create a personalization key to map it to the load parameter. Instead you need to call the operation as given below and pass the binary data as argument.
MBO_test.sendImage("binary_string");
Where sendImage is the operation in the MBO.
You need to create an operation inside the MBO. Once you import the generated code to the project you can use that operation as I mentioned.
SendImage is a name I given as an example.
What you are trying to do. Can you please explain.
Hi Midhun,
Thanks a Lot for your time.
What I'am trying to do is,
I have an Android app using PhoneGap now When I take a Picture with the camera, I want that Picture to be send to SAP. For this I have created an RFC and Used an MBO for the same. Now I dont know how to send my photo from this html file in Phonegap to the SAP system, can you please guide me.
Regards,
Pratheek
Are you gonna send the image from a native app of HWC?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You need to have an RFC with input parameter to accept the binary data ( image ). The data type of that input parameter will be Xstring.
In the MBO the datatype of that field will be BigBinary. The image has to be send as a binary file from the device.
I believe that you can send the image from device through the use of PhoneGap.
User | Count |
---|---|
80 | |
9 | |
9 | |
7 | |
7 | |
6 | |
6 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.