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 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.

Related Post

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
FIELDNAME FIELDNAME Field Name
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.

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.

NB:
don’t forget to add quote to value.

 CONCATENATE '''' -kunnr ''''  INTO lv_str.

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.

For more information check the standard program:
UGMD_TABLE_DELTA_TO_TRANSPORT

Share
Published by
John

Recent Posts

The Most Important SAP ISU Tables

SAP ISU Tables for Technical master data, for Billing Master Data, Billing and invoicing Tables?…

December 22, 2020

SAP Fiori 3 UX and Design of SAP Fiori Apps for SAP S/4HANA, SAP TechEd Lecture

SAP Fiori 3 UX and Design of SAP Fiori Apps for SAP S/4HANA, SAP TechEd…

November 18, 2020

The Main SAP Dunning Transaction Codes

Dunning is the business practice of informing a customer of past due payment. Dunning letters…

November 28, 2019

SAP Accounts Payable Tcodes & Accounts Receivable Tcodes ( SAP AP Tcodes & SAP AR Tcodes)

SAP AP Tcodes & SAP AR Tcodes: House Banks Tcodes, Advance Payments or Down Payments,…

August 1, 2019

The Most Important SAP Payment Terms Tables (ZTERM, Text…)

What are the main SAP Payment Terms Tables ? What are the related Tables in…

October 21, 2018

The most Important SAP Work Center Tables in SAP PP

Work center consists of master data related to routing of products. It contains data related…

October 21, 2018