如何使用Pyrfc Python 库查询 SAP R/3 数据库表中的条目数?
问问题
515 次
1 回答
3
I know of two methods to do this using Pyrfc. Modify the following example with your SAP R/3 server connection settings and desired table name:
from pyrfc import Connection
params = dict(ashost='1.1.1.1', sysnr='1', client='100',
user='username', passwd='password')
table = 'MKAL'
with Connection(**params) as conn:
# Method 1
result = conn.call('RFC_GET_TABLE_ENTRIES', TABLE_NAME=table, MAX_ENTRIES=1)
entries = result['NUMBER_OF_ENTRIES']
# Method 2
result = conn.call('EM_GET_NUMBER_OF_ENTRIES', IT_TABLES=[{'TABNAME': table}])
entries = result['IT_TABLES'][0]['TABROWS']
于 2017-10-19T18:14:54.173 回答