Warning: Deprecated documentation
You are using the old version of the online help for ERPConnect.
Make sure to use the documentation within the new HelpCenter for ERPConnect.

This section shows how to use the ReadTable class.
A recurrent task when working with SAP and .NET applications is to read directly from tables of the SAP system. The ReadTable class enables access to that data.

Note: The RFC_READ_TABLE function module for table extractions is not suitable for mass data extraction, see Table Restrictions.

Reading Data From Tables #

The following sample shows how to use the ReadTable class to select data from the SAP table MAKT and how to process the ADO.NET result table object.

The SAP table MAKT contains material descriptions.

  • This sample reads the material description texts of MAKT. For this the columns MATNR (material number) and MAKTX (material text) are needed.
  • Add a corresponding WHERE statement SPRAS='EN' to make sure only the English language texts are read (SPRAS is the column that contains the language keys).
using System;
using System.Data;
using ERPConnect;
using ERPConnect.Utils;

// Set your ERPConnect license

// Open the connection to SAP
using var connection = new R3Connection(
    host: "server.acme.org",
    systemNumber: 00,
    userName: "user",
    password: "passwd",
    language: "EN",
    client: "001")
    Protocol = ClientProtocol.NWRFC,


var table = new ReadTable(connection)
    WhereClause = "SPRAS = 'EN'",
    TableName = "MAKT",
    RowCount = 10

// Select columns to read


DataTable result = table.Result;
for (int i = 0; i < result.Rows.Count; i++)
    Console.WriteLine($"{result.Rows[i]["MATNR"]} {result.Rows[i]["MAKTX"]}");



000000000000000023 Pawan Kalyan_08
000000000000000038 Test US colleagues upd4
000000000000000043 English Check 25_01
000000000000000058 Ventilation, complete build
000000000000000059 Filter Ereteam
000000000000000068 a portable 1 ton crane
000000000000000078 Component Full Repair Service ...
000000000000000088 AS-100 T-shirt XL
000000000000000089 AS-100 T-shirt
000000000000000098 PCB Subassembly


Table Restrictions #

When extracting tables from older SAP releases you may encounter several restrictions when using the SAP standard function module (RFC_READ_TABLE):

  • The overall length of all columns to be extracted must not exceed 512 bytes.
  • It is not possible to extract data from tables that contain one or more columns of the data type f (FLTP, floating point), DEC (decimal, e.g. for percentage) or x (RAW, LRAW).
  • Poor extraction performance with larger tables.

Warning! Error while converting value ‘*.0’ of row 1530, column 3
The SAP standard module RFC_READ_TABLE for table extraction can only extract the ABAP data type DEC to a limited extent. This leads to the mentioned example error during extraction.