#3 read tables with fields packed binaries

open
nobody
None
5
2007-04-17
2007-04-17
Anonymous
No

The following code deliveres errors with packed binaries. The fields presented below are all of such type, for testing purposes.

Best Regards,
ralf.timmermann@bayerbbs.com

+++

import pysap

sap_conn=pysap.Rfc_connection()
sap_conn.open(conn_string='xxx')

func=sap_conn.get_interface('RFC_GET_TABLE_ENTRIES')

func['TABLE_NAME']='MARA'
func['MAX_ENTRIES'] = 5

try:
rc=func('TABLE_NAME','MAX_ENTRIES','ENTRIES')
except pysap.SapRfcError,desc:
print "Error invoking 'RFC_GET_TABLE_ENTRIES': %s" % desc
else:

itab=sap_conn.get_table('MARA')

itab.append_from_table(func['ENTRIES'])
for P in itab:
# print P
print P.matnr
print P.brgew
print P.wesch
print P.laeng
print P.breit
# print P.hoehe
print P.ergew
print P.ervol
print P.gewto
# print P.volto
print P.fuelg
print P.mhdrz
print P.mhdhb
print P.mhdlp
print P.inhal

sap_conn.close()

+++

Traceback (most recent call last):
File "C:\Python25\test_rfc1.py", line 44, in <module>
print P.breit
File "C:\Python25\pysap.py", line 378, in __str__
return str(self.ext_value)
File "C:\Python25\pysap.py", line 374, in __get_value
return _do_conversion_out(self,RfcGetBcd(self,self._length_,self._decs_))
File "C:\Python25\pysap.py", line 82, in RfcGetBcd
else: return eval(vs)
File "<string>", line 1
<00000003.450
^
SyntaxError: invalid syntax

Discussion