Contents:

SAPEX allows you to extract SAP objects to a defined path outside of the SAP server.  

Using this remote approach, you can download all the SAP objects to a remote machine where you can later execute Kiuwan Local Analyzer.


SAPEX scripts files are located in

  • <AGENT_DIR>/bin/sapex directory.


SAPEX configuration files are located in

  • <AGENT_DIR>/conf/sapex directory.

Remote scripts use SAP Java Connector (JCo) version 3.


Extract source code


Launch SAPEX sapexCode.xml script, for source code extraction from a remote SAP system.

Usage:

${AGENT_HOME}/bin/runant.cmd (or runant.sh) -f sapex/sapexCode.xml
    [-Dhost=HOSTNAME] [-Dsysnr=SYSNR_VALUE] [-Dclient=CLIENT_NAME]
    [-Duser=USER] [-Dpass=PASS]
    [-Dsap.connector=PATH_TO_SAP_JCO]
    [-Ddir.code=DIRECTORY_FOR_EXPORTED_CODE]

    [-Dtransportpattern=TRANSP] [-Dsubtransports=true/false]
    [-DpackagePattern=PACKAGE] [-Dsubpackages=true/false]
    [-Dprograms=true/false] [-Dprogrampattern=PROG_PATTERN]
    [-Dfunctions=true/false] [-Dfunctionpattern=FUNC_PATTERN]
    [-Dclasses=true/false] [-Dclasspattern=CLASS_PATTERN]
    [-Dwebdynpros=true/false] [-DwendynrpoPattern=WD_PATTERN]
    [-Dlanguage=LANG]
    [-Dcustomobjectsonly=true/false] [-Dcustomnamespace=CUSTOM_NS]

Example: 

${AGENT_HOME}/bin/runant.cmd -f sapex/sapexCode.xml -Ddir.code=/my/dir

The code extraction process is configured by the properties files located (by default ) at ${AGENT_HOME}/conf/sapex

See Appendix Configuration Files to know how to specify a custom directory for configuration files.


  • The connection properties for target SAP server could be configured in sapex.properties file in ${AGENT_HOME}/conf/sapex, or in this script directory.
  • The custom code extract config could be placed in a sapexCode.properties file located in ${AGENT_HOME}/conf/sapex, or in this script directory. Any parameter passed at script command line overwrites a parameter with same name in sapexCode.properties. 
  • hostsysnrclientuserpass and sap.connector are configuration values for target SAP system, and the location of the SAP JCo3 library. 
  • dir.code is the directory where exported code will be stored. 
  • For this operation, you must add to target SAP system the function module ZKW_SAPEX_CODE_RPC (which must be RFC-enabled), program ZKW_SAPEX_CODE, and the utility classes.

  The program ZKW_SAPEX_CODE might be run in SAP as an alternative to this (remote) extraction script.

 Extract metadata

Launch SAPEX sapexMetadata.xml script, for metadata extraction from a remote SAP system.

Usage:

${AGENT_HOME}/bin/runant.cmd (or runant.sh) -f sapex/sapexMetadata.xml
  [-Dhost=HOSTNAME] [-Dsysnr=SYSNR_VALUE] [-Dclient=CLIENT_NAME]
  [-Duser=USER] [-Dpass=PASS]
  [-Dsap.connector=PATH_TO_SAP_JCO]

  [-Ddir.metadata=DIRECTORY_FOR_EXPORTED_CODE]


Example: 

 ${AGENT_HOME}/bin/runant.cmd -f sapex/sapexMetadata.xml -Ddir.metadata=/my/dir

The metadata extraction process is configured by the properties files located (by default ) at ${AGENT_HOME}/conf/sapex

See Appendix Configuration Files to know how to specify a custom directory for configuration files.

  • Connection properties for target SAP server could be configured in sapex.properties file in <AGENT_HOME>/conf/sapex, or in this script directory. 
  • Custom code extract config could be placed in a sapexMetadata.properties file located in <AGENT_HOME>/conf/sapex, or in this script directory. Any parameter passed at script command line overwrites a parameter with same name in sapexMetadata.properties
  • hostsysnrclientuserpass and sap.connector are configuration values for target SAP system, and the location of the SAP JCo3 library. 
  • dir.metadata is the directory where SAP information files will be stored. 
  • For operation, you must add to target SAP system the function module ZKW_SAPEX_METADATA_RPC (which must be RFC-enabled), and program ZKW_SAPEX_METADATA, plus the utility classes 

The program ZKW_SAPEX_METADATA might be run in SAP as an alternative to this (remote) extraction script.

After extracting the Metafiles, if you are going to run an analysys with Kiuwan Local Analyzer be sure to specify the location of the extracted metafiles:

  1. Edit <AGENT_HOME>/conf/analyzer.properties
  2. Search for : 
    # Directory for the repository data extracted by SAP Connector abap.repository.dir=

This property must contain the location of the directory with the extracted metadata files.

Please note that by default is set to ".", i.e. the root of the source dir of the application to be analyzed.

You can set to another location, either relative to source dir or absolute

Its quite important also that you increase the memory to those analyses that use metadata. Please visit Out of Memory page if you get errors when analyzing with metafiles.

Run analysis

Once you have extracted the Abap source code (and optionally, metadata), you can execute Kiuwan Local Analyzer on extracted source code.

For instructions on how to do it please visit Kiuwan Local Analyzer

Appendix Configuration Files

The code and metadata extraction process is configured by the following files:

  • sapex.properties
  • sapexCode.properties
  • sapexMetadata.properties

These configuration files are (by default) located at  ${AGENT_HOME}/conf/sapex

You can configure a custom location by using the below parameter to run the command:

-DSAPEX_CONFIG_DIR=<your_configuration_directory>

Usage notes:

  • any configuration property present in directory specified by -DSAPEX_CONFIG_DIR takes precedence over default location ( ${AGENT_HOME}/conf/sapex )
  • if some configuration property is not present in files located at SAPEX_CONFIG_DIR, the value specified at default files will be used

Connection parameters: sapex.properties

sapex.properties
# ---------------------------------------------
# Configuration for SAP/R3 ABAP code extraction
# ---------------------------------------------

# Location where the SAP/R3 JCO (Java COnnector) library is placed.
# Make sure that the native library (sapjco3.dll or libsapjco3.so) is placed in the PATH of the account running SAP Connector.
sap.connector=

# Host with SAP/R3 repository
host=HOSTNAME_OR_IP_ADDRESS

# SAP System number
sysnr=00

# SAP Client number
client=000

# SAP/R3 username
user=USERNAME_HERE

# SAP/R3 password to use for code extraction
pass=PASSWORD_HERE


Code extractor parameters: sapexCode.properties

sapexCode.properties
# --------------------------------------------------
# Kiuwan Extractor for SAP (sapexCode) configuration
# --------------------------------------------------

# Local directory where exported code will be saved
dir.code=${basedir}

# Name or pattern for the id of the request/task transport order to export.
transportPattern=

# if true, export sub request/task transport orders for matching request/tasks.
subTransports=false

# Name or pattern for the package to export.
packagePattern=

# if true, export sub packages for matching packages.
subPackages=false

# if true, export matching programs
programs=true

# Pattern for the programs to export. If empty, no filter on programs.
programPattern=

# If true, export matching functions.
functions=true

# Pattern for the function modules to export. If empty, no filter on function modules.
functionPattern=

# Pattern for the function groups to export. If empty, no filter on function groups.
fgroupPattern=

# If true, export matching classes
classes=true

# Pattern for the classes to export. If empty, no filter on classes.
classPattern=

# If true, export matching web dynpro components
webdynpros=true

# Pattern for the web dynpro components to export. If empty, no filter on WD components
webdynproPattern=

# Language to use for object titles and locale-specific content. Use E for english.
language=E

# If true, dialog modules (for dynpro screens) will be exported.
screens=true

# If true, texts (for text-pools in code objects) will be exported.
texts=false

# if true, only custom (Z* or Y*) objects will be exported. If false, no filter for custom objects.
customObjectsOnly=true

# Custom namespace to use for exporting objects (for example, /myorg/ ). If none provided, no filter with custom namepsace.
customNamespace=

 

Metadata extractor parameters: sapexMetadata.properties

sapexMetadata.properties
# --------------------------------------------------
# Kiuwan Extractor for SAP (sapexMetadata) configuration
# --------------------------------------------------

# Local directory where exported metadata files will be saved.
dir.metadata=${basedir}

# If true, extract metadata for transaction codes
tcodes=true

# If true, extract metadata for authorization objects
authObjects=true

# If true, extract metadata for messages
messages=true

# If true, extract metadata for memory parameters
memoryParams=true

# If true, extract metadata for executable programs/reports
programs=true

# If true, extract metadata for function modules
functions=true

# If true, extract metadata for parameters in custom function modules
funcParams=true

# If true, extract metadata for dynpros (dialog modules)
dynpros=true

# If true, extract metadata for web dynpros
webDynpros=true

# If true, extract metadata for database tables properties
tableProperties=true

# If true, extract metadata for indexes on database tables
tableIndexes=true

# If true, extract metadata for fields in custom tables
tableFields=true

# If true, extract metadata for table authorization objects
tableAuthObjects=true

# If true, extract metadata for append structures for DB tables
tableAppendStructs=true

# If true, extract size (number of rows) for database tables matching tablePattern
tableSizes=true

# The pattern for table names whose size will be analyzed when tableSizes=true
tablePattern=Z*