SAP CPI : Artifact Extractor – Command Line Utility

After being part of a few implementations which had a couple of hundreds of Interfaces containing a few hundred Communication Channels. It was always a challenge to find the answer to questions like

  • What packages we have and what IFlow are within it?
  • What version of IFlow is in Design and Runtime?
  • What Artifacts were created by Developer X?
  • What Artifacts were recently modified by Developer X?
  • OK, This Security Artifact Mr.X! Is it used at all? Where all is it used?
  • Are the connections parameters like Host, Credentials, etc externalized to ease deployment?
  • How many target systems SCPI is connecting to?
  • So on and so forth.

Of course, all of this can be answered with good documentation and manual check. But the quickest and the efficient way to answer them to me is to make the data available centrally and extracted programmatically. The result, I came with a command-line utility that leverages SAP APIs for it.

The tool uses below SAP Platform API’s to read the data

  • /itspaces/odata/1.0/workspace.svc/ContentEntities.ContentPackages
  • /itspaces/Operations/
  • /Operations/
  • /api/v1/IntegrationDesigntimeArtifacts

It’s compiled in JavaSE1.8 (1.8.0_221) and the required libraries are packaged in the Jar itself.

The tool executable scpiExtractor.jar can be downloaded from the Git Hub Project SAP CPI Tool(The same Git Project that contains the CPI DocEr tool to document SAP CPI Mappings)

The tool has 3 options

  • Extract Information from Desing-Time like
    • Package Name
    • IFlow Name and Version
    • Created and Last Modified Date
    • Created and Last Modified by User
  • Extract Information from Runtime like
    • IFlow Name and version
    • AMQP/JMS/SFTP Polling Endpoint
    • HTTP / ODATA / CXF Endpoints
  • Extract Configuration Information of Sender and Receiver Channel like
    • Host
    • Port
    • Queue / Topic
    • URL
    • Credential Name
    • Timeout Configuration Etc
  1. Download the scpiExtractor.jar from Git Hub Project SAP CPI Tool into a local folder.
  2. Navigate to the local folder containing the Jar and launch command prompt
  3. Run the extraction command java -jar scpiExtractor.jar with below arguments
-SCPI Your SCPI TMN Host Name
-user User Name
-password Password for the user
[Optional: Same will be prompted if not entered]
-mode Value : designtime / runtime / configuration
-filename Output Json filename
-resolveExtVar Value : Y/N
[Optional: To resolve Externalized Variable value in configuration mode. Default is N if not entered]

Copy below command and execute with your values to <tmn_host>, <userID> & <outputFile>.json parameters.

java -jar scpiExtractor.jar -SCPI_Host <tmn_host> -user <userID> -mode designtime -filename <outputFile>.json 

This generates a JSON File which I will show in the End how to import it into Excel and view.

Copy the below command, give values to <tmn_host>, <userID> & <outputFile>.json and execute.

java -jar scpiExtractor.jar -SCPI_Host <tmn_host> -user <userID> -mode runtime -filename <outputFile>.json 

This generates a JSON File which we see how to view and filter with Excel.

Copy the below command, give values for <tmn_host>, <userID>, <outputfile>.json, <Y/N> and execute.

java -jar scpiExtractor.jar -SCPI_Host <tmn_host> -user <userID> -mode configuration -filename <outputfile>.json -resolveExtVar <Y/N>

This generates a JSON file with Externalized variable on Channels within square brackets [value]. If the -resolveExtVar parameter is set to N or not used the Extarenalized variable names are extracted without double curly brackets {{var}}

There is an excel “SAP CPI-Artifact Information.xlsx” template in the SAP CPI Tool Git Hub.

1. Download it and Open

2. Navigate to Data –> Queries & Connections –> Choose the Entries 1 or 3 or 4.

3. Click on Edit

4. It Opens a Power Query Editor. Change the Data Source and select the file you extracted

5. Load and refresh to view the JSON Data in respective Tabs.

You could also do below if you wish to view it in excel as per your requirement.

1. Open Excel. Goto Data –> Get Data –> from File –> From JSON

2. Choose your JSON and Import. It opens a Power Query Editor.

3. Convert the Source to Table, Expand Columns

4. Then Choose and filter columns to view the JSON Data as you need.

Once you have the data it’s up to your imagination to load it where you want and query it the way you want.

I have plans to integrate this with the CPI DocEr tool when I find the time and a UX consultant to help me in this journey.

I’ll be happy to hear your feedback and know if it helped you 🙂