1. download rfcsdk on sap.com, download saprfc for python on http://pypi.python.org/pypi/saprfc/0.07
2. install rfcsdk and saprfc with docs
#! /usr/bin/env python
import pprint
import saprfc
conn = saprfc.conn(ashost='hostname', sysnr='00', client='220', lang='EN', user='xxxxx', passwd='xxxxx')
conn.connect()
print "am I connected: ", conn.is_connected()
print "sysinfo is: "
pprint.pprint(conn.sapinfo())
iface = conn.discover("RFC_READ_TABLE")
iface.query_table.setValue("TRDIR")
iface.ROWCOUNT.setValue(10)
iface.OPTIONS.setValue(["NAME LIKE 'SAPL%RFC%'"])
conn.callrfc(iface)
print "NO. PROGS: ", iface.DATA.rowCount()
#print "PROGS DATA: "
#pprint.pprint(iface.DATA.value)
# get the SAP Data Dictionary structure for TRDIR
str = conn.structure("TRDIR")
# various ways for iterating over the results in an
# interface table
for x in iface.data.value:
print "Doing: " + str.toHash(x)['NAME']
#print "PROGS HASH ROWS: "
#for i in iface.DATA.hashRows():
# print "next row: ", i
conn.close()