Install the Command Line Interpreter (CLI)
If you intend to support SAP BC-XOM integrations, then you must install the Loftware Spectrum Command Line Interpreter (CLI) on the SAP Application Server to prepare for Loftware Spectrum® Integration for use with SAP® Applications.
The CLI is a utility that is run by the SAP Spooler when a print job is submitted from SAP ERP. The CLI passes the request to the Loftware Spectrum® Integration for use with SAP® Applications. Spectrum applies the appropriate label template, sends the job to the printer, and then sends the status back to the SAP Spooler.
Note: These steps are required only if you intend to support SAP BC-XOM integrations.
Note: It is strongly recommended that each SAP Application Server be configured with its own CLI and a uniquely named CLI log file.
The following steps should be performed by a SAP Basis Administrator on the SAP Application Server. The configuration for the Loftware Spectrum CLI requires moving files into a folder that the SAP Logical Output Management System (LOMS) instance can access.
Install the Loftware Spectrum Command Line Interpreter
To install the CLI on the SAP Application Server, perform the following steps.
- Download the file from the Spectrum Application Server, where spectrum-server is the name of the server hosting Spectrum for your organization:
http://<spectrum-server>:<port>/downloads/sapClient-package.zip
- Extract the contents of the sapClient-package.zip package to the desired folder on the SAP Application Server.
Note: The CLI can be in any location, as long as the Output Management System (OMS) definition in SAP Spool Administration (SPAD) has the appropriate path in the OMS Submit Command.
- Open a Command Prompt window or Terminal, navigate to the folder where you unzipped the files to, and then run the
install.cmd
orinstall.sh
command. - If your Spectrum Application Server is implemented with SSL, do the following to ensure the SAP CLI can connect to Spectrum:
- In your browser, navigate to the Spectrum sign in page.
- Follow your browser's instructions to save the SSL certificate to a file.
- On the SAP Application Server, navigate to <SAPCLI_HOME>/jre/bin.
- Execute the following command:
keytool -importcert -alias myAlias
-file \path\to\file\saved\from\browser
-keystore <SAPCLI_HOME>\jre\lib\security\cacerts
- At the prompt for the keystore password, enter
changeit
. - At the prompt for trusting the certificate, enter
yes
.
- Edit the runcli file as described for your operating system.
Note: The script output must be only the single output line generated by the sapcli request. This format is dictated by SAP and additional lines are not allowed. The following is an example.
2.00 4 1 test Print\ request\ accepted\ by\ Loftware\ Spectrum
Windows Server Operating System
- Open the runcli.cmd_EXAMPLE file in a text editor.
- Change the SAPCLI_HOME value, C:\saptest, to the fully-qualified path to the folder where the sapcli tool is installed.
- Optional parameter: To change the request connection timeout setting, add a space at the end of the last line and then add
CTO=<numeric value in milliseconds>
Example
CTO=20000
- Optional parameters: If you need to use a proxy server, add a space at the end of the last line and then use the following options as needed.
PROXYHOST, PROXYPORT, PROXYUSER, PROXYPASSWORD
Example (enter the parameters on the same line)
PROXYHOST=172.17.2.83 PROXYPORT=8080 PROXYUSER=myuser PROXYPASSWORD=mypassword
- Save the file as runcli.cmd.
Linux Operating System
- Open the runcli.sh_EXAMPLE file in a text editor.
- Change the sapCli_home value, /opt/loftware, to the fully-qualified path to the folder where the sapcli tool is installed.
- Optional parameter: To change the request connection timeout setting, add a space at the end of the last line and then add
CTO=<numeric value in milliseconds>
Example
CTO=20000
- Optional parameters: If you need to use a proxy server, add a space at the end of the last line and then use the following options as needed.
PROXYHOST, PROXYPORT, PROXYUSER, PROXYPASSWORD
Example (enter the parameters on the same line)
PROXYHOST=172.17.2.83 PROXYPORT=8080 PROXYUSER=myuser PROXYPASSWORD=mypassword
- Save the file as runcli.sh.
Important! The runcli.sh script must have execute permission set.
Linux Example
Copy#!/bin/bash
# Change /opt/loftware to the fully-qualified path to the folder where the sapcli tool is installed.
#
# To send secure requests to Spectrum:
# 1) Import the Spectrum certificate to the JRE keystore installed with this CLI located at
# $JAVA_HOME/lib/security/cacerts
# 2) Add the following option to the last command line below, before -cp: -Djavax.net.ssl.trustStorePassword=changeit
# Note: You may change the password to the keystore file.
#
# Optional Parameters:
#
# To add optional parameters, add a space at the end of the last line, then add optional parameters as documented below.
# All optional parameters MUST be added to the END of the last line.
#
# CTO To change the request connection timeout setting, add CTO=<numeric value in milliseconds>
# Example CTO=20000
# Proxy Settings
# If you need to use a proxy, use the following options as needed:
# PROXYHOST, PROXYPORT, PROXYUSER, PROXYPASSWORD
# Example: PROXYHOST=172.17.2.83 PROXYPORT=8080 PROXYUSER=myuser PROXYPASSWORD=mypassword
#
export sapCli_home=/opt/loftware
export JAVA_HOME=${sapCli_home}/jre
$JAVA_HOME/bin/java -cp .:${sapCli_home}:${sapCli_home}/* com.loftware.sapCliClient.SapCli SUBMIT $@IBM AIX Operating System
- Install Java 1.8 from IBM.
- Open the runcli.sh_EXAMPLE file in a text editor.
- Delete the first line (#!/bin/bash).
- Change the sapCli_home value, /opt/loftware, to the fully-qualified path to the folder where the sapcli tool is installed.
- Optional parameter: To change the request connection timeout setting, add a space at the end of the last line and then add
CTO=<numeric value in milliseconds>
Example
CTO=20000
- Optional parameters: If you need to use a proxy server, add a space at the end of the last line and then use the following options as needed.
PROXYHOST, PROXYPORT, PROXYUSER, PROXYPASSWORD
Example (enter the parameters on the same line)
PROXYHOST=172.17.2.83 PROXYPORT=8080 PROXYUSER=myuser PROXYPASSWORD=mypassword
- Change the JAVA_HOME value to the fully-qualified path to the folder where the Java 1.8 JRE or JDK is installed.
- Save the file as runcli.sh.
- Open the runcli.sh_EXAMPLE file in a text editor.
- Change the sapCli_home value, /opt/loftware, to the fully-qualified path to the folder where the sapcli tool is installed.
- Optional parameter: To change the request connection timeout setting, add a space at the end of the last line and then add
CTO=<numeric value in milliseconds>
Example
CTO=20000
- Optional parameters: If you need to use a proxy server, add a space at the end of the last line and then use the following options as needed.
PROXYHOST, PROXYPORT, PROXYUSER, PROXYPASSWORD
Example (enter the parameters on the same line)
PROXYHOST=172.17.2.83 PROXYPORT=8080 PROXYUSER=myuser PROXYPASSWORD=mypassword
- Save the file as runcli.sh.
- Optional: To use the encryptpw utility to encrypt the password parameter in the runcli file, do the following.
- Open the encryptpw.cmd_EXAMPLE (Windows Server) or encryptpw.sh_EXAMPLE (Linux) file in a text editor.
- Change
C:\saptest\
(Windows Server) or/opt/loftware
(Linux) to the fully-qualified path to the folder where the sapcli tool is installed. - Replace the parameter
-file
with the case-sensitive name of the file for which passwords need to be encrypted. - Replace the parameter
-field
with the case-sensitive name of the password option to encrypt. - Save the file as encryptpw.cmd (Windows Server) or encryptpw.sh (Linux).
- Run the script from the command line.
- Open the log4j2.xml_EXAMPLE file in a text editor. Change the Property LOG_DIR value C:/saptest to be the explicit directory where the sapcli tool is installed. Save the file as log4j2.xml.
log4j2.xml_EXAMPLE File
Copy<?xml version="1.0" encoding="UTF-8" ?>
<!--
Change the Property LOG_DIR value "C:/saptest" to be the explicit directory
where the sapcli tool is installed.
-->
<Configuration>
<!--
Properties
-->
<Properties>
<!-- http://logging.apache.org/log4j/2.x/manual/layouts.html#PatternLayout -->
<Property name="PATTERN">[%d{yyyy/MM/dd HH:mm:ss.SSS}][%5p][%c](%t) %m%n</Property>
<Property name="LOG_DIR">C:/saptest</Property>
</Properties>
<!--
Appenders
where log messages go to
-->
<Appenders>
<RollingFile name="FILE" fileName="${LOG_DIR}/sapcli.log"
filePattern="${LOG_DIR}/sapcli.%d{yyyy-MM-dd}-%i.log.gz">
<PatternLayout pattern="${PATTERN}" charset="UTF-8" />
<!-- triggering policies -->
<Policies>
<!-- rollover once the file has reached the specified size -->
<SizeBasedTriggeringPolicy size="10000KB" />
</Policies>
<DefaultRolloverStrategy max="5"/>
</RollingFile>
</Appenders>
<!--
Loggers
-->
<Loggers>
<Logger name="com.loftware.sapCliClient" level="INFO"/>
<Root level="ERROR">
<AppenderRef ref="FILE"/>
</Root>
</Loggers>
</Configuration> - The CLI can be in any location, as long as the Output Management System (OMS) definition in SAP Spool Administration (SPAD) has the appropriate path in the OMS Submit Command. OMS commands should include the required quotation marks, as shown in the following example. For the last parameter, enter RDI, XSF, XML, or XFP as appropriate. For more information, see Configure SAP ERP for BC-XOM Communication.

OMS Submit Example (Windows Server)
Path: C:\saptest\
Submit: runcli.cmd http://localhost:8080/spectrum-server/int/sbpj "n=bcxom1" SapTest CIDSDEVLK "PDFDev1" ZZMEDRUCK.rdi DEVPORTSAP01_IDS_03 RDI
Sending via SSL Example (Windows Server)
PATH: C:\saptest\
Submit: runcli.cmd https://localhost:8443/spectrum-server/int/sbpj "n=bcxom1" SapTest CIDSDEVLK "PDFDev1" ZZMEDRUCK.rdi DEVPORTSAP01_IDS_03 RDI
Continue with Configure an SAP User for Spectrum.