Skip to Content
Technical Articles

SAP CPI : Artifact Extractor – Command Line Utility

Introduction

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.

About the Tool

The tool is open sourced and uses below SAP Platform API’s to read data

  • /itspaces/odata/1.0/workspace.svc/ContentEntities.ContentPackages
  • /itspaces/Operations/com.sap.it.op.tmn.commands.dashboard.webui.IntegrationComponentsListCommand
  • /Operations/com.sap.it.op.tmn.commands.dashboard.webui.IntegrationComponentDetailCommand
  • /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)

Tool Usage

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

How to Use

  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. Used in configuration mode. Defaulted to N]

Extract Design-Time Data

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.

Extract Runtime Data

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.

Extract Configuration Data

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>

External Variables that matches Regex {{[\w -<>\\+]*}} will only be resolved.

The generated JSON file will contain Channel’s Externalized parameter variable name with curly brackets {{var}} and the parameter value within square brackets [value] depending on –resolveExtVar parameter is set to N or Y respectively.

The first record of JSON file will contain the list of Channel attributes of All Adapter type. I will later publish the metadata specific for each Adapter per Sender / Receiver Direction.

How to View the Data

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.

Conclusion

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. And Also, explore using this for extracting artifacts to maintain them in SCM solution like GIT.

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

2 Comments
You must be Logged on to comment or reply to a post.