SapRfcError: DATA_BUFFER_EXCEEDED

When using the pysaprfc library you may encounter this error when performing a RFC_READ_TABLE. The reason for this is primarily because the table has too many fields to draw back into the itable python structure of the pysaprfc library. To overcome this you will need to limit the number of fields being returned in the read_table method as shown in this code below. By the way this particular code snippet is also useful for drawing back iDoc status codes for a list of iDoc numbers. Especially useful if you are having trouble getting read only access directly to the database as we were 🙂

import pysap

# Variables
WhereSQL = "DOCNUM IN (2016, 2017, 2018)"
SQLTable = "EDIDS"
Fields = ["DOCNUM","LOGDAT","LOGTIM","CREDAT","CRETIM","STATUS",
"STACOD","STATXT","STAMQU","STAMID"]
MaxRows = "50"
CONN_FILE = "C:/Python26/pysaprfc/examples/sapconn.ini"
CONN_NAME = "SAPSANDBOX"

# Change next line to be able to connect to your SAP system
sap_conn=pysap.Rfc_connection(conn_file=CONN_FILE,conn_name=CONN_NAME)
sap_conn.open()

# Read entries from SQLTable
itab=sap_conn.read_table(SQLTable,options=[WhereSQL],max_rows=MaxRows)
# Print some fields from itab to show it worked
for p in itab:
print '%(DOCNUM)s %(LOGDAT)s %(LOGTIM)s %(CREDAT)s %(CRETIM)s %(STATUS)s %(STACOD)s %(STATXT)s %(STAMQU)s %(STAMID)s ' % p
sap_conn.close()

Software Performance Management

This has become my favorite topic of late, and it is becoming more and more evident to me that less people know about this set of disciplines than should. It seems that a large number of IT people claim to be experts in some area of IT after just 1 or 2 years of experience. Let me just state that I do not claim to be an expert in any area of IT, even after being performance testing for 23 years. I learn something new each day and I often learn from other people the most. There are no experts, just people with varying degrees of knowledge, who decide to specialize in a particular area or discipline (Specialists).

Continue reading

Rapid Performance Test Plan Template

My all time favorite test plan, you can call it Agile, Rapid or just plain simple. Sometimes you don’t have time to write all the required doco required to support a test, or you just need to run some very quick and straightforward tests.

I have used this rapid performance test plan template at a number of sites and it has satisfied all involved personnel, and it is only 1.5 pages long! Enjoy this one.

Continue reading

Sharing files between Windows and Linux

This is a quick post on how to share files between your Windows file system and Linux. In this case I am running andLinux .

andLinux is an awesome complete Ubuntu Linux system running seamlessly in Windows 2000 based systems (2000, XP, 2003, Vista, 7; 32-bit versions only). You really need to check the link above if you havent already.

Anyhow back to the topic, thanks to John Strumila for this one.

First install the appropriate samba packages.

sudo apt-get install samba smbfs smbclient

Create a new directory for the mountpoint

mkdir /mnt/yourshare

Mount the share changing cifs to smbfs depending on your config

sudo mount -t cifs //your.shared.windows.path/name /mnt/yourshare -o user=domain/uid%password

Display the new share via the df command

df

You can now access the new shared mount :

ls -ltra /mnt/yourshare

Python and SAP RFC Connections

Firstly download and install the latest stable version of Python. Once done , then download and install the Python library pysaprfc. Copy pysap.py somewhere in your PYTHONPATH (site-packages for example). Then you can then communicate with your SAP instance utilising code like this.

# Retrieve data from SAP/R3
import pysap

# Variables
WhereSQL    = "IDOCTYP like '%Z_CONN%'"
SQLTable    = "EDIFCT" 
MaxRows     = "5000"
CONN_FILE   = "C:/Python26/pysaprfc/examples/sapconn.ini"
CONN_NAME   = "SAPSANDBOX"

# Change next line to be able to connect to your SAP system
sap_conn=pysap.Rfc_connection(conn_file=CONN_FILE,conn_name=CONN_NAME)
sap_conn.open()

# Read entries from SQLTable 
itab=sap_conn.read_table(SQLTable,options=[WhereSQL],max_rows=MaxRows)
# Print some fields from itab to show it worked
for p in itab:
 print '%(FCTNAM)s %(FCTVRS)s %(IDOCTYP)s %(CIMTYP)s %(MESTYP)s %(MESCOD)s %(MESFCT)s %(OBJNAM)s %(DIRECT)s' % p

sap_conn.close()