09-02-2009 8:10 AM
I am trying to feed a unicode sap r/3 system with data from a MS Access db on MS windows.
Both access and windows are in greek locale (cp1253). Python, nwrfc, and sap r/3 are unicode (utf8). My program encoding is utf8. I use python ado module (e.g. win32com.client.Dispatch(r'ADODB.Connection')).
Now, the values I get from the database are tested as python type unicode. If I feed them directly to sapnwrfc I get "invalid input" type of errors. If I encode them as 'utf8' (e.g. <value>.encode('utf8')), I get "RFC FUNCTION CALL ERROR: RfcSetChar string too long" errors. The respective fields in SAP are say CHAR10 type and they should be able to contain the test data. Some further tests revealed that
Greek:
g = u'u03B1u03B2u03B3' <type 'unicode'>
repr(g)
"u'\\u03b1\\u03b2\\u03b3'" (3 characters)
repr(g.encode('utf8'))
"'\\xce\\xb1\\xce\\xb2\\xce\\xb3'" (6 characters)
Latin:
l = u'abc' <type 'unicode'>
repr(l)
"u'abc'" (3 chars)
repr(l.encode('utf8'))
"'abc'" (3 chars)
I do not understand unicode programming that well, but if I send g.encode('utf8') to sapnwrfc, data is written to db successfully as long as their length, (that of repr(g) ), does not exceed that of the SAP field. The rest are truncated.
What should the input be? Can you help me out here?
Thanks,
Menelaos Maglis
Edited by: Menelaos Maglis on Sep 2, 2009 9:12 AM
09-11-2009 10:56 AM
Hi Menelaos,
did you already check SAP note 1021459 regarding this issue ?
Best regards,
Nils Buerckel
SAP AG