Step-step Guide how to SAP remote table comparison with ABAP Code

SAP remote table comparison: This article will help you compare two remote tables. First, it will check if the SAP DDIC strutures of both tables are the same. If it is the case, it will compare the data in these tables.

SAP Remote Table Comparison

It happens in SAP to compare the values of table between Two systems ( DEV/QUAL or QUAL/PROD ) and especially for customizing table.
This comparison makes the troubleshooting easier by removing an potential customizing/Data problem.

This articles will go through how to SAP Remote Table comparison step by step

  • Check MetaData Compliance
  • Populate Fieldlists
  • Build Options/ Filter
  • Remote Retrieve Data
  • Compare two internal Tables
  • sample ABAP Program
Check also   SAP SPOOL Tcodes, Tables and Quick Tips

Check MetaData Compliance

The standard function DDIF_FIELDINFO_GET retrieves the metadata of a table in input.
This function can be called remotely in order to retrieve the target table we want to campare.

In this sample, this function is called twice:

  1. The first call to Get Fields List of Table (Target)
  2. The second call to Get Fields List of Table (Source)

If there is no compliance in metadata, no need to go further.

Populate Fieldlists

The return of BAPI DDIF_FIELDINFO_GET-DFIES_TAB[] contains list of fields with the whole metadata description.
We need the following information

Field Name Field Type Description
OFFSET DOFFSET Offset of a field
LENGTH DDLENG Length (No. of Characters)
TYPE INTTYPE ABAP data type (C/D/N/…)
FIELDTEXT AS4TEXT Short Description of Repository Objects

Build Options/ Filter

The Option table is a table of Where clause.
This is used to filter data retrieved from remote table.

Check also   Most Useful SAP EDI Transactions (SAP Idocs Tcodes) & SAP EDI Tables

As an sample, let’s add filter on KUNNR when retrieving data from a remote KNA1 table

don’t forget to add quote to value.

Remote Retrieve Data

RFC_READ_TABLE is used to read data from a SAP table localy or remote.
As exporting parameter, query_table is the table name.
The main tables parameters are

Table Parameter Description
OPTIONS filter the data ( where clause )
FIELDS List of fields to retrieved from the table
DATA The data retrieved from the table

Compare two internal Tables

SAP Remote Table Comparison: sample ABAP Program

follow the link for the complete ABAP Program to remote compare table.

Check also   How to link STKO and STPO for BOM in SAP

For more information check the standard program:


Hi. I have been working as SAP Technical and functional for a decade. Through this blog, I am trying to share with you my experience. Hopefull, it makes your ways easier path ... Sab