Validation & Substitution comparison tool

作者:郑德鼎 约 6 分钟阅读 更新日期:2024-02-22 2 年前更新 标签:ABAP, PP, 开发, 生产
目录

Validation & Substitution comparison tool

393,703

Introduction

From time to time, the need to compare validation (transaction GGB0) & substitution (transaction GGB1) between two systems (usually development and quality or development and production), or between two client arises. This task is usually done manually, comparing step to step visually between two systems or clients. This is a slow and error prone task.

I was looking for some tool to automate this comparison task, but no succeed.

I propose here a validation & substitution comparison tool which is presented in this article. The advantage of using this tool is obvious: It is fast, and error free.

Result presentation

The presentation is done with an ALV, where the left part is the local system, and the right side is the remote system. In the middle of the ALV, icons are presented. The meaning of these icons is:

The entry is found in both systems, but the content is different.

The entry has been found in the local system, but not in the remote system.

The entry has been found in the remote system, but not in the local system.

Note that only the differences are presented. Equal rows are ommited.

Screenshots

Comparison of Validation prerequisites

Selection screen

The user has to select the proper RFC destination and “Validation prerequisite” radio button.

Once executed, the system shows the remote login screen. The user has to log in. The program shows the result:

Comparison of Validation checks

Selection screen

The user has to select the proper RFC destination and the “Validation Checks” radio button.

Once executed, the system shows the remote login screen. The user has to log in. The program shows the result:

Comparison of Substitution prerequisites

Selection screen

The user has to select the proper RFC destination and the “Substitution Prerequisite” radio button.

Once executed, the system shows the remote login screen. The user has to log in. The program shows the result:

Comparison of Substitutions

Selection screen

The user has to select the proper RFC destination and the “Substitutuin Substitution” radio button.

Once executed, the system shows the remote login screen. The user has to log in. The program shows the result:

Client comparison

To compare between clients, select a RFC destination which points to the same machine. At logon inform the client.

Code

*&---------------------------------------------------------------------*

*& Report ZCOMPARE_VALIDATION_SUBST

*& Author: Jordi Escoda, April 2017.

*& Coded in local classes: March 2018

*& Description: This program allows to compare the validation and

*& substitution steps between two systems or between clients of the

*& same system.

*& The result is presented in an ALV, where the left part is the local

*& system data, and the right part is the remote system data. In the

*& middle an icon is shown.

*& There are three types of record

*& -Different data between systems

*& -Content which is present in the local system, but not in the

*& remote system

*& -Content which is present in the remote system, but not in the

*& local system

*&

*& GGB0 (Validations)

*& GGB1 (Substitutions)

*&---------------------------------------------------------------------*

*& Selection screen texts

*& P_RFC RFC Destination

*& P_SCOND Substitution. Prerequisite

*& P_SSUBS Substitución. Substitution

*& P_VCHK Validación. Check

*& P_VCOND Validation. Prerequisite

*& SO_SUBST Substitution

*& SO_VALID Validation

*&

*& Text symbols

*& 001 Parameters

*& 002 Comparison

*&---------------------------------------------------------------------*

REPORT zutil_compare_validation_subst.

*--------------------------------------------------------------------*

• Tables and Types

*--------------------------------------------------------------------*

TABLES: gb921,

gb931.

TYPE-POOLS: abap,

icon.

*--------------------------------------------------------------------*

• SELECTION SCREEN

*--------------------------------------------------------------------*

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETERS: p_rfc TYPE rfcdes-rfcdest.
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.
PARAMETERS: p_vcond RADIOBUTTON GROUP rb1 "Validation: Conditions

USER-COMMAND rb,

p_vchk RADIOBUTTON GROUP rb1, "Validation: Checks

p_scond RADIOBUTTON GROUP rb1, "Substitution: Conditions

p_ssubs RADIOBUTTON GROUP rb1. "Substitution: Substitution

SELECT-OPTIONS: so_subst FOR gb921-substid.
SELECT-OPTIONS: so_valid FOR gb931-valid.
SELECTION-SCREEN END OF BLOCK b2.
SELECTION-SCREEN END OF BLOCK b1.

*----------------------------------------------------------------------*

• CLASS lcl_valid_susbt DEFINITION

*----------------------------------------------------------------------*

*

*----------------------------------------------------------------------*

CLASS lcl_valid_susbt DEFINITION FINAL.

PUBLIC SECTION.

CLASS-METHODS:

execute.

PRIVATE SECTION.

TYPES: BEGIN OF ty_subst_cond,

substid TYPE gb921-substid,

subseqnr TYPE gb921-subseqnr,

substext TYPE gb921t-substext,

seqnr TYPE gb901-seqnr,

boolexp TYPE gb901-boolexp,

END OF ty_subst_cond.
TYPES: BEGIN OF ty_subst_sust,

substid TYPE gb921-substid,

subseqnr TYPE gb921-subseqnr,

substext TYPE gb921t-substext,

conseqnr TYPE gb922-conseqnr,

substab TYPE gb922-substab,

subsfield TYPE gb922-subsfield,

subsval TYPE gb922-subsval,

manipexp TYPE gb922-manipexp,

exitsubst TYPE gb922-exitsubst,

tabsubst TYPE gb922-tabsubst,

filedsub TYPE gb922-filedsub,

END OF ty_subst_sust.
TYPES: BEGIN OF ty_subst_cond_out,

local TYPE ty_subst_cond,

icon TYPE iconname,

remoto TYPE ty_subst_cond,

END OF ty_subst_cond_out.
TYPES: BEGIN OF ty_subst_sust_out,

local TYPE ty_subst_sust,

icon TYPE iconname,

remoto TYPE ty_subst_sust,

END OF ty_subst_sust_out.
TYPES: BEGIN OF ty_valid_cond,

valid TYPE gb931-valid,

valseqnr TYPE gb931-valseqnr,

booltext TYPE gb90t-booltext,

seqnr TYPE gb901-seqnr,

boolexp TYPE gb901-boolexp,

END OF ty_valid_cond.
TYPES: BEGIN OF valid_cond_out_type,

local TYPE ty_valid_cond,

icon TYPE iconname,

remoto TYPE ty_valid_cond,

END OF valid_cond_out_type.
TYPES: BEGIN OF ty_valid_chk,

valid TYPE gb931-valid,

valseqnr TYPE gb931-valseqnr,

booltext TYPE gb90t-booltext,

valsevere TYPE gb931-valsevere,

valmsg TYPE gb931-valmsg,

msgtab1 TYPE gb931-msgtab1,

msgfield1 TYPE gb931-msgfield1,

msgtab2 TYPE gb931-msgtab2,

msgfield2 TYPE gb931-msgfield2,

msgtab3 TYPE gb931-msgtab3,

msgfield3 TYPE gb931-msgfield3,

msgtab4 TYPE gb931-msgtab4,

msgfield4 TYPE gb931-msgfield4,

workflow TYPE gb931-workflow,

END OF ty_valid_chk.
TYPES: BEGIN OF ty_valid_chk_out,

local TYPE ty_valid_chk,

icon TYPE iconname,

remoto TYPE ty_valid_chk,

END OF ty_valid_chk_out.
TYPES: ty_t_gb901 TYPE STANDARD TABLE OF gb901 WITH DEFAULT KEY.
TYPES: ty_t_gb90t TYPE STANDARD TABLE OF gb90t WITH DEFAULT KEY.
TYPES: ty_t_gb931 TYPE STANDARD TABLE OF gb931 WITH DEFAULT KEY.
TYPES: ty_t_gb921 TYPE STANDARD TABLE OF gb921 WITH DEFAULT KEY.
TYPES: ty_t_gb921t TYPE STANDARD TABLE OF gb921t WITH DEFAULT KEY.
TYPES: ty_t_gb922 TYPE STANDARD TABLE OF gb922 WITH DEFAULT KEY.
TYPES: ty_t_valid_cond TYPE STANDARD TABLE OF ty_valid_cond WITH DEFAULT KEY.
TYPES: ty_t_valid_chk TYPE STANDARD TABLE OF ty_valid_chk WITH DEFAULT KEY.
TYPES: ty_t_subst_cond TYPE STANDARD TABLE OF ty_subst_cond WITH DEFAULT KEY.
TYPES: ty_t_subst_subst TYPE STANDARD TABLE OF ty_subst_sust WITH DEFAULT KEY.
CLASS-DATA:

• Boolean formula

attr_t_gb901_rfc TYPE STANDARD TABLE OF gb901,

attr_t_gb901 TYPE STANDARD TABLE OF gb901,

• Boolean formula texts

attr_t_gb90t_rfc TYPE STANDARD TABLE OF gb90t,

attr_t_gb90t TYPE STANDARD TABLE OF gb90t,

• Substitution conditions

attr_t_gb921_rfc TYPE STANDARD TABLE OF gb921,

attr_t_gb921 TYPE STANDARD TABLE OF gb921,

• Substitution step texts

attr_t_gb921t_rfc TYPE STANDARD TABLE OF gb921t,

attr_t_gb921t TYPE STANDARD TABLE OF gb921t,

• Substitution constants

attr_t_gb922_rfc TYPE STANDARD TABLE OF gb922,

attr_t_gb922 TYPE STANDARD TABLE OF gb922,

• Table to process substitution conditions

attr_t_subst_cond_rfc TYPE STANDARD TABLE OF ty_subst_cond,

attr_t_subst_cond TYPE STANDARD TABLE OF ty_subst_cond,

• Table to process substitutions

attr_t_subst_subst_rfc TYPE STANDARD TABLE OF ty_subst_sust,

attr_t_subst_subst TYPE STANDARD TABLE OF ty_subst_sust,

• Output table for substitutions conditions

attr_t_subst_cond_out TYPE STANDARD TABLE OF ty_subst_cond_out,

• Output table for substitutions

attr_t_subst_sust_out TYPE STANDARD TABLE OF ty_subst_sust_out,

• Validation operations

attr_t_gb931_rfc TYPE STANDARD TABLE OF gb931,

attr_t_gb931 TYPE STANDARD TABLE OF gb931,

• Tables to process validation conditions

attr_t_valid_cond_rfc TYPE STANDARD TABLE OF ty_valid_cond,

gt_valid_cond TYPE STANDARD TABLE OF ty_valid_cond,

• Tables to proces validation checks

attr_t_valid_chk_rfc TYPE STANDARD TABLE OF ty_valid_chk,

attr_t_valid_chk TYPE STANDARD TABLE OF ty_valid_chk,

• Output table for validation conditions

attr_t_valid_cond_out TYPE STANDARD TABLE OF valid_cond_out_type,

• Output table for validation checks

attr_t_valid_chk_out TYPE STANDARD TABLE OF ty_valid_chk_out.

CLASS-METHODS:

execute_subst_conditions,

execute_subst_substitutions,

execute_valid_conditions,

execute_valid_check,

load_validation_tables,

load_substitution_tables,

load_table_rfc

IMPORTING im_tablename TYPE tabname

RETURNING value(re_table) TYPE REF TO data,

load_table_local

IMPORTING im_tablename TYPE tabname

RETURNING value(re_table) TYPE REF TO data,

fill_valid_cond

IMPORTING im_gb901 TYPE ty_t_gb901

im_gb90t TYPE ty_t_gb90t

im_gb931 TYPE ty_t_gb931

RETURNING value(re_valid_cond) TYPE ty_t_valid_cond,

...

郑德鼎

关于作者:郑德鼎

企业信息化与 SAP 技术顾问,长期专注 SAP ABAP、FI/CO、MM、SD 等模块的技术分享与实战经验总结。查看更多介绍

来源说明:本文内容由「Validation & Substitution comparison tool.docx」整理生成,仅用于内部技术分享与学习交流。