2013 Nov 10 6:53 PM
Hi
I´m exposing a RFC Function Module as a webservice directly in ERP (no PI involved). One of the fields are created as type RAWSTRING and is intended for transporting a PDF document.
But i have some problems with the incoming request.
The process is this:
CALL FUNCTION 'CRM_IC_XML_XSTRING2STRING'
EXPORTING
inxstring = wa_dok-dokumentdata
IMPORTING
outstring = lv_string.
CALL FUNCTION 'SWA_STRING_TO_TABLE'
EXPORTING
character_string = lv_string
line_size = '1022'
IMPORTING
character_table = lt_text
total_length = lv_length.
CALL FUNCTION 'SCMS_HTTP_CREATE'
EXPORTING
* MANDT = SY-MANDT
crep_id = cv_crepid
* DOC_ID =
comp_id = 'data'
mimetype = 'application/pdf'
length = lv_length
* SIGNATURE = 'X'
* DOC_PROT = ' '
text_mode = 'X'
* ACCESSMODE = 'c'
* SECURITY = ' '
* OVERWRITE = '-'
IMPORTING
doc_id_out = ls_docid
TABLES
data = lt_text
But currently it seems that SWA_STRING_TO_TABLE fails when the webservice is called? Am i missing something? I have been about some base64 encoding but i´m not sure.
Any ideas?
2013 Nov 10 8:29 PM
Jakob,
it seems that your intention is to convert an xstring into a table of bytes with fixed line length. You found a function module which does this for strings, and therefore you want to apply it for your xstring. Since this didn't work directly, you called another function module before, which myteriously transforms the given xstring into a string so that you can apply the function module you found.
And all this only because you want to pass these data to SMCS_HTTP_CREATE which apparently requires the xstring as a tables parameter.
If this really is your problem:
You may try the code of my function module Z_SPLIT_XSTRING_TO_TABLE instead, you can find it online on the link http://bsp.mits.ch/code/fugr/zutil_convert (select in in the "Funktionsbaustein" listbox).
This function module which is self-contained, directly converts an XSTRING to an "X table" (a table with one raw field of a given length), as seems required by the SMCS_HTTP_CREATE module.
Another question: Why don't you directly pass the PDF as an export parameter EV_PDF TYPE XSTRING in your RFC module?
Regards,
Rüdiger
2013 Nov 11 6:37 AM
Hi
Another question: Why don't you directly pass the PDF as an export parameter EV_PDF TYPE XSTRING in your RFC module?Because it´s the other way around: the PDF is an import parameter - people are sending pdf files to our system and i need to store them in the content server.
2013 Nov 11 6:46 AM
I see. Try my function module Z_SPLIT_XSTRING_TO_TABLE then, and eliminate the calls of 'CRM_IC_XML_XSTRING2STRING' and 'SWA_STRING_TO_TABLE'.
Also, and even more important: you probably will need the SCMS_HTTP_CREATE_RAW for a table of binary data (not the SCMS_HTTP_CREATE which expects tables of character data, not binary data)