on 10-25-2013 1:40 PM
Hello,
I am trying to upload image from iOS to SAP(By using sap mobile platform 2.3) and having some problems.
I look into some discussions on this case before and still couldnt solve it.
What i am trying to do is :
send a photo from device to SAP and create that photo with abap into local machine
I have a rfc on SAP that receives string and when try to create a mbo from this rfc, string size automatically becomes 300 and i cant change it.
If i could receive the base64 encoded string to abap, i can create the image but because of the 300 length limitation that does not work for me.
Some people says use xstring on rfc but xstring seems to 1024 length and rawstring seems to be right choice in that matter but i couldnt create a photo from rawstring in ABAP.
I took the image into NSData then use base64 encoding into Another NSData and send this to SAP. but after this i tried to change the encoded rawstring into a form that can be used with 'gui_download' but i gives control_flush_error
I am new to SUP maybe i am doing it all wrong can someone plz explain to me how to do this. (And why i cant change string default size which is 300)
Thank you very much
Hello Ata,
I do not know if things changed a lot for MBOs in SMP 2.3, but in SUP 2.1.3 i have done it this way...
For MBOs and the size... Try by creating an Operation Based MBO of type OTHER, i have uploaded files (not images) to SAP via RFCs using XSTRING's, and STRING's. And separate them in sync groups.
If you are using XSTRING, The Operation Based MBO on the data source must have a BIGBINARY attribute, and the client parameter must be a BINARY(n) where n is your size input. In this case you must send a NSData to SAP, and do the encoding/decoding in SAP.
If you are using STRING, The Operation Based MBO is the same thing, but with a "No Size" String Attribute in the Data Source, and in the client parameter must be a String(n), where n is your size input. In this case you must send an Encoded String to SAP (base64 is one of the popular ones).
Do not try to change the encoding of NSData, the iOS encoding for NSData is fine, if you need to change the encoding/decoding try to do it directly in the file type or on SAP. If you are using iOS7 i believe that they have finally put a method for base64 encoding/decoding for NSData. If you are using an older iOS version try this method:
http://stackoverflow.com/questions/6006823/creating-a-base-64-string-from-nsdata
For information if the file has reached SAP or not, you can use the callback handler on the methods onReplySuccess and onReplyFailed.
Hope this information is useful, regards,
Daniel
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you Daniel,
My problem is i cant create a no size string when i give a string import parameter rfc, MBO load argument attribute automatically becomes STRING(300) and i cant change it.(Even if i give STRING(400000) from client parameter it only takes 300 of them) What sap data type i should use in my rfc to get no size string ?
BTW i will try to send nsdata without doing encoding in iOS.
Hi Ata,
Can you reply with a print screen of your MBO?
We are using a plain STRING from SAP, no special handling or modifications...
*" IMPORTING
*" VALUE(PI_DOCID) TYPE CGPL_EXTID OPTIONAL
*" VALUE(PI_NAME) TYPE SKWF_URLP OPTIONAL
*" VALUE(PI_DESCRIPTION) TYPE SKWF_DESCR OPTIONAL
*" VALUE(PI_FILENAME) TYPE FPATTFILE OPTIONAL
*" VALUE(PI_LENFILE) TYPE SDOK_FSIZE OPTIONAL
*" VALUE(PI_STRING_LINE) TYPE STRING OPTIONAL
*" VALUE(PI_LINE_X) TYPE XSTRING OPTIONAL
*" EXPORTING
*" VALUE(PE_SUCCESS_CODE) TYPE SYMSGNO
*" VALUE(PE_SUCCESS_MSG) TYPE CHAR0256
Is strange that the SMP 2.3 is forcing the size at the operation parameters, perhaps they are trying to force you to use XSTRING for uploads. You can try by creating a XSTRING field and go in that way.
If you still want to go with string, try to set a large size for your string in SAP.
(Remember, if the import is STRING type, you must send a STRING, not a NSDATA)
Regards,
Daniel
Hello Ata,
I would like to be in touch because I'm starting with Xcode programing using SUP.
Please, send me a e-mail.
Thanks in Advance,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
Also check these discussions, i am sure you will more inputs regarding your query
http://scn.sap.com/thread/3305700
http://scn.sap.com/thread/3300743
Rgrds,
Jitendra
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.