pythonabapsaprfc

Calling a SAP table in Python via RFC_READ_TABLE gives an error: DATA_BUFFER_EXCEEDED


I am trying to extract a SAP table in Python using RFC_READ_TABLE:

result = conn.call('RFC_READ_TABLE', QUERY_TABLE=table_name,  DELIMITER='|', FIELDS=fields, OPTIONS=Options, ROWCOUNT=MaxRows, ROWSKIPS=FromRow)

I need to extract 86 fields from BSIS table but I have only been able to extract 54 fields, when I try to extract more I get this error:

ABAPApplicationError: 5 (rc=5): key=DATA_BUFFER_EXCEEDED, message= Number:000 [MSG: class=, type=, number=000, v1-4:=;;;]

Instead of using RFC_READ_TABLE, I used BBP_RFC_READ_TABLE but it didn't work either. I also read that Function Module RFC_READ_TABLE also limits if read exceeds 512 bytes per row of data.

Am I doing something wrong? Could you give me some hints on that issue?


Solution

  • You're doing right, and RFC_READ_TABLE limits the output to 512 characters, if you extract too many fields, the exception DATA_BUFFER_EXCEEDED happens.

    RFC_READ_TABLE is a very bad choice to extract data from the database tables because you access the ABAP-based system (RFC_READ_TABLE) just to extract data from the database.

    so, even BBP_RFC_READ_TABLE (and any other ABAP-based thing) is a wrong choice.

    You'd better access the database directly from your program, and you will have much more control.

    If your company has a SAP license, you should be able to access the SAP note 382318 - FAQ | Function module RFC_READ_TABLE which says things like (information extracted July, 2023):

    NB: this answer is not specific to Python, it only concerns RFC_READ_TABLE.