`
23号
  • 浏览: 129379 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
社区版块
存档分类
最新评论

sap rfc with python

阅读更多

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()

1
0
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics