As was promised earlier - work has been done on creating the next generation Connector for Python using the new SAP NW RFCSDK that Ulrich SAP NetWeaver RFC SDK.
The Python sapnwrfc Connector is designed very much in the same style as the NetWeaver RFC gives the Next generation Ruby and Perl Connectors ones, so the syntax should hopefully be familiar (from the test suite distributed with the source code):
import unittest
# define the test class
class sapnwrfctest(unittest.TestCase):
# code that is executed once at the start of the test
def setUp(self):
sapnwrfc.base.config_location = 'examples/sap.yml'
sapnwrfc.base.load_config()
# Test iteration of handling a deep structure
def testDeep1(self):
# connect to SAP
conn = sapnwrfc.base.rfc_connect()
self.assertNotEquals(conn, None)
# look up the RFC interface definition
fds = conn.discover("STFC_DEEP_STRUCTURE")
self.assertEquals(fds.name, "STFC_DEEP_STRUCTURE")
for i in range(100):
# allocte a call container
fs = fds.create_function_call()
self.assertEquals(fs.name, "STFC_DEEP_STRUCTURE")
# populate the parameters for the call
fs.IMPORTSTRUCT( { 'I': 123, 'C': 'AbCdEf', 'STR': 'The quick brown fox ...', 'XSTR': "deadbeef".decode("hex") } )
# do the call
fs.invoke()
# check the results
s = fs.ECHOSTRUCT()
self.failUnless(s['I'] == 123)
self.failUnless(s['C'].rstrip() == 'AbCdEf')
self.failUnless(s['STR'] == 'The quick brown fox ...')
self.failUnless(s['XSTR'].encode("hex") == 'deadbeef')
self.assertEquals(conn.close(), 1)
# now run it
if __name__ == "__main__":
import sapnwrfc
unittest.main()
Downloading
This is a complete rewrite to take advantage of the new SAP NW RFCSDK, with unicode support, and support for deep structures. This version provides Client side RFC support only. The download is available here