(DV-2402) SAP Report Comparison via Python
Application server prerequisites:
GNU C Library (GLIBC) 2.17
SAP User prerequisites:
Auth. check on object S_LOG_COM
COMMAND = ‘python’, ‘cd’, ‘chmod', ‘ls’, ‘mkdir’,’rm'
OPSYSTEM = operating system of an application server
HOST = host on an application server
Installing Python Comparator on AS
The installation process of Python Comparator is simplified via the program. Run transaction /DVD/VAL_REP_PY_INST to execute it.
Fill in a new name for Preset ID starting with the prefix ZVAL_REP_PYTH_COMP_*. The preset defines all setups for the location and execution of the Python script on the AS.
Click on the Install Python Comparator radio button
[OPTIONAL] Fill in the RFC Destination of the remote SAP system for installing and executing Python Comparator if the current system will not be used. SNP Validate transport has to be already imported on the remote system too.
Fill in the name of the Application Server where the Python Comparator will be installed. If the RFC destination is used then the server name has to be from the remote system. By default, the server name of the current log-on session is used.
Fill in the working directory path where the Python Comparator will be installed and operated.
Click on the Execute button.
When the installation process is executed the following actions are automatically performed on chosen Application Server (of the remote system if RFC is filled):
Working directory paths and subdirectories are created if they do not exist yet.
Files of Python Comparator build (compiled version) from repository set DVD_VAL_REP_PYTH_COMP_INSTALL are copied to the subdirectory compare_build.
Permission for execution is set to Python Comparator build.
Preset configuration is filled will all necessary setup and execution information.
After successful installation the following message is displayed in the processing log:
Created preset can be displayed by pressing the F1 key on the preset ID.
Check the Python Comparator installation
To check if Python Comparator is properly installed, choose the radio button Check installation and execute it. The following message with a log is displayed if everything is fine:
Uninstall Python Comparator
To uninstall Python Comparator just choose the radio button Uninstall Python Comparator and execute it. Then confirm your decision to uninstall it.
After the uninstallation, all created files and directories will be deleted from the Application Server, and the preset ID will be deleted too. The following message with a log is displayed after the finish:
Manual changes in the preset
The preset is something like an instruction table for the external module installation and execution (like Python) in ABAP. In the list of preset parameters is defined what scripts or compilation should be saved in which directory on which application server, what are inputs, what are expected outputs, and what should be executed when the module is called.
Values that are stored in the preset list are:
HOST: Variable specifies what host files should be installed and executed
INPUT: Name of the file that serves as input during execution
INSTALL_PATH: Directory for copying installation files from a repository. It may contain placeholders to provide a unique name to not interfere with parallel executions.
MAIN: Specifies the name of a file in the installation directory that is the main executable for execution
OUTPUT: Name of the file that will be created during execution and we need results from this file
REPOSITORY: Defines repository set of files to load into the installation directory
RFC_DEST: RFC destination, serves if we want to do execution on another system
WORKDIR_CLEANUP: Flag (value 'X’) if the working directory should be cleaned up after each execution
WORKDIR_NAME: Name of the working directory created on each execution if not exists. It may contain placeholders to provide a unique name to not interfere with parallel executions.
WORKDIR_PATH: Path to a working directory without a directory name. It may contain placeholders to provide a unique name to not interfere with parallel executions.
Placeholders used in directory names and paths are:
<SYSID>: System ID
<CLIENT>: Client
<HOST>: Host name
<WPPID>: Process ID
<PROGRAM>: Name of the main program
<REPID>: Name of current include
<UNAME>: Username
<DATE>: Date
<TIME>: Time
<TIMESTAMPL>: Timestamp
<HASH>: Generated hash from all above placeholders
<GUID>: Guid
When we launch transaction /DVD/EXT_SETUP we can see the general UI. We fill in the Preset ID that we want to Edit/Create and confirm by clicking on the Manage preset button.
After clicking on Execute button you will be taken to the next screen, which is a modifiable table screen:
Adding or deleting rows is done by standard ALV buttons. All rows we add will be saved under the Preset ID that we entered in the first step. On the example screen above we already have defined some of the variables, like which repository set of files to load, what the main build should be run at the start of execution, what are the names of inputs that Python is expecting to have, and lastly, what are the names of files that will be the main output of execution, so we know in what files should we look for results. After we are done Editing/Creating the preset we press the Save button to save the preset.
Using of preset
After installation of the Python comparator, the preset is filled with the corresponding setup and we can use it in SNP Validate. In the SNP Validate report test variant click on Advanced Settings, choose Python Report Comparator from the dropdown menu, and fill in a field with the name Preset ID. Save the variant. SNP Validate will then use a Python comparator with an execution setup defined in the preset.