SAP R/3 + Python = saprfc
saprfc for Python has been updated, to include support for registered RFCs (SAP R/3 ABAP -> Python), and for Transactional RFC (queued RFC).
So for example you can do this:
class reg: def __init__(self): self.cnt = 0 import sys import os def LoopHandler(self, srfc): self.cnt += 1 print "inside the customer loop handler - iter: %d ...\n" % self.cnt if self.cnt >= 30: return -1 return 1 def handler(self, iface, srfc): data = [] out = os.popen(iface.COMMAND.getValue(), "r") for row in out: data.append(row) out.close() iface.PIPEDATA.setValue( data ) return 1 if __name__ == "__main__": import saprfc conn = saprfc.conn(gwhost='seahorse.local.net', gwserv='3300', tpname='wibble.rfcexec') cb = reg() ifc = saprfc.iface("RFC_REMOTE_PIPE", callback=cb) ifc.addParm( saprfc.parm("COMMAND", "", saprfc.RFCIMPORT, saprfc.RFCTYPE_CHAR, 256)) ifc.addParm( saprfc.parm("READ", "", saprfc.RFCIMPORT, saprfc.RFCTYPE_CHAR, 1)) ifc.addParm( saprfc.tab("PIPEDATA", "", 80)) conn.iface(ifc) conn.accept(callback=cb, wait=3) print "All finished (reg.py) \n"
The latest version can be found here (saprfc-0.05).
Posted by PiersHarding at August 1, 2004 12:50 AM