Hi everybody,
I'm trying to develop an application which runs on a mobile device. There you should be able to make a picture with the camera and save it in the SAPoffice. There should also be a link generated between the image and the SAP object. What I did so far was the following:
I implemented a function which is able to make a picture. This picture is going to be transformed into a BASE64 string. Afterwards I send this data to the SAP System. I create a SAP Object and now I want to store the image. First of all I created a XSTRING out of the BASE64 string then I converted the XSTRING into BINARY. And now I'm callling the FM 'SO_DOCUMENT_INSERT_API' but here I get an error. The coding looks like the following:
DATA:
lf_folder TYPE soodk,
lf_folderid TYPE soobjinfi1-object_id,
lf_size TYPE i,
lt_content TYPE TABLE OF solisti1,
ls_document_data TYPE sodocchgi1,
lf_doctype TYPE soodk-objtp,
lf_docinfo TYPE sofolenti1,
lt_words TYPE TABLE OF string,
lf_token TYPE string,
lf_att_key TYPE swotobjid-objkey,
lf_picture TYPE xstring.
f_folder = 'FOL28000000000004'. "Just named it like this for test purposes
lf_folderid = lf_folder.
CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
EXPORTING
text = is_meldung-pic1
IMPORTING
buffer = lf_picture.
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
buffer = lf_picture
append_to_table = 'X'
IMPORTING
output_length = lf_size
TABLES
binary_tab = lt_content.
ls_document_data-obj_name = 'ATTACHMENT'.
CONCATENATE 'image' af_qmnum INTO ls_document_data-obj_descr.
ls_document_data-obj_langu = sy-langu.
ls_document_data-doc_size = lf_size.
ls_document_data-no_change = 'X'.
lf_doctype = 'jpg'.
CALL FUNCTION 'SO_DOCUMENT_INSERT_API1'
EXPORTING
folder_id = lf_folderid
document_data = ls_document_data
document_type = lf_doctype
IMPORTING
document_info = lf_docinfo
TABLES
object_content = lt_content
contents_hex = lt_content
EXCEPTIONS
folder_not_exist = 1
document_type_not_exist = 2
operation_no_authorization = 3
parameter_error = 4
x_error = 5
enqueue_error = 6
OTHERS = 7.
IF sy-subrc <> 0.
ENDIF.
The exception that I get is 'CX_SY_DYN_CALL_ILLEGAL_TYPE'. I really hope someone can help me solving this problem... so looking forward to your answers.
Greetings
Stef