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.
Table of Contents
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
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:
- The first call to Get Fields List of Table (Target)
- The second call to Get Fields List of Table (Source)
If there is no compliance in metadata, no need to go further.
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|
The Option table is a table of Where clause.
This is used to filter data retrieved from remote table.
As an sample, let’s add filter on KUNNR when retrieving data from a remote KNA1 table
CONCATENATE 'KUNNR = ' lv_str INTO SEPARATED BY space.
don’t forget to add quote to value.
CONCATENATE '''' -kunnr '''' INTO lv_str.
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
|OPTIONS||filter the data ( where clause )|
|FIELDS||List of fields to retrieved from the table|
|DATA||The data retrieved from the table|
For more information check the standard program: