Skip to content

Instantly share code, notes, and snippets.

@yashbhutoria
Last active April 29, 2021 21:10
Show Gist options
  • Save yashbhutoria/372627b2d37bdd59bf5216431172ff26 to your computer and use it in GitHub Desktop.
Save yashbhutoria/372627b2d37bdd59bf5216431172ff26 to your computer and use it in GitHub Desktop.
Scirpt to reproduce error with pyrfc while reading some SAP tables
import pyrfc
class SapWrapper:
def __init__(self, connection: pyrfc.Connection):
self._connection = connection
def _read_table(self, table_name: str):
results = self._connection.call(
"RFC_READ_TABLE",
QUERY_TABLE=table_name,
DELIMITER="|",
ROWSKIPS=0,
ROWCOUNT=1,
)
headers = [x["FIELDNAME"] for x in results["FIELDS"]]
return headers
ASHOST = ""
CLIENT = ""
SYSNR = ""
USER = ""
PASSWD = ""
connection = pyrfc.Connection(ashost=ASHOST, sysnr=SYSNR, client=CLIENT, user=USER, passwd=PASSWD)
wrapper = SapWrapper(connection=connection)
column_names = wrapper._read_table("T001") # Works as expected
column_names = wrapper._read_table("VBAP") # pyrfc._exception.ABAPApplicationError: RFC_ABAP_EXCEPTION (rc=5): key=DATA_BUFFER_EXCEEDED, message= Number:000 [MSG: class=, type=, number=000, v1-4:=;;;]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment