NiceLabel ABAP Package V4 - Implementation Guide
NiceLabel ABAP Package V4 - Implementation Guide
www.loftware.com
Contents
INTRODUCTION 5
Distribution of the ABAP Package 5
REQUIREMENTS 6
ARCHITECTURE 7
Overview 7
NiceLabel Automation configurations 8
Label design 9
Label print and data mapping 11
SETTING UP THE INTEGRATION 13
Deploying NiceLabel Automation 13
Installing NiceLabel Automation 13
Deploying triggers 13
2
USING ABAP PACKAGE FEATURES 53
Configuring the demo transaction 53
Using the demo transaction 53
Requesting a list of printers 56
Printing a label or report 57
Overriding print settings (label template, printer name, quantity) 57
Printing labels 75
Outbound delivery 81
Demo application 84
Print programs 85
DATA EXCHANGE 86
3
Structure of XML data sent from ABAP Package 86
Structure of “Header” element 87
API REFERENCE 94
/NICELAB/ namespace 94
ABAP class (API) methods 94
API class /NICELAB/CL_INTERFACE_ROOT 94
Class /NICELAB/CL_INTERFACE_DEMO 97
Class /NICELAB/CL_IF_CONFIG 97
Class /NICELAB/CL_IF_UTIL 99
SUPPORT 103
Online help 103
Troubleshooting 103
Error creating logical port in transaction SOAMANAGER 103
4
Introduction
An SAP transport package, formerly known as "development class", groups multiple related development
objects in a single distributable unit that enables transferring data from one SAP installation to another.
Whenever you create a new development object (such as a table, program, etc.) that you want to publish on
another SAP server, you must assign it to a package. After being assigned to an object, the object is placed
into a transport request.
NiceLabel ABAP Package contains objects that provide a framework for communicating with NiceLabel
Automation back-end label-printing service. ABAP Package exposes the API that is utilized by SAP
applications to send the data for printing. Once the data has been received from the SAP application, the
Package encapsulates it in an XML message and sends it to NiceLabel Automation for processing. You can
use Web Service (SOA) or HTTP (RFC type G) communication to NiceLabel Automation.
Besides label printing, the ABAP Package can also provide label preview (PDF, PNG, or JPEG), report the live
status of the label printer, generate a list of all labels in the document management system (DMS), provide a
list of available printers, a list of variables defined in the label and provide a binary print job into SAP.
NOTE: the printer must support reporting its live statuses.
This document describes the necessary steps to import the ABAP Package to your SAP system and to
configure it.
5
Requirements
The following requirements apply to NiceLabel:
• NiceLabel 10 platform (NiceLabel LMS Enterprise for on-premise perpetual license, or NiceLabel
Cloud Business/Unlimited for cloud subscription model).
• NiceLabel 10 was installed in the default location. 1
• PDF reader installed on Windows computer with SAP GUI (to see PDF label previews).
1
If you use non-default location, you must update the Automation configuration with your non-default path.
6
Architecture
Overview
ABAP Package is a collection of below-listed software components that simplify integration of label printing
from SAP:
1. ABAP transport package that you install in SAP.
2. Pre-configured Automation Enterprise with SOA (Web Service) and RFC type G (HTTP) triggers. You
can configure the ABAP Package to transfer the data to Automation Enterprise using one of the two
communication types. Additionally, there is a trigger to create the label catalog (a list of all labels in
your DMS).
3. Sample labels prepared with data sources for printing from some standard SAP transactions (such
as Outbound Deliveries - VL02N).
IT Label Approver
Designer
SAP DATA
Request
XML for label
WRITE TO
SPOOLER
Document
SAP GUI / Fiori ABAP package in Data Integration System Print history Management System
/NICELAB/ namespace responses,
Spooler
feedback
application Print
Get Printer Code
users Get Preview / PDF Printers
Create Label Variant
ABAP Package is transported into the SAP system and is available within the /NICELAB/ namespace.
ABAP Package is the connector that binds together the SAP and NiceLabel ecosystems. On one hand, ABAP
Package receives commands and data from SAP applications, while on the other hand, it communicates with
the NiceLabel integration system – NiceLabel Automation.
For better understanding, you can look at ABAP Package as an API for label printing. ABAP Package works
like an SDK (Software Development Kit) for label printing from SAP. It exposes certain methods that you call
from your SAP applications.
The request received from the SAP application is encapsulated in the XML message. ABAP Package sends
the XML content to the integration system (NiceLabel Automation) for processing. Depending on what the
user wants, NiceLabel Automation runs various actions. For example, the user might request a label print
7
action, generation of a label preview, generation of the binary print job, label catalog, information about the
selected label, list of available printers, or label printer’s live status.
When printing labels, NiceLabel Automation loads the specified label from DMS, merges it with values for
data fields as received in XML, and uses the NiceLabel printer driver to prepare a print job in Windows
Spooler. For example, if you use Zebra printers, the result is a ZPL (Zebra Programming Language) file in the
Windows Spooler.
NOTE: By default, SAP Spooler is not involved in the process in any way. It is the responsibility of Windows Spooler on
the computer with installed NiceLabel integration system to send data to the printer. Optionally, you can also command
NiceLabel Automation to provide the binary print job back to SAP Spooler, so you can also send it to the printer from
SAP.
The computer with installed NiceLabel Automation must meet the following prerequisites:
1. The drivers for your label printers must be installed. You can install printer drivers directly on this
computer, or you can register the drivers from the print server you might have.
2. All printers must be visible to the computer and to the user account under which Automation
Service runs. NiceLabel Automation on this computer creates print jobs and sends them to the
printers using Windows Spooler. The printers must be accessible for printing.
ABAP Package and NiceLabel Automation are both components of the product NiceLabel LMS Enterprise
(and higher editions). You create the label templates in NiceLabel Designer, and you store them in the DMS,
where they are governed by the approval workflows and version control system. DMS also supports role-
based access control (RBAC) and stores the history of all print events (e.g. all name-value pairs are
remembered together with the revision number of the printed label, printer name, and label copies). You can
also reprint labels from the DMS.
Each NiceLabel Automation configuration contains a few triggers that all provide the same functionality. The
difference between triggers is in the communication type between SAP and NiceLabel Automation. Choose
the communication type that fits your environment best.
1. SOA (Web Service). Running on port 50000/TCP. It accepts Web Service requests from the ABAP
Package.
2. RFC type G (HTTP). Running on port 50001/TCP. It accepts HTTP requests from the ABAP Package.
3. Cloud trigger (technically, this is also RFC type G (HTTP). In this case, SAP does not communicate
directly with the Automation server (there might not be a direct connection possible). SAP sends the
message to Cloud Trigger API that acts as a proxy and forwards the data to your Automation server
running behind a firewall. This trigger allows cloud-to-cloud connectivity. You do not have to open
8
any ports on the computer with Automation or the company’s firewall.
NOTE: You need a NiceLabel Cloud subscription to use this trigger type.
4. Label Catalog Async Updates. This trigger is available in the configuration variant for NiceLabel LMS
Enterprise only. This trigger help to generate a list of labels from the NiceLabel Document
Management System.
o The configuration variant for NiceLabel Cloud uses internal Document API to generate the
catalog and does not need this trigger.
NOTE: If necessary, you can change the port numbers on which the Automation triggers respond. Open the configuration
in Automation Builder and edit it.
Label design
Use NiceLabel Designer to create and maintain labels. NiceLabel Designer runs in a Microsoft Windows
environment. This is a graphical designer with an intuitive user interface that business users themselves can
use to create dynamic labels. When you create a dynamic label, you configure label objects to receive data
from data sources called “variables”. When ABAP Package sends the SAP data for printing into NiceLabel
Automation, that data will be saved in the variables and printed on a label.
When you open a sample label template label.nlbl (provided with the ABAP Package) in NiceLabel
Designer, you can see the label contains variables, such as FIELD1, FIELD2, FIELD3, etc. These variables are
linked with some of the label objects and provide values for those objects at print time.
9
Variables must have the same names as the data fields in the SAP application from which you execute label
printing. You can create variables on the label manually, you can import variables from existing labels, or you
can import variables from other supported data files (such as XML).
The ABAP Package contains sample labels for some SAP standard transactions (such as VL02N). The
sample labels already contain all variables that exist in the associated transaction. You can immediately use
the variables as data sources for your label objects. You can also import these pre-defined data sources into
other labels.
For example, the DeliveryNote.nlbl label contains all variables from the outbound deliveries transaction
(VL02N). There is a prefix “VBDPL” defined for each variable, as used in SAP.
10
Label print and data mapping
If you do not provide any value to label variables, the sample label template label.nlbl prints like the
following.
1. All dynamic label objects that expect to receive some data input are empty as no value has been
provided for them.
2. Only static label objects get printed.
To print data on a label, you must send data (name-value pairs) from SAP into the ABAP Package.
11
When ABAP Package receives data (name-value pairs) from the SAP application, it encapsulates them in
XML and sends them into NiceLabel Automation for processing. The name-value pairs are saved in the
“Data” element in the XML message. NiceLabel Automation extracts all name-value pairs and sends them to
the label.
NOTE: For more information about the XML structure and data exchange between ABAP Package and
NiceLabel Automation, see the chapter Data exchange on page 86.
For example, if you provide the following data into the demo transaction: 2
Provided values have been assigned to the label variables on the same name and then used with the label
objects.
2
Learn more about how to use demo transaction in the chapter Configuring NiceLabel ABAP Package on page
23.
12
Setting up the integration
Deploying NiceLabel Automation
The ABAP Package ships with pre-configured NiceLabel Automation. To deploy the configuration, you must
load the configuration into NiceLabel Automation Manager, start the triggers and reconfigure Windows
Firewall to allow inbound connections on ports associated with the configuration.
NiceLabel Automation comes pre-build with two different configurations. Make sure to load and activate the
one that matches your NiceLabel product.
Deploying triggers
Do the following:
1. Go to the computer, where you have installed NiceLabel Automation.
2. Make sure you have activated the NiceLabel software.
13
3. Save all NiceLabel Automation files to a folder. You must copy all files from the Automation
Configuration folder in a ZIP file. Use the Automation folder that matches your NiceLabel product
(NiceLabel Cloud or NiceLabel LMS).
4. Run NiceLabel Automation Manager application.
5. In the Triggers tab, click the +Add button.
6. In the Open window, browse to your .MISX file and click Open.
Automation Manager loads the configuration and lists the triggers in the right-hand pane.
7. Select all triggers and click Start on any of the triggers. All triggers will start. Triggers’ icons turn into
a green color and the status change to “Running”.
NOTE: NiceLabel software must be activated or running in a trial mode to be able to start the triggers.
NOTE: You do not have to open any port if you plan to run the Cloud trigger.
14
8. On the Profile page, choose the profiles, and click Next.
9. On the Name page, type a name for the rule, and click Finish.
If necessary, SSL/TLS can be enabled by reconfiguring the provided Automation configuration. For more
information about how to configure Automation, see the chapter Using Secure Transport Layer (HTTPS).
You need a subscription key to consume APIs available with NiceLabel Cloud Business (or above) products.
A subscription key is used for authentication in the NiceLabel software. NiceLabel Cloud runs on multi-tenant
software architecture. The endpoints in NiceLabel Cloud APIs are the same for all NiceLabel customers. The
subscription key tells the customers apart.
The detailed guide to complete the above steps are provided in the chapter Cloud integrations in the Control
Center user guide.
15
When the above two Custom IDs exist in the configuration table, the ABAP Package will always include them
in the request to NiceLabel Automation in two places:
• In the custom HTTP headers of the HTTP request. These are authentication requirements so that
the ABAP Package can deliver data into Cloud trigger published in NiceLabel Automation.
• Inside the <Header/> element in the XML payload. These are authentication requirements for
Automation to use NiceLabel Cloud APIs (to generate the label catalog, to get a list of cloud-
connected printers, and to print labels to cloud-connected printers).
1. Copy the NiceLabel transport package files into the appropriate folder on your SAP system.
a. The R*.ECC file goes into /usr/sap/trans/data folder.
b. The K*.ECC file goes into /usr/sap/trans/cofiles folder.
2. In SAP GUI, run the transaction STMS.
3. Click Import Overview .
4. Double-click the import queue of the target system (ECC in the example below).
16
6. Enter the Transp. Request number.
You can click the Search Help and search for the transport request in the list.
7. Click Continue .
The Add Transport Request window opens.
8. Click Yes.
17
10. Click Import Request .
The Import Transport Request window opens.
18
14. Click Yes to confirm the import.
In the Import Transport Request window, go to the Options tab and make sure the option Overwrite
Originals is selected.
NOTE: If you are importing the transport request on the SAP S/4HANA system, also enable the option Ignore Invalid
Component Version.
19
Incompatibilities between versions
V2
• Location of the constants. In V1, the constants were saved in the /NICELAB/CL_INTERFACE_ROOT
class. In V2, constants were moved to public interface /NICELAB/CL_IF_UTIL. If you reference the
constants in your custom classes where you use the ABAP Package, you will have to update the
custom code to point to /NICELAB/CL_IF_UTIL.
V3
• Recreating logical ports for Web Service consumer proxy. In V3, ABAP Package uses a new
consumer proxy. You have to recreate the logical port when you use Web Service communication.
V4
• Support for multi-server landscape. ABAP Package V4 supports multiple Automation endpoints, not
just one. The process configuration (business rules) table (/NICELAB/V_IF_PR, also accessible via
tcode /NICELAB/IF_PROC) is expanded to support the endpoint configuration. Each item in the table
also defined the field OperMode, where you define the type of the endpoint, and the field Endpoint ID,
where you define the name of the endpoint. For example, the OperMode HTTP Request and Endpoint
ID EMEA would send a request to Automation using outbound RFC call to an RFC destination EMEA
(as defined in tcode SM59).
When you upgrade to ABAP Package V4 your existing process configuration table will be expanded
with new fields. The values for the new fields will be taken from your existing interface configuration
(tcode /NICELAB/IF_CTRL), so there should be no upgrade issues.
20
The print programs provided with the ABAP Package have also been updated to support the new
process configuration table (/NICELAB/OUTPUT_PROCESSING and /NICELAB/PSFC_OBJECT_LIST).
• Label catalog generation. When you have a NiceLabel Cloud product, Automation uses Document
API to create a label catalog, not the command-line utility as in previous versions. The Document API
provides a faster and synchronous response. To use the Document API, you have to provide the
subscription key in your payload. Automation will use if for authentication when accessing the
Document API. For more information, see the chapter Requesting label catalog for NiceLabel Cloud.
• The content of Revisions fields in the label catalog. In V4, Automation will return the version number
of the last revision of the label template. The field will contain a single value, no longer all available
versions. The returned version number depends on the access role to which the user running the
Automation server belongs.
The logical port defines the transport parameters for reaching NiceLabel Automation. The two most
important parameters are the computer name and port number. If you want to use a Web Service destination,
you must define at least one logical port.
21
4. In Search Pattern, enter the name of the consumer proxy as provided by the NiceLabel ABAP
Package. Enter /NICELAB/CO_NICELABEL_OUT and click Go.
5. Select the /NICELAB/CO_NICELABEL_OUT entry in the search results and click Apply Selection.
The consumer proxy details are displayed.
6. Go to the Configurations tab and click Create.
22
In this example, NiceLabel Automation is installed on the Windows server with name automation.
The Web Service trigger has been configured on port 50000.
11. You can also import the WSDL from a file. Initially, you must use a web browser to open the URL to
NiceLabel Automation, load the WSDL from it and save the content to a file.
Replace the name <automation> with the name of the Windows computer, where you have
installed NiceLabel Automation.
b. Right-click the content in the browser and select Save As. Save the WSDL content to file on
local disk.
In SOA Management, select Via file, then click Browse and select the WSDL file you have just saved.
NOTE: When you click the Apply Settings button to apply the WSDL file, you must have the communication path
to NiceLabel Automation open, or SOAMANAGER will report a problem “Error in WSDL parsing: Exception
occurred in library handler”.
23
12. Click Apply Settings.
The additional logical port configuration appears.
13. Review the parameters. Normally, you do not need to change anything.
14. Click Save.
Web service ping failed (RC=400). Service Ping ERROR: Bad Request
This tells you the message was successfully sent to the Web Service in NiceLabel Automation, just
the request was not formed in the structure as expected by NiceLabel Automation.
5. If you see the following message:
SRT Framework exception: Service Ping ERROR: Error when calling SOAP Runtime functions: SRT:
Processing error in Internet Communication Framework: ("ICF Error when receiving the response:
ICM_HTTP_CONNECTION_FAILED")
it tells you that the connection to the Web Service in NiceLabel Automation is not possible. You will
have to resolve the problem.
Verify the following problems:
a. The triggers in NiceLabel Automation are not started.
b. Communication to NiceLabel Automation is not possible. Verify the firewall settings on the
computer with NiceLabel Automation to allow inbound connectivity.
For more information, see Configuring Windows Firewall on page 14.
c. Is there a system-wide policy applied to the SAP server to prevent outbound connectivity to
non-authorized destinations?
In this scenario, SAP can communicate directly with the NiceLabel Automation. Both are running in the same
network and connection to the Automation’s IP address and configured port number is possible.
24
Configuring destination
To configure the HTTP (RFC) destination, do the following:
2. Click Create .
25
3. In RFC Destination, enter the name of your destination. Use a descriptive name that will later be used
to reference the target NiceLabel Automation server.
4. For Connection Type, select G. This is the HTTP Connection to External Server.
5. In the Description section, enter a comment to describe what this destination will be used for.
6. Go to the Technical Settings tab.
7. In the Target Host, enter the host name of the server with installed NiceLabel Automation.
8. In the Service No., enter the port number, on which the HTTP trigger has been configured in
NiceLabel Automation. The configuration provided with ABAP Package defines the HTTP trigger on
port 50001.
9. In Path Prefix, enter the path, on which the HTTP trigger has been configured in NiceLabel
Automation. The configuration provided with ABAP Package uses a root path (/).
If you need to update the existing HTTP (RFC) destination, run the transaction SM59 again, select your RFC
destination in the HTTP Connections to External Server list and click Change .
26
while executing the filter "XML". Cannot load the XML file <…>”! Error in XML format. System error
message: Root element is missing.
6. This is perfectly OK, even if you have not received status 200 and text OK.
You have received a response from Automation, although an erroneous one. SAP connection test
does not contain any valid data that Automation trigger can recognize, therefore Automation
responds with an error.
This response is proof that the RFC type G (HTTP) destination is configured correctly and you can
send data to NiceLabel Automation.
The necessary configuration step involves defining the HTTP destination to which the NiceLabel ABAP
Package sends the request to NiceLabel Automation. The most important parameters are target host
(computer name), service number (port number), and path prefix.
In this scenario, SAP cannot communicate directly with the NiceLabel Automation. A typical scenario might
be SAP S/4 HANA (on-premise variant) running in the hosted virtual environment without a VPN connection
down to your location. NiceLabel Automation is installed on-premise and has a connection to the label
printers, but SAP cannot send messages to it directly.
Cloud trigger acts as a proxy in NiceLabel Cloud. On one hand, NiceLabel Automation establishes an
outbound connection towards NiceLabel Cloud, on the other hand, SAP sends the message into the
NiceLabel Cloud API. The message is then forwarded down to NiceLabel Automation for processing.
27
Configuring destination
To configure the HTTP (RFC) destination for Cloud trigger, do the following:
2. Click Create .
3. In RFC Destination, enter the name of your destination. Use a descriptive name that will later be used
to reference the target NiceLabel Automation server.
28
4. For Connection Type, select G. This is the HTTP Connection to External Server.
5. In the Description section, enter a comment to describe what this destination will be used for.
6. Go to the Technical Settings tab.
7. In the Target Host, enter “labelcloudapi.onnicelabel.com“.
8. In the Service No., enter “443“.
9. In the Path Prefix, enter “/api/CloudTrigger/SapNiceLabelApi“.
10. Go to Logon & Security tab.
11. In Security Options, select Active for SSL.
If you need to update the existing HTTP (RFC) destination, run the transaction SM59 again, select your RFC
destination in the HTTP Connections to External Server list and click Change .
The next step is to configure the custom HTTP headers that must be included with each HTTP call to the
Cloud trigger. The headers are configured with the following Custom IDs in the configuration table:
1. API-VERSION
2. OCP-APIM-SUBSCRIPTION-KEY
For more information on how to obtain your subscription key and configure it for the ABAP Package, see the
following:
1. The chapter Generating a subscription key to consume NiceLabel Cloud APIs in this document.
2. The chapter Configuring system-wide defaults in this document.
3. The chapter Cloud integrations in the NiceLabel Control Center user guide.
4. The chapter Cloud trigger in the NiceLabel Automation user guide.
29
Configuring NiceLabel ABAP Package
When using the ABAP Package to send label printing requests to NiceLabel Automation, you must provide
the mandatory parameters with each request. Typically, these parameters are label name, printer name, label
object values, destination at which NiceLabel Automation listens for requests, etc.
Some parameters, for example, label object values, are unique for each request. You must send unique
parameters with each request. On the other hand, some parameters are the same for each request. An
example of such a static parameter is the NiceLabel Automation destination (Web Service or HTTP request).
You can save these static parameters in a configuration table. If the requests from your SAP application do
not provide any values for static parameters, the ABAP Package uses the default values from your
configuration table.
NOTE: This is an optional configuration. You do not have to use this table. The table can remain empty if you intend to
provide the required parameters with each request.
3. To set the defaults, click Display -> Change button , make changes, and click Save .
30
The following configurable parameters (Config ID) are available:
CONFIG ID DESCRIPTION
OPERATION_MODE Defines the default communication mode towards NiceLabel Automation.
Possible values are SOA (to use Web Service communication) or HTTP (to
use RFC type G communication).
SOA_LP Defines the default logical port for the SOA (Web Service) call. Type the name
of the logical port you have previously defined in the transaction
SOAMANAGER.
HTTP_RFC Defines the default RFC type G (HTTP) destination. Type the name of the
HTTP Connection to the External Server (type G) that you have previously
defined in the transaction SM59.
API-VERSION Defines the Cloud trigger API version. This is sent as a custom header in the
HTTP call to Cloud trigger API.
OCP-APIM- Defines the Cloud trigger subscription key. The key authorizes SAP to
SUBSCRIPTION-KEY execute the HTTP call to the Cloud trigger. You need this key to:
• Get a list of available cloud-connected printer
• Print to cloud-connected printers
• Get a list of label templates from the DMS.
Obtaining this key is self-service action in the management of your NiceLabel
Cloud subscription (see a chapter Generating a subscription key to consume
NiceLabel Cloud APIs).
PRINTER_STATUS Specifies if ABAP Package should send the request for the printer live status
or not. Possible values are True or False.
WRITE_SPOOL Specifies if ABAP Package logs the communication details received from
NiceLabel Automation in the SAP Spooler. The possible values are True or
False.
CATALOG_ROOT Defines the folder in your DMS which contains labels and subfolders with
labels. If no value is provided, the catalog will be created from the root folder
in the DMS.
DATA_MODEL Specifies if ABAP Package should send the request for the data model file
(Field Catalog). Possible values are True or False. Use this while you design
the label templates in DEV. You only need to execute it once per a different
Field Catalog. Do not enable it on PROD, you don’t need this functionality in
production.
The print programs for supported standard SAP transactions that come with ABAP Package also use the
defaults from this configuration table. For more information about the supported standard transactions and
provided print programs, see chapter Configuring transaction to call ABAP Package on page 70.
The purpose of the configuration table is to simplify the label printing process. Because of the configuration
table, users do not need to know the exact names of certain technical parameters, such as label or printer
names used on the NiceLabel Automation server.
31
If the calling application does not provide specific parameters, ABAP Package uses the values for those
specific fields from the configuration table (provided that the default value is configured).
The currently supported parameters per process are label name, printer name, and label preview. These
options can be defined per user. In this case, each user can print to his printer without affecting the system
for other users. The alternative option is to define these options as a system-wide default for all users.
NOTE: When you define the username as an asterisk “*” the ABAP Package applies the settings for all SAP users without
individually defined defaults.
The instructions below provide an example configuration for the outbound delivery process (transaction
VL02). In this configuration, the processing of output triggers the label print:
NOTE: You can also run a transaction /NICELAB/IF_PROC to open the table view.
2. Click Display.
The NiceLabel Interface: Integrated Process Configuration details window appears. By default, the
table is empty.
32
j. For Report style, enable the feature if you want to print items in a report-style document (A4
or Letter page size). In this case, ABAP Package encapsulates the iterable data for the
report. In most cases, you will have this field set to False.
In the above example, when ABAP Package receives the label printing request from Outbound Delivery
(tcode VL02N) for any user and the selected Output Type is ZNLA, the label DeliveryNote.nlbl prints to
printer Zebra_ZD420-300dpi_ZPL_Saso. Because Report Style Print is false, each item from the delivery will
print on a separate label (you will receive as many labels as there are items in a delivery). The print request is
sent as RFC request (HTTP Request) to RFC destination EMEA (as defined in tcode SM59).
In the above example, the criteria to pick up default print settings are a transaction (process), key 1, and
user. If you need additional criteria (like document type, company code, plant, etc.) you can use the
remaining generic Key field (Key2) also available in the table, to maintain the configuration. However, if you
decide to use additional Key fields, you also must adapt your ABAP coding to check for the generic key
columns.
The configuration table is used in the print programs delivered with the ABAP Package. You can also use the
table for the print programs you have developed yourself for other transactions.
The table contains business rules configured for label printing from SAP transactions. ABAP Package uses
this table to apply rules in the print programs provided with the ABAP Package for the supported
transactions.
33
You can also use this table to configure print rules from your custom print programs.
34
Enabling enhancement spots
For more information about what are enhancement spots, see chapter Enhancement spots on page 70.
Configuration table for enhancement spots is a part of the ABAP Package. Use this table to enable
enhancement spots for the supported standard SAP applications.
When enhancement spots are enabled and users produce standard outputs in SAP, the enhancement spots
execute a code to seamlessly send the transaction data and commands into ABAP Package. The NiceLabel
Automation backend prints the transaction data on the associated label.
ABAP Package also transports the output devices that are associated with entries in SAP Spooler after
enabling the Write to Spool functionality. For more information see the Logging data to SAP Spooler (SP01)
chapter on page 60.
Each SAP Spooler entry is associated with an output device. ABAP Package transports two output devices:
35
• NiceLabel Request To Spool (NLRS). Most entries are associated with this output device.
• NiceLabel Raw Printer (NLBN). This output device is used for entries that store the binary print job.
After you transport the ABAP Package, the new output devices are in a locked state.
Repeat the above steps also for the output device NiceLabel Raw Printer.
Configuring SAP PI
To configure SAP PI to accept messages from the ABAP Package and communicate them with the endpoint
in NiceLabel Automation, do the following:
1. Log on to your SAP NetWeaver – Process Integration console.
2. Run Integration Builder.
3. In the Tools menu, select Import Design Objects.
36
Click Client.
Browse for the file NICELABEL_1.0_of_nicelabel.com.tpz included in the ABAP Package bundle. See
the folder \Integrations\PI-PO Configuration.
Click Import.
37
4. The next step is creating a new Business Component for your NiceLabel target system.
Click New.
In Create Object window, select Business Component. For Communication Component, enter
“NICELABEL”. You can leave Inbound Interfaces and Communication Channels empty.
Save the component.
6. For the Name of the ES Repository Model Reference, browse for the NiceLabel scenario.
38
7. Click Create button to generate the Configuration Scenario.
39
9. Select Sender Template.
For Communication Component in Business System Component for A2A, select the sender SAP
system. This is a source SAP system that has installed the ABAP Package and will send data into
the PI.
40
In the list of Communication Components, select NICELABEL. This is the business component you
created earlier in these instructions.
Click Apply.
41
11. Click on the arrow between SendTrigger and ReceivedTrigger objects to display the Communication
Channel fields.
13. In the Select Object window, select the existing Communication Channel already defined in the
source ERP system. If you have PI implemented, this Communication Channel already exists.
42
Click Apply.
14. In Receiver Business System Components, select the Communication Channel.
43
Click Continue through the Create Communication Channel steps.
Click Finish.
44
After the objects have been created, close the summary screen.
Make sure to include the trailing slash character (/) in the Target URL.
45
Close the Edit Communication Channel window.
21. Click Change Lists tab to display the list of changed objects.
Right-click the Standard change list item and select Activate.
Click Close.
Your PI/PO is now ready for ABAP Package to send data into it.
If you would like to use communication via SAP PI, then it is enough to not specify the default logical port
before calling the web service (leave it empty).
• When a logical port is set, the system reads endpoint information from a logical port configuration
that you defined in SOAMANAGER.
• When no logical port is set, the business system agreement configuration is looked up in your PI
system.
46
Support for Cloud Platform Integration (CPI)
To configure SAP CPI to accept messages from the ABAP Package and communicate them with the
endpoint in NiceLabel Automation, complete steps in the following chapters.
47
10. Select the NiceLabel Package you just imported.
13. In the NiceLabel Integration Flow line, click the Actions button and select Deploy.
14. Wait until the artifacts are deployed. This might take several minutes.
NOTE: You can track the deployment status in Eye icon>Manage Integration Content>All.
15. In the left-hand pane, click the Eye icon.
16. In Manage Integration Content, click on All tile.
17. Select NiceLabel Integration Flow and click the Endpoints tab.
Here is where you can see the endpoint URL that you have to consume from the ABAP Package.
Here is also where you can download the WSDL.
18. Click the download icon next to WSDL without policies to download the WSDL. You will need it later
in tcode SOAMANAGER to configure the Logical Port.
NOTE: A copy of the WSDL file is also included in the ABAP Package bundle. See the folder
\Integrations\CPI Configuration.
48
Configuring access permissions
1. Log on to your SAP BTP Cockpit.
2. Click the subaccount, where you would like to configure printing through NiceLabel.
3. To configure access permissions, do the following:
4. In the left-hand pane, expand the Security node and select Role Collection.
5. Click the + button to create a new Role Collection.
6. For Name, type “NiceLabel_MessageSend”.
7. For Description, type “Allows users to send messages into CPI”.
49
1. In SAP GUI, run the transaction SOAMANAGER.
The SOA Management opens in the browser.
2. In the Service Administration tab, click Web Service Configuration.
50
6. In the Configurations tab, click Create.
In the drop-down, select WSDL Based Configuration.
7. In the Logical Port Name step, enter the name that identifies this logical port.
8. In the Description field, enter the text that describes the logical port.
9. Click Next.
10. In the WSDL Information step, select Via File and click Browse. Then browse for the WSDL file you
downloaded from the BTP cockpit. You can also use the WSDL file provided in the ABAP Package
51
bundle (see folder \Integrations\CPI Configuration).
52
Using ABAP Package features
Configuring the demo transaction
NiceLabel ABAP Package includes a demo transaction developed in ABAP that demonstrates the practical
use of the API. The demo transaction provides a user interface for testing the underlying API. The demo
transaction collects the provided data and sends it to ABAP Package. ABAP Package encapsulates data in
XML message and sends it to NiceLabel Automation for processing.
Before you can run the demo transaction, you must configure it. The demo transaction reads the
communication method (SOA or RFC) and the destination name (logical port or HTTP destination) from the
configuration table.
The responses for label catalog or printer names calls are cached. To force a call for label catalog or printer
names, use the appropriate button in the demo transaction (Get Printer, Get Label Catalog).
NOTE: The prerequisite for running the demo transaction is an already deployed configuration in NiceLabel Automation
Manager.
53
1. In SAP GUI, run the transaction /n/NICELAB/IF_DEMO.
The Testing connectivity to NiceLabel integration service transaction appears.
2. Enable Display Request if you want to display the generated XML payload on the screen instead of
sending it to NiceLabel Automation. You would use this option to analyze the data in the composed
XML message.
3. Enable Display Response to display the status feedback from NiceLabel Automation. If any errors
occur during processing, NiceLabel Automation returns a detailed error message, and the demo
program displays it on-screen. Make sure this option is always enabled.
4. Enable Write Spool to log all messages to/from NiceLabel Automation in SAP Spooler (tcode SP01).
Each request to NiceLabel Automation and all responses from NiceLabel Automation are logged in
SAP Spooler.
5. In API Operation mode, select the transport method you want to use for communication with
NiceLabel Automation.
a. SOA. Select this option if you want to send the data into Web Service trigger in NiceLabel
Automation. Click Browse and select the logical port you have defined earlier in the topic
Configuring SOA (Web Service) destination on page 21.
This operation mode is also used when sending print requests through SAP PI/PO or SAP
CPI infrastructures.
b. HTTP. Select this option if you want to send the data to the HTTP trigger in NiceLabel
Automation. Click Browse and select the RFC Destination you have defined earlier in
topic Configuring HTTP (RFC) destination on page 24.
6. In the Request Header section, the following parameters are configurable.
a. Print. Enable this option to print labels.
b. Preview. Enable this option to generate and display label previews in SAP GUI.
c. Print job. Enable this option to generate and save print jobs in SAP Spooler. Make sure you
enable the Write to spool option. Print jobs contain the printing instructions for the selected
printer models. These instructions are printer commands for the target printer (Zebra
Programming Language “ZPL” for Zebra printers, SATO Programming Language “SPL” for
54
SATO printers, etc.) You can send print jobs from SAP Spooler to the printer (passthrough
mode).
d. Printer Status. Enable this option to display information about the live printer status.
You can combine the flags Print, Preview, and Printer Status within the same request. NiceLabel
Automation executes all received methods.
e. Label Name. Specifies the file name of the label template to print. Make sure the label name
contains the extension (.NLBL) as well. You can click the Search Help button next to the
FORMAT edit field to display the label catalog (list of all labels in your DMS). Click the Get
Label Catalog button to retrieve the list of labels first.
NOTE: For NiceLabel Cloud products, the label catalog is created synchronously. For on-premise
NiceLabel LMS, the label catalog is created asynchronously in the background. It might take a while to
become available (several minutes). This depends on the number of labels. Until the label catalog is
ready, you receive an empty list.
For a quick test, you can use the included sample label file, label.nlbl. If copied the label
template in the same folder with your Automation configuration (.MISX file), you can
reference the label by its filename. If you have copied the label template to some other
folder, include a full path to the file.
For more information about using the file names, see chapter Providing a label name on
page 63.
f. Response format. Specifies the format of the label preview. You can choose between PDF,
PNG, and JPEG.
g. Quantity. Specifies the number of label copies to print.
h. Printer Name. Specifies the name of Windows printer driver on the server, on which
NiceLabel Automation runs. You can click the Search Help button next to the
PRINTER_NAME field to display the list of printers. The request for the printer list goes to
Automation.
NOTE: This is not the SAP printer name. This is the Windows name of the printer driver installed on a
computer with NiceLabel Automation.
i. Job Name. Specifies the name of the print job as displayed in the Windows Spooler. This is
an optional parameter. By default, the job name is the same as the label name. Use this
option to rename the print job.
j. User. Specifies the user name that requests the printing. This is an optional parameter and
is currently not in use in the Automation configuration. You might use it to provide the
information to the label.
k. System. Specifies the SAP system information. This is an optional parameter and is
currently not in use in the Automation configuration. You might use it to provide the
information to the label.
7. The table at the bottom of the transaction displays the list of variables defined in the selected label.
Each time you select a new label, the values for the variables are taken from the label. You can
accept the suggested default values for variables or enter your own. You can also add your variables
(rows). NiceLabel Automation does not impose any limitation on the number of name-value pairs
you want to use.
8. When ready, click Send Request (or press F8).
55
Requesting a list of printers
To request a list of printers available for label printing, ABAP Package must set the <PRINTERS /> XML
element to True. The returned list contains printer names that NiceLabel Automation can use for label
printing. These can be local printers with drivers installed on Automation’s computer, or cloud-connected
printers.
When you request a list of printers, the ABAP Package stores it in the table /NICELAB/IF_PRNT. The table
contains the combination of printer name and identifier of the Automation server, so ABAP Package knows
which printers are available from each Automation server. The “identifier” is a combination of two fields: (1)
a type of the Automation endpoint (e.g. “Web Service”, “HTTP Request”) and name of the endpoint (e.g.
name of the Logical Port or RFC destination). Each printer in the list is also identified as the local printer
(installed on the same computer with Automation) or the cloud-connected printer.
The printer name is encoded in the <PRINTERNAME/> element inside the XML header. When you select a
particular printer, ABAP Package lets NiceLabel Automation know if it is a local or cloud printer, so NiceLabel
Automation will process the request correctly. For cloud printers, the additional flag <CLOUD_PRINT/> in the
header is set to True.
• Local and Cloud printers. With your NiceLabel Cloud subscription, you also get access to using
cloud-connected printers. In this case, the printer is registered with the NiceLabel Cloud and accepts
print jobs directly from the NiceLabel Cloud (not from Automation). You do not have to install the
printer drivers for cloud-connected printers.
For XML structure of the response, see chapter Structure of <PrinterList /> on page 91.
NOTE: A response will contain a list of all local printers that are installed on a computer with Automation. However, all
these printers might not be accessible by Automation, dependent on how you configured printer access in Control
Center.
56
Printing a label or report
To print a label or report to local printers, the <Header/> element must contain the following:
The label and printer determination must be done within SAP. Automation requires the exact label template
name as available from the Document Management System and exact Windows printer name as available
on the computer, where Automation is installed, or exact cloud printer name. If required, the label and printer
determination can be performed in NiceLabel Automation as well but is subject to additional configuration.
Automation automatically identifies whether the data in XML is provided for label or report printing. You
must make sure to provide the appropriate label or report template in the <FORMAT/> element. Names of
SAP data sources must match the names of data sources defined in a label or report template to ensure
proper value mapping. For example, when you have a field MATNR in an SAP transaction, the label template
must contain a variable of the same name.
You can use Automation to generate data model files to help you create data sources in the label or report
templates. For details, see Generating a field catalog chapter on page 66.
For XML structure of the response, see chapter Structure of <PrinterList /> on page 91.
You can provide several <Data/> elements, each providing data for a new label or report, but using the same
label template and printer name as provided in the <Header/> element.
You can override the print settings for each <Data/> element if you want to print data using a different label
template on a different printer, but all within one request from ABAP Package to NiceLabel Automation.
You have to provide the data for label template name, printer name, or quantity inside each <Data/> element
like this:
• For label template name use variable _FORMAT
• For printer name use variable _PRINTERNAME
• For quantity use variable _QUANTITY
NOTE: When you decide to use data override in <Data/> elements, you have to use the override in all <Data/> elements.
<?xml version="1.0"?>
<LABELS>
<Header>
<FORMAT>label.nlbl</FORMAT>
<QUANTITY>1</QUANTITY>
57
<PRINTERNAME>ZEBRA R-402</PRINTERNAME>
<PRINT>True</PRINT>
</Header>
<Data>
<Item Id="_FORMAT">label1.nlbl</Item>
<Item Id="FIELD1">NiceLabel</Item>
<Item Id="FIELD2">DEMO</Item>
<Item Id="FIELD3">12345</Item>
<Item Id="FIELD4">www.nicelabel.com</Item>
<Item Id="FIELD5">123456789012</Item>
</Data>
<Data>
<Item Id="_FORMAT">label2.nlbl</Item>
<Item Id="FIELD1">NiceLabel</Item>
<Item Id="FIELD2">DEMO</Item>
<Item Id="FIELD3">12345</Item>
<Item Id="FIELD4">www.nicelabel.com</Item>
<Item Id="FIELD5">123456789012</Item>
</Data>
</LABELS>
In the example above, the XML payload provides two <Data/> segments. Data from the first segment will
print on label template label1.nlbl. Data from the second segment will print on label template
label2.nlbl.
You can use similar overrides for all fields available within the <Header/> element by prefixing underscore to
the field name, e.g. FORMAT -> _FORMAT.
ABAP Package can print labels to cloud-connected printers. These are printers that reside on-premise, but
have internet connectivity and are registered with your NiceLabel Cloud subscription. When you switch them
on, they establish a connection with NiceLabel Cloud and keep it open. NiceLabel Cloud API can deliver print
jobs (e.g. ZPL content for Zebra printers) directly to a printer. You do not need any on-prem printer driver
installed.
NiceLabel Automation is pre-configured to receive the information for your cloud printers from ABAP
Package and can send label print request to the NiceLabel Cloud API, which in turn prints the label.
58
<CLOUD_PRINT> with value True in the <Header/> element, which notifies Automation to use Cloud
Print API. You also have to set the main printing flag <PRINT> to True.
• Optional. You can specify the label template version with <CLOUD_LABELVERSION/> element. If
omitted, the last published version is used.
For XML structure of the response, see chapter Structure of <PrinterList /> on page 91.
The “printer settings” are settings in the printer driver that define details for the printout, such as to use
thermal printing mode or direct printing mode, details for the printer sensors, offsets, and similar.
When designing a label template in NiceLabel software, you can store printer settings in various places (e.g.
hardcode it in the label templates itself, recall it from the printer driver, rely on the settings as configured in
the printer, etc.)
When you do not specify <PRINTERSETTINGS/> value, NiceLabel Automation will use the printer setting as
configured with the label template / selected printer. When you include <PRINTERSETTINGS/> the current
printer settings will be overridden with provided settings. This is a useful option to fine-tune printout for
cloud-connected printers, where there are no printer drivers to configure, but also works for local printers.
The DEVMODE is the entire printer driver structure. To extract the settings and base64-encode them, you can
use NiceLabel Designer to create such an application. You would use the built-in action Set Print Parameter.
59
Furthermore, when you select the status of a cloud-connected printer, ABAP Package includes these
additional fields in the <Header/> element:
• <CLOUD_PRINT/> with value True.
• <CLOUD_APIKEY> with the value of OCP-APIM-SUBSCRIPTION-KEY configurable item from
/NICELAB/IF_CTRL table.
• <CLOUD_APIVERSION> with the value of API-VERSION configurable item from /NICELAB/IF_CTRL
table.
Automation will check the printer status and return it in a synchronous response.
For details of exchanged data structures, see Data exchange on page 86.
This functionality allows for complete tracking of NiceLabel execution inside the SAP system. Each
outbound request sent to NiceLabel Automation and each inbound response coming from NiceLabel
Automation are stored as items with a unique Spool number.
The function that updates the event data in SP01 is available as /NICELAB/IF_RW_SPOOLJOB_PARAMS and
is developed from the SAP standard function RSPO_RW_SPOOLJOB_PARAMS.
In the example below, there is a log of two requests sent to NiceLabel Automation. The first one at 13:05 and
the second at 13:19. You can see all data that was sent out. The item with Spool id 532065 contains the
outbound message, displayed as parsed XML at the beginning and the raw data below.
Figure 2: Each method executed in NiceLabel Automation is logged with a unique Spool id
60
Figure 3: Details for the outbound message to NiceLabel Automation
Each log also contains the endpoint type and name for you to see to which destination (NiceLabel
Automation server) the request has been sent. For example, endpoint type HTTP Request and endpoint
name EMEA identify the request as RFC call to RFC destination configured as “EMEA” (in tcode SM59).
The second request (from 13:19) failed. The outbound request was sent to NiceLabel Automation, but there
was an error while processing the data. Details in NiceLabel Response (Spool id 532070) reveal that the
label name was not found in your DMS. Whenever there is a data processing issue in NiceLabel Automation,
the details about the error return to SAP in a synchronous response.
61
You can execute more than just one method using a single request to NiceLabel Automation. For example,
you can execute label print and label preview methods using a single message sent to NiceLabel
Automation. “Label print” response logs under a unique Spool id. “Label preview” response also logs logged
under a unique Spool id. To keep the things organized and to ensure optimal user experience, all Spool items
from the same response are grouped into a composite document. This is a new Spool id that contains the
individual Spool ids. The composite document appears only when your request enables two or more
methods.
NOTE: You cannot combine the PRINT_JOB request with any other request. It must be used in the unique request.
In this example, the Spool id 532068 is a composite document containing all subitems that were returned in
the response from NiceLabel Automation.
Figure 4: All subitems from a single request to NiceLabel Automation are grouped together
The items in SAP Spooler are associated with the specific output device:
• If you request PRINT_JOB, the items are associated with the NiceLabel Raw Printer (NLBN) output
device.
• In all other cases, the items are associated with the NiceLabel Request to Spool (NLRS) output
device.
62
2. Find the print event you have executed through the ABAP Package.
5. Change the output device from NiceLabel Raw Printer to your label printer.
Prerequisites:
1. You must have the output device already created in tcode SPAD.
2. The selected output device must be compatible with the print job format you requested from
NiceLabel Automation. The printer model associated with the SAP output device must understand
the printer programming language provided in the binary print job from NiceLabel Automation.
label.nlbl
63
• Label name with the relative path. The root folder is the folder with the Automation configuration file
(.MISX).
..\DistributionLabels\Gen1\label.nlbl
• A full path to the label in DMS, including the server name. This syntax works for on-premise and
NiceLabel Cloud products.
https://myaccount.onnicelabel.com:8080/DistributionLabels/Gen1/label.nlbl
• A full path to the label in your DMS w/o the server name. This syntax works for on-premise and
NiceLabel Cloud products. The name must begin with the slash character (/), and the path must be
provided from the Control Center’s Documents root folder.
/DistributionLabels/Gen1/label.nlbl
Optionally, you can specify a starting folder for your label templates in the <CATALOG_ROOT /> XML
element. When no value is provided, Automation will create the catalog from the root folder in the DMS.
The demo transaction caches the received label catalog in the internal table.
The process to generate the label catalog in Automation is different depending on the NiceLabel product you
have.
For the response XML structure, see chapter Structure of <LabelCatalog /> on page 93.
Automation must receive a subscription key from the ABAP Package to successfully consume the Document
API. The subscription key is the authentication method to access the Document API. The demo transaction
will read the subscription key from the configuration table and include it inside the Header element of the
XML payload.
NOTE: The user account that you used to activate NiceLabel Automation must belong in the access role with the
permissions to read folders and label templates to generate the label catalog.
64
For more information, see the chapter Generating a subscription key to consume NiceLabel Cloud APIs in
this document.
When label catalog creation is in progress, a signal file LabelCatalogUpdateInProgress.txt is created in the
same folder with the Automation configuration. This file prevents simultaneous generation of label catalog
in an environment with multiple Automation servers. After the label catalog is generated, the signal file is
deleted.
NiceLabel Automation saves the label catalog as an XML file LabelCatalog.xml in the same folder with the
Automation configuration file.
The user account that you run your NiceLabel Automation service with must belong in the access role with
the permissions to read folders and label templates to generate the label catalog.
Requirements:
• The user that runs Automation Service must have the permission to write to the DMS folder where
Automation configuration is saved so that the signal file and label catalog file can be created in the
same folder.
• Do not check in a file LabelCatalog.xml , or NiceLabel Automation will not be able to update it.
You can change the location for the signal file (by default, Automation saves it in the same folder, where you
have stored the configuration file – MISX file):
1. Start NiceLabel Automation Builder.
2. Open the Automaton configuration (MISX file).
3. Edit the trigger Label Catalog Async Updater.
4. Select Variables tab.
5. Select signalFile variable.
6. Update the Default value to include the new path.
NiceLabel Automation reads the label variables and returns a list of variables with their properties. The list
contains the “prompted” variables. These are the variables for which you provide values at print time. For
example, “constants” or “database data sources” are not included in the list.
For the XML structure of the response, see chapter Structure of <LabelVariables /> on page 92.
65
Generating a field catalog
The XML payload generated in the ABAP Package contains name-value pairs for the data points in the
originating SAP transaction. These field names must have a matching counterpart in the label template. For
each field name that you want to print in the label template, you must define a variable in the label template
of the same name. NiceLabel Automation will then automatically map field values from XML payload to the
label variable of the same name.
NiceLabel Automation exposes functionality to generate a field catalog for you. All name-value pairs
provided in the XML payload are converted in the data file that a designer can import into the label template.
NiceLabel Automation can convert the name-value pairs from the XML payload into the following data
structures to save time manually defining variables in the label template:
1. NiceLabel “variable definition file” (file extension .NLVR). When you import .NLVR file in the label
template, all variables will be created automatically using the field names from the XML. The current
values of fields from XML are used as “provisional values” – these are values that NiceLabel
Designer will use during label design, but are not default values for printing. You can import variables
on the label template in Dynamic Data Manager.
2. NiceLabel “values file” (file extension. VALUES). You can browse for this file in the Print form when
testing your label in NiceLabel Designer. Values from this file are temporarily applied to label
66
variables so you can test their effect on the label template.
3. CSV file (file extension .CSV). This file is generated from a report section of the XML payload when
such a section is found in XML. The report section provides repeatable data for shipping documents,
like delivery notes, packing slips, invoices, and similar. The Report object requires a connection to a
database source while you design it. You can use generated CSV as a database source.
To request a variable definition file, ABAP Package must set the <DATAMODEL/> XML element to True.
All data files are stored in the same folder, where the NiceLabel Automation configuration file is stored.
Permanently
1. Start NiceLabel Automation Builder.
2. Open the Automaton configuration (MISX file).
3. Edit the trigger you use: “HTTP (RFC”, “Web Service (SOA)”, or “Cloud Trigger”.
4. Go to the Variables tab.
5. Edit variable _PATH_DATAFILES.
6. For its default value enter the folder name, where you want to save the data files:
a. c:\folder – the data files are saved in a folder “\folder” on a local drive C (on a computer
where Automation is installed)
b. /folder – the data files are saved in a folder “/folder” in the Document Management System
to which Automation is assigned. You can also prepend the server name but is not
necessary as Automation will add it on its own (e.g. https://server:8080/folder)
7. Save the configuration.
67
Support for label variants
ABAP Package can use NiceLabel's variant technology to prepare label variants for each label that is needed,
down to the SKU level without having to manually create hundreds or thousands of label variations.
A label variant is a label template (.NLBL file) that has the data sources hard-coded in and is locked from
editing. NiceLabel creates it out of the approved master label template and hard-codes the provided values
for the variables defined in the label template. Each label variant will store data for a particular SKU. You
cannot modify the label variant in NiceLabel Designer, the variant is not editable.
When creating label variants, you can choose to leave some of the variables unlocked. These are the data
sources, for which you do not know the values upfront, like Batch/LOT numbers, production dates, or best-
before dates.
To request the creation of label variants, ABAP Package must set the <VARIANTS/> XML element to True.
The names of variables that must remain unlocked in the generate variant file(s) are provided in
<VARIANTS_UNLOCKEDVARIABLES/> element as CSV list.
You can provide values for many variants in the same request to ABAP Package. Each <Data/> segment
provides data for one variant.
...
<VARIANTS>True</VARIANTS>
<VARIANTS_UNLOCKEDVARIABLES>Batch</VARIANTS_UNLOCKEDVARIABLES>
</Header>
<Data>
<Item Id="_VARIANT_FILENAME" Position="000000" Type="">/Production-
AS123/LabelVariants/3847638-234.nlbl</Item>
...
If required, the variant file name can also be auto-generated out of the other key-value pairs provided in the
<Data/> segment for each variant. In this case, you can modify the Automation configuration to add logic to
generating the variant file name. Add your actions inside the placeholder already reserved for such a case.
Open the Automation configuration and see the action “3.5.1.3.1.1.2.5.2 Custom variant name
(placeholder)”.
Exporting data
You can use the method EXPORT_DATA to run custom actions in Automation to save the data from SAP to
some intermediate database or other resources. Many SAP integration projects use the ABAP Package not
for label printing but for exporting the data out of SAP. The actual print is initiated from the custom form
application running in NiceLabel GUI.
68
In the previous versions of the ABAP Package, you had to change the Automation configuration of the
existing PRINT method to implement saving the data instead of printing. From this version, the method for
exporting data is built into the Automation configuration.
The Automation configuration has all the groundwork prepared. It contains the placeholder that will execute
when you set the <EXPORT_DATA /> XLM element to True. The placeholder comes without any defined
actions. You are free to add your custom actions and adapt the configuration to your specific need and
environment.
Communication extendibility
A lot of times the customers use the ABAP Package outside its intended usage. For example, they would use
it to export the data from SAP and not use printing functionality at all. Because you can freely modify the
Automation configuration it is fairly easy to extend it with new custom actions.
To help you with the modification even further, ABAP Package supports up to three custom XML fields in the
Header part of the XML message. You can use fields CUSTOM1, CUSTOM2, and CUSOTOM3 as Boolean
flags to run your action workflows. On the Automation side, the configuration contains the matching three
placeholders, where you would define your customs actions.
For example, when you set the value of the CUSTOM1 element to True, the actions in the matching
placeholder CUSTOM1 will execute.
The XML response coming from Automation back to the ABAP Package has also been expanded with new
custom fields (these are optional). You can include your custom messages in the feedback message if you
need to provide more data back to the ABAP Package. The ABAP Package will parse these custom
messages, if they exist, and make them available in your SAP transaction.
69
Configuring transaction to call ABAP
Package
When a specific event happens in the SAP transaction, and label printing is required, the transaction must
send the data into ABAP Package. NiceLabel ABAP Package uses the enhancement spots for supported
standard SAP transactions (e.g. outbound delivery) for which label printing is necessary. For these supported
transactions, label printing executes out-of-the-box. You do not have to code anything in your SAP system.
For details, see chapter Enhancement spots.
If you want to print labels from other transactions or as a part of specific events, you must configure SAP to
communicate with the ABAP Package by yourself. Depending on the requirement and the process, you can
use one of the following approaches to send the data from the SAP application to NiceLabel Automation
using the ABAP Package:
• User exit in SAP standard coding
• Business add-in (BAdI) / Enhancement
• Create document output and change the print program
• Custom ABAP program
If customers integrate label printing with the SAP standard process (for example upon creating a delivery
note), the preferred integration method is to use a custom output on the delivery object. The reason for this
is that such a method also supports execution logging to some extent and is straightforward to set it up.
If there is a requirement to implement label printing in a process during which a standard output is not
possible, consider the option for using a user-exit, BAdI, or enhancement spots.
Enhancement spots
Among the SAP software advantages is the possibility to adapt the software to your requirements, and the
possibility to keep the adaptations during the upgrade. Enhancement spots allow you to add custom
functionalities to the standard SAP programs.
ABAP Package extends the functionality of standard print programs. For example, when the user issues an
outbound delivery and prints or previews the standard form, at the same time the enhancement spot in ABAP
Package activates and sends the same data into NiceLabel Automation for processing. SAP prints the
standard form and NiceLabel Automation prints the labels.
Using the enhancement spots technology, NiceLabel ABAP Package provides no-coding out-of-the-box label
printing functionality to the supported standard SAP applications. The usage of enhancement spots can be
enabled or disabled in the configuration table (see chapter Enabling enhancement spots on page 35).
70
Example for outbound deliveries (VL02n)
When using the standard output approach, the standard print program (which normally delivers data into
SAP Spooler) must change in a way to deliver data into ABAP Package. First, you must make a copy of the
standard output print program that the current/default output type uses and modify it to communicate with
ABAP Package.
When done, you must create a new output type and use the updated print program with it. To print labels, a
user selects the new output type or configures the print program to execute the output automatically upon
object (delivery in our example) creation. Programmable changes are necessary for the ABAP code.
An example of ABAP Package integration is demonstrated on the outbound delivery transaction (VL02n)
using a new document output. This transaction is used for “deliveries” – for labels containing data for
outbound delivery.
By default, the transaction VL02n uses the output type LD00. If you drill down to the processing routines
defined for this output type in the NACE transaction code, you would learn that one of the transmission
medium options is configured to use the RLE_DELNOTE / RVADDN01 print programs.
71
Creating a new output type
To redirect data output to ABAP Package:
1. In the NACE transaction code, create a new output type. In this example, the ZNLA output type is
created.
a. Launch the transaction code NACE.
b. For Shipping (where outbound delivery fits into), select the V2 application and click Output
types.
c. Change display mode to edit mode and click New Entries.
d. In the General data tab, fill ID of Output Type, description, and access type.
e. In the Default values tab, set Dispatch time to when you want the message to be processed.
f. In the Default values tab, set message Transmission Medium to Special function.
g. In Processing Routines, you must configure the program name for each routine. For
Program, select enter /NICELAB/OUTPUT_PROCESSING. For Form Routine, select
DELIVERY_OUTPUT.
h. Save changes.
72
4. For new output item, type ZNLA for the Output type.
5. Type the language (EN in this example).
6. In the Communication method, select LOCL for the Logical destination.
Enable Print immediately check box.
When you save the output, the custom print program maps the current delivery data (LIKP, LIPS structures)
with ABAP Package. This creates an XML message and sends it for processing to the NiceLabel Automation
system. Feedback about the processing is saved in the output Processing log.
73
Example for production order (CO02)
This section describes the necessary customizing steps for setting up the basic print functionality of the
production order object list. These steps include the print program provided with ABAP Package. Order
type(s) used in the screenshots below are used for example purposes only. It is up to the customer needs to
configure printing for the correct order type, plant, or MRP group.
3. Go to the Print programs node and define a new print variant (PV). Take the existing variant as a
template and set the print variant number (in this example, the new print variant 2 is defined).
74
4. In the new variant, set the provided print program /NICELAB/PSFC_OBJECT_LIST for list LG01.
5. Go to List control for transaction node and configure the print variant on CO01 / CO02 transaction
level.
Printing labels
NOTE: The example below assumes execution on a specific SAP server with the available sample data. In your
environment, the steps are the same, but the data varies.
75
3. Open Order > Settings > List control.
4. Uncheck all unnecessary lists, leave just LG01 selected and click Continue button or press
Enter.
76
77
5. Select Functions > Print (or press Ctrl+P).
6. Click the Save button or press Ctrl+S. ABAP Package sends a print request to the NiceLabel
integration server.
78
Label sample with predefined data sources
The sample label for outbound delivery is included in the ABAP Package. This label contains all SAP data
sources from the production order (CAUFVD_P-*). You can import the data sources from this label to any
newly created label to save your time.
79
APPEND ls_nl_item TO ls_nl_item_t.
CLEAR ls_nl_item.
ls_nl_item-item_id = 'DESCRIPTION'.
ls_nl_item-item_value = 'Demo Material'.
APPEND ls_nl_item TO ls_nl_item_t.
80
Outbound delivery
Look at the program we provide for outbound delivery.
Do the following
1. In SAP GUI, run tcode SE80.
2. Navigate to the program /NICELAB/OUTPUT_PROCESSING.
81
3. See routine DELIVERY_OUTPUT and method lo_nl_dlvry->process.
4. This method contains an example, where we use SAP function RV_DELIVERY_PRINT_VIEW to read
data for items from the delivery, loop through LT_DLV_ITEM items, and fill data into ls_nl_item_t
table that contains name-value pairs.
82
83
5. Next, we send the complete envelope into the ABAP Package.
Demo application
We use a similar approach (as for the outbound delivery) also in the demo application.
Do the following:
1. In SAP GUI, run tcode SE80.
2. Navigate to _GENERATE_REQUEST_DATA as shown in the screenshot below.
3. The transfer of the name-value pairs (displayed in the table object on-screen) executes in the
_GENERATE_REQUEST_DATA method and data is sent out when executing the
SEND_PRINT_REQUEST method.
84
Print programs
The ABAP Package delivers the following print programs to be used with the respective standard SAP
transactions. You can study these programs to see how we collect data (key-value pairs) and send them into
the ABAP Package API.
85
Data exchange
This topic describes the structure of messages transferred between ABAP Package and NiceLabel
Automation, and the structure of NiceLabel Automation feedback.
ABAP Package encapsulates the data received from the SAP application into the XML structure in two parts.
• Header. This element contains meta-data information, such as which method you want to execute in
Automation, which label to use, which printer to use, how many labels to print, etc. Frequently used
fields are FORMAT, QUANTITY, PRINTERNAME, JOBNAME, PRINT, PREVIEW, and PRINTERSTATUS.
You can include just the fields that are required for a specific API call. E.g. if you want to print a label,
you would include just FORMAT and PRINT.
• Data. This element contains name-value pairs for data fields in SAP applications. You would provide
the name and value for all fields you want to use on a label. You can provide as many name-value
pairs as you need, there is no limit on the number of items. The field name is provided in the attribute
Id, the field value is provided in the element value.
There can be many Data elements, each providing data for a new label or report.
<?xml version="1.0"?>
<LABELS>
<Header>
<FORMAT>label.nlbl</FORMAT>
<QUANTITY>1</QUANTITY>
<QUANTITY_IDENTICALCOPIES/>
<PRINTERNAME/>
<PRINTERSTATUS>False</PRINTERSTATUS>
<JOBNAME/>
<USER>USER</USER>
<SYSTEM>ECC</SYSTEM>
<SYSTEM_TYPE>SAP</SYSTEM_TYPE>
<PRINT>False</PRINT>
<PREVIEW>True</PREVIEW>
<PREVIEW_FORMAT>PDF</PREVIEW_FORMAT>
<PRINTERS>False</PRINTERS>
<PRINT_JOB>False</PRINT_JOB>
<VARIABLES>False</VARIABLES>
86
<CATALOG>False</CATALOG>
<CATALOG_ROOT>/Labels</CATALOG_ROOT>
<DATAMODEL/>
<CLOUDPRINT/>
<CLOUD_APIKEY/>
<CLOUD_APIVERSION/>
<CLOUD_LABELVERSION/>
<PRINTERSETTINGS/>
<VARIANTS/>
<VARIANTS_UNLOCKEDVARIABLES/>
<EXPORT_DATA/>
<CUSTOM1/>
<CUSTOM2/>
<CUSTOM3/>
</Header>
<Data>
<Item Id="FIELD1">NiceLabel</Item>
<Item Id="FIELD2">SAMPLE</Item>
<Item Id="FIELD3">12345</Item>
<Item Id="FIELD4">12345</Item>
<Item Id="FIELD5">123456789012</Item>
</Data>
</LABELS>
The above XML requests a label preview (PREVIEW=True) for the label.nlbl label (FORMAT=label.nlbl) in
PDF format (PREVIEW_FORMAT=PDF).
87
SYSTEM_TYPE Specifies the system type. This is an optional field and is reserved
for future use.
PRINT Specifies whether to print the label. This is a Boolean field.
PREVIEW Specifies whether to provide the label preview. This is a Boolean
field.
PREVIEW_FORMAT Defines the format of the label preview. The available formats are
PDF, PNG, and JPEG. If you do not specify a format, PDF is
provided.
PRINTERS Specifies whether to provide the list of printer drivers that are
available on the computer, where NiceLabel Automation runs. When
the header also contains CLOUD_APIKEY and CLOUD_APIVERSION
field, Automation will also return available cloud-connected printers.
This is a Boolean field.
PRINT_JOB Specifies whether to provide a binary print job back to SAP. The
print job contains the selected label and the provided master data
both converted to the label printer programming language. This is a
Boolean field.
VARIABLES Specifies whether to provide a list of variables and their properties
from the selected label. This is a Boolean field.
CATALOG Specifies whether to provide a list of all labels (Label Catalog) from
DMS that are visible to NiceLabel Automation. This is a Boolean
field.
CATALOG_ROOT Defines the starting folder from which the label catalog creates. By
default, all labels from the DMS will be included in the label catalog.
Example value: /Labels/DispatchLabels
DATAMODEL Specifies whether to generate a file with a data model definition.
This is a Boolean field.
All name-value pairs from XML payload are converted into
NiceLabel-native .NLVR file that contains the definition of data
sources (variables). You can use .NLVR file to import variables into
the label template. A .NLVR file appears in the same folder where
you have your Automation configuration (.MISX file).
CLOUD_PRINT Specifies whether Automation should print a label directly to a
printer or using a Cloud Print API (available for cloud-connected
printers). You also have to provide a PRINT flag with value True.
This is a Boolean field.
CLOUD_APIKEY Defines the Cloud Print API subscription key. This is mapped from
OCP-APIM-SUBSCRIPTION key from the /NICELAB/IF_CTRO
configuration table.
CLOUD_APIVERSION Defines the version of the Cloud Print API to use. This is mapped
from API-VERSION key from the /NICELAB/IF_CTRL configuration
table.
CLOUD_LABELVERSION Defines the version of the label to print. Default is no version and in
that case, the latest approved version of the label template is used.
PRINTERSETTINGS Defines custom printer settings that are used to overwrite currently
applied printer settings. The printer settings are provided as a
Base64-encoded representation of the Windows printer driver
DEVMODE structure and must be compatible with the currently
selected printer driver.
VARIANTS Specifies whether Automation should create label variants. This is a
Boolean field.
88
VARIANTS_UNLOCKEDVARIABLES Defines the CSV list of variables (data sources) that must remain
unlocked in the generated label variants. All variables not specified
in this list will have their values hard-coded into the label template.
EXPORT_DATA Specifies whether to run custom actions within the EXPORT_DATA
placeholder in the Automation configuration. This is useful when
you want to save the data provided in the XML payload to some
custom location (e.g., database, files). Automation configuration
provides an empty placeholder that you can configure yourself and
adapt to your use case.
CUSTOM1 .. CUSTOM3 These are flags that you can use to control the execution of custom
action workflows in the Automation configuration that you have
configured yourself. This allows you to easily expand the
Automation configuration for your requirements.
Successful execution
If there is no error while processing the data, ABAP Package receives an XML-formatted message. The XML
message always contains all the elements, but some might be empty. For example, if you request a label
preview, the PrinterStatus, PrinterList, and other elements remain empty.
Response structure:
<?xml version="1.0"?>
<Feedback>
<ResponseText/>
<PrinterStatus/>
<Preview/>
<PrinterList/>
<LabelVariables/>
<PrintJob/>
<LabelCatalog/>
89
<Custom1/>
<Custom2/>
<Custom3/>
</Feedback>
Response parameters:
Response type:
• RFC type G (HTTP trigger and Clout trigger) returns response in a HTTP body (as application/octet-
stream content type).
• SOA (Web Service trigger) returns a response in the SOAP message. This response is base64-
encoded.
Erroneous execution
If there is a processing error, such as “label not found”, “printer not available”, “wrong data for label objects”
and others, the trigger in NiceLabel Automation raises an error and sends details back in the trigger
response.
90
• Web Service trigger provides the result in <errorText> element.
• HTTP trigger provides feedback in the HTTP header and the body of the message.
Example:
<Printer>
<Name>SATO CL4NX 203dpi</Name>
<CloudPrinter>False</CloudPrinter>
</Printer>
<Printer>
91
<Name>ZEBRA R-402</Name>
<CloudPrinter>False</CloudPrinter>
</Printer>
<Printer>
<Name>ZEBRA ZD420-300dpi ZPL</Name>
<CloudPrinter>True</CloudPrinter>
</Printer>
Example:
<Variable>
<Name>FIELD1</Name>
<Description />
<DefaultValue>NiceLabel</DefaultValue>
<Format>All</Format>
<IsPrompted>True</IsPrompted>
<PromptText />
<CurrentValue>NiceLabel</CurrentValue>
<IncrementType>None</IncrementType>
<IncrementStep>0</IncrementStep>
<IncrementCount>0</IncrementCount>
<Length>20</Length>
<IsPickListEnabled>False</IsPickListEnabled>
<PickListValues>
92
<PickListValue>1</PickListValue>
<PickListValue>2</PickListValue>
<PickListValue>3</PickListValue>
</PickListValues>
</Variable>
Example:
<Labels>
<Label>
<Name>/Demo/SAP ABAP Package/label.nlbl</Name>
<Width>100000</Width>
<Height>75000</Height>
<PrinterName>CAB A3 203DPI</PrinterName>
<Description></Description>
<Revisions>4</Revisions>
</Label>
…
</Labels>
93
API reference
/NICELAB/ namespace
All SAP objects that enable communication with the NiceLabel Automation are developed inside the
/NICELAB/ namespace in package/development class /NICELAB/INTERFACE. This exclusive namespace
ensures code independence from the SAP core system or any custom development projects in your SAP
deployment that you might develop in the customer namespaces “Z” or “Y”.
The names of the NiceLabel custom-developed SAP objects do not get into conflict with the names of
standard SAP objects. The NiceLabel objects are also not subject to change if a patch is applied, or if an
upgrade is undertaken. Using the unique namespace not only prevents naming conflicts but also prevents
unauthorized modification of distributed objects that were built in the unique /NICELAB/ namespace.
/NICELAB/CL_INTERFACE_ROOT->CONSTRUCTOR
Importing Parameters:
I_OPERATION_MODE (TYPE /NICELAB/INTERFACE_OP_MODE): Interface operation mode – Web Service or
HTTP request (SOA/HTTP)
Description:
This is a constructor method of the API interface. API operation mode (SOA/HTTP) can be explicitly set for
the API instance via I_OPERATION_MODE importing parameter. If this is not provided, the default operation
mode is read interface configuration table.
/NICELAB/CL_INTERFACE_ROOT ->LOGICAL_PORT_SET
Importing Parameters:
I_LP (TYPE PRX_LOGICAL_PORT_NAME): Logical port
Description:
94
This method can be used to override the default logical port configured for the interface in the
/NICELAB/V_IF_CT configuration view. The method is only valid for Web Service operation mode (“SOA”).
This can be used in the calling application, to set the desired NiceLabel Automation target system.
/NICELAB/CL_INTERFACE_ROOT ->RFC_DESTINATION_SET
Importing Parameters:
I_RFCDEST (TYPE RFCDEST): RFC destination of type G (External HTTP connection)
Description:
This method can be used to override the HTTP connection configured for the interface in the
/NICELAB/V_IF_CT configuration view. The method is only valid for HTTP operation mode (“HTTP”). This can
be used in the calling application to set the desired NiceLabel Automation target system.
/NICELAB/CL_INTERFACE_ROOT->DO_PRINT_XML
Importing Parameters:
I_NL_DATA (TYPE /NICELAB/RQST_DATA_OUT): Request Data
I_WITH_RESPONSE (TYPE BOOLEAN DEFAULT ABAP_TRUE): Get Response
I_WRITE_SPOOL (TYPE BOOLEAN OPTIONAL): Write Request/Response To Spool
I_SPOOL_TITLE_ADD (type STRING DEFAULT 'Request'): Spool Title Addition
I_CLOUD_TRIGGER (BOOLEAN, optional, DEFAULT ABAP_TRUE): Generate Cloud Trigger Request
Description:
This is the main method to send the print request data to NiceLabel Automation. Print request data contains
print meta-data information, such as preview type (PDF, JPG, etc.), request printer status attribute, number of
print copies, and the variable data to be printed. Print data is provided as name-value pairs which are defined
based on the printing application.
Depending on the interface operation mode – “SOA” (Web service) or “HTTP” (RFC type G) – the logical port
or RFC connection must be specified.
• For the “SOA” operation. If no port is specified, the default port from the configuration is used. If no
default PORT is found in /NICELAB/V_IF_CT, the port marked as default for
/NICELAB/CO_NL_AUTOMATION proxy class is used (defined and marked as default in
SOAMANAGER transaction).
• For the “HTTP” operation. If no RFC is explicitly specified, the default RFC from the configuration is
used. If no default RFC is found in /NICELAB/V_IF_CT, the call is aborted, and an exception is raised.
When using the I_WITH_RESPONSE parameter, the application can control if the response is returned for the
print request (this only applies for Web Service operation mode).
With parameter I_WRITE_SPOOL, the application can override the setting for logging the print
request/response data to the SAP spooler. If this parameter is not set, then the default setting for spool
generation is taken from the /NICELAB/V_IF_CT configuration view.
Method parameter I_SPOOL_TITLE_ADD is only used if Spool logging is enabled (see parameter
I_WRITE_SPOOL). The string specified here is added to the default spool title, depending on the spool
content (for example to add object key e.g. order number to the spool title, for easier monitoring).
Parameter I_CLOUD_TRIGGER is used to generate an HTTP request to a NiceLabel Cloud Trigger REST
service. When this parameter is set, additional HTTP headers are added to the HTTP request (API-VERSION,
OCP-APIM-SUBSCRIPTION-KEY). This parameter is not used with SOA requests.
95
/NICELAB/CL_INTERFACE_ROOT->RESPONSE_ERROR_GET
Importing Parameters:
I_DIALOG (TYPE ABAP_BOOL): Show response error in a dialog
Returning Parameters:
E_ERROR_DESC (TYPE STRING): Error description (as string)
Description:
This method returns a description of the error, which might happen during the NiceLabel Automation print
process in the E_ERROR_DESC variable. If the I_DIALOG parameter is set, the error message is displayed in a
popup dialog.
/NICELAB/CL_INTERFACE_ROOT=>REQUEST_PREVIEW_XML
Importing Parameters:
I_NL_DATA (TYPE /NICELAB/RQST_DATA_OUT): Request Data
Description:
This method generates and displays XML request that is sent to NiceLabel Automation. This can be used for
evaluation purposes (for example, if the application data was correctly mapped to XML structure).
/NICELAB/CL_INTERFACE_ROOT=>GET_API_INSTANCE
Importing Parameters:
I_API (TYPE /NICELAB/IF_API): NiceLabel Interface API Type
IS_IF_OPERATION (TYPE /NICELAB/IF_OPERATION): NiceLabel Interface: Operation Mode
Returning Parameters:
EO_NL_API (TYPE REF TO /NICELAB/CL_INTERFACE_ROOT): NiceLabel Automation Interface (API)
reference
Description:
This static method returns an instance of a requested API class type in specified operation mode. Different
API class types can be instantiated:
• LABEL – returns a reference to NiceLabel LABEL API Interface
• PRINTER - returns a reference to NiceLabel PRINTER API Interface
• DEMO - returns a reference to NiceLabel DEMO API Interface
/NICELAB/CL_INTERFACE_ROOT->GET_RESPONSE_TYPE
Importing Parameters:
I_FORMAT (TYPE /NICELAB/RESPONSE_FORMAT): Response Format
Returning Parameters:
RV_BIN_DATA (TYPE XSTRING): NiceLabel Interface: Operation Mode
Description:
This method returns the requested response type (PDF, JPG, or PNG) in binary format from the print request
response.
96
Class /NICELAB/CL_INTERFACE_DEMO
Part of the API interface package is also an example successor class of the API
/NICELAB/CL_INTERFACE_ROOT class. The example class is called /NICELAB/CL_INTERFACE_DEMO. For
additional usability, the example extends the basic NiceLabel ABAP Package interface with additional
methods:
/NICELAB/CL_INTERFACE_DEMO->PRINTER_STATUS_GET
Returning Parameters:
R_PRINTER_STATUS (TYPE STRING): Returns printer status in case of printer error.
Description:
If the printer status is requested in the original request to NiceLabel Automation, this method returns the
printer status description in case of errors.
/NICELAB/CL_INTERFACE_DEMO->RESPONSE_DISPLAY
Importing Parameters:
I_FORMAT (TYPE /NICELAB/RESPONSE_FORMAT): Response format (PDF, JPG, etc.)
Description:
If a print preview is specified in the request to NiceLabel Automation, this method can be used to read the
response and to present the result of a requested print. Different formats can be specified. The demo class
is implementing support for PDF response types.
/NICELAB/CL_INTERFACE_DEMO->PRINT_INFORMATION_GET
Returning Parameters:
R_PRINT_INFO (TYPE STRING): Returns print job information
Description:
NiceLabel Automation can provide additional information about the submitted print job. This method can be
used to read such information from the response.
Class /NICELAB/CL_IF_CONFIG
This class provides the interface to the NiceLabel interface configuration settings and can also be reused in
customer developments to read NiceLabel interface-specific settings.
/NICELAB/CL_IF_CONFIG=>CLASS_CONSTRUCTOR
Parameters:
N/A
Description:
Buffers the NiceLabel API Interface configuration table(s)
/NICELAB/CL_IF_CONFIG=>GET_LOGICAL_PORT
Returning Parameters:
97
R_VALUE (TYPE /NICELAB/IF_CONFIG_VALUE): NiceLabel Interface: Configuration Value
Description:
Returns logical port setting from the configuration (configuration key = 'SOA_LP')
/NICELAB/CL_IF_CONFIG=>GET_RFC_DESTINATION
Returning Parameters:
R_VALUE (TYPE /NICELAB/IF_CONFIG_VALUE): NiceLabel Interface: Configuration Value
Description:
Returns RFC destination setting from the configuration (configuration key = 'HTTP_RFC')
/NICELAB/CL_IF_CONFIG=>GET_PRINTER_STATUS
Returning Parameters:
R_VALUE (TYPE /NICELAB/IF_CONFIG_VALUE): NiceLabel Interface: Configuration Value
Description:
Returns printer status (pooling True/False) from the configuration (configuration key = 'PRINTER_STATUS')
/NICELAB/CL_IF_CONFIG=>GET_OPERATION_MODE
Returning Parameters:
R_VALUE (TYPE /NICELAB/IF_CONFIG_VALUE): NiceLabel Interface: Configuration Value
Description:
Returns default (system wide) API operation mode from the configuration (configuration key =
‘OPERATION_MODE’)
/NICELAB/CL_IF_CONFIG=>GET_CONFIG_ID_VALUE
Importing Parameters:
I_CONFIG_ID (TYPE /NICELAB/IF_CONFIG_ID): NiceLabel Interface: Configuration ID
ReturningParameters:
R_VALUE (TYPE /NICELAB/IF_CONFIG_VALUE): NiceLabel Interface: Configuration Value
Description:
Returns configuration key value for requested configuration ID (I_CONFIG_ID)
/NICELAB/CL_IF_CONFIG=>GET_DATA_MODEL
Returning Parameters:
R_VALUE (TYPE /NICELAB/IF_CONFIG_VALUE): NiceLabel Interface: Configuration Value
Description:
Returns (system-wide) print request header setting to generate a variable data model from the print request
(configuration key = 'DATA_MODEL')
98
Class /NICELAB/CL_IF_UTIL
This class interface provides NiceLabel global constants and some common methods for string processing,
error display, etc.
Constants:
CO_RESP_FORMAT_PDF (type /NICELAB/RESPONSE_FORMAT) value ‘PDF’
CO_RESP_FORMAT_PNG (type /NICELAB/RESPONSE_FORMAT) value ‘PNG’
CO_RESP_FORMAT_JPG (type /NICELAB/RESPONSE_FORMAT) value ‘JPG’
CO_OP_MODE_SOA (type /NICELAB/INTERFACE_OP_MODE) value 'SOA'
CO_OP_MODE_HTTP (type /NICELAB/INTERFACE_OP_MODE) value 'HTTP'
CO_XML_TRUE (type STRING) value ‘TRUE’
CO_XML_FALSE (type STRING) value ‘FALSE’
CO_MEM_ID_OP_MODE Memory ID for API operation mode
CO_API_LABEL (type /NICELAB/IF_API) value 'LABEL'
CO_API_DEMO (type /NICELAB/IF_API) value 'DEMO'
CO_API_PRINTER (type /NICELAB/IF_API) value 'PRINTER'
CO_OUTPUT_DEV_BIN (type RSPOPNAME) value ''NLBN' (Binary spool output device)
CO_OUTPUT_DEV_PDF (type RSPOPNAME) value 'NLRS' (PDF spool output device)
CO_MSGID_NICELABEL_IF (type MSGID) value ''/NICELAB/INTERFACE'
CO_ITEMID_VARIANT_FILENAME (type STRING) value '_VARIANT_FILENAME' (XML item ItemID constant in
case Create Variant option is activated)
/NICELAB/CL_IF_CONFIG=>STRING_TO_TAB
Importing Parameters:
IV_STRING (type STRING)
Returning Parameters:
ET_CTAB (type STANDARD TABLE)
Description:
Convert strings to the table
/NICELAB/CL_IF_CONFIG=>BOOL_2_TF
Importing Parameters:
I_BOOL (type BOOLEAN)
Returning Parameters:
R_TRUEFALSE (type STRING)
Description:
Convert ABAP Boolean value (‘X’, ‘’) to XML True/False
/NICELAB/CL_IF_CONFIG=>TF_2_BOOL
Importing Parameters:
I_TRUEFALSE (type STRING)
Returning Parameters:
R_BOOL (type BOOLEAN)
99
Description:
Converts XML Boolean value (‘True’, ‘False’) to ABAP Boolean value ('', 'X')
/NICELAB/CL_IF_CONFIG=>CONV_STRING_2_ERROR_TAB
Importing Parameters:
I_TITLE (type /NICELAB/IF_S_NOTE-LINE optional)
I_ERROR (type STRING)
Returning Parameters:
RT_ERR_TAB (type /NICELAB/IF_NOTE_TAB)
Description:
Converts string to error table
/NICELAB/CL_IF_CONFIG=>MESSAGE_POPUP
Importing Parameters:
I_TITLE (type SYTITLE optional)
I_MESSAGE (type STRING)
Description:
Display message string (I_MESSAGE) in a popup dialog
/NICELAB/CL_IF_CONFIG=>GET_PROCESS_OBJ_CHAR
Importing Parameters:
I_OBJNUM (type OBJNUM): Object number
I_PROCESS (type /NICELAB/PROCESS optional SY-TCODE): Integrated Process (e.g. transaction code)
I_KEY01 (type /NICELAB/IF_PROC_KEY01 optional): Generic Key 1
I_KEY02 (type /NICELAB/IF_PROC_KEY02 optional): Generic Key 2
I_SPRAS (type SPRAS optional): Language
Returning Parameters:
RT_OBJ_CHAR (type /NICELAB/PROC_OBJ_CLAS_T) : Material characteristics
Description:
Reads the NiceLabel integrated process material characteristics configuration table /NICELAB/PROC_MC
and returns characteristics for all configured class / characteristic combinations.
/NICELAB/CL_IF_CONFIG=>GET_PROCESS_CONFIG
Importing Parameters:
I_PROCESS (type /NICELAB/PROCESS optional SY-TCODE): Integrated Process (e.g. transaction code)
I_KEY01 (type /NICELAB/IF_PROC_KEY01 optional): Generic Key 1
I_KEY02 (type /NICELAB/IF_PROC_KEY02 optional): Generic Key 2
I_USERNAME (type UNAME optional SY-UNAME): Username
Returning Parameters:
100
R_IF_PROC (type /NICELAB/IF_PROC): NiceLabel Interface: Process Settings
Description:
This method can be used to read the NiceLabel integrated process configuration from the
/NICELAB/IF_PROC table. The method also considers generic entries in generic key fields and the username
field, meaning that the pattern entry using the '*' character can be used for creating more generic entries.
Class /NICELAB/CL_IF_PRINTER
This API class provides methods for retrieving printer information from NiceLabel automation, for example,
reading connected printers (local and Cloud) and refreshing the NiceLabel printer list in SAP.
/NICELAB/CL_IF_PRINTER=> GET_LIST
Returning Parameters:
E_ERROR (type STRING): Error description
ET_PRINTER_LIST (type /NICELAB/IF_PRINTER_LIST_TAB): Printer List
Description:
This method sends a request to NiceLabel automation with header element <PRINTER>True</PRINTER> .
Such a request will return a list of all printers connected to NiceLabel Automation. If configuration IDs OCP-
APIM-SUBSCRIPTION-KEY and API-VERSION are configured, additional HTTP headers are sent to
Automation, and a list of returned printers will also contain Cloud-enabled printers.
/NICELAB/CL_IF_PRINTER=> REFRESH_PRINTER_LIST_SAP
Importing Parameters:
I_COMMIT (type BOOLEAN): Commit changes to DB
Description:
This method is used for refreshing a list of NiceLabel printers in the SAP system. List of printers is received
from NiceLabel Automation (see /NICELAB/CL_IF_PRINTER=>GET_LIST method ) and stored in an SAP DB
table /NICELAB/IF_PRNT.
/NICELAB/CL_IF_PRINTER=> IS_CLOUD_PRINTER
Importing Parameters:
I_PRINTER_NAME (type STRING): Printer Name
Returning Parameters:
R_CLOUD (type BOOLEAN): Cloud Printer True/False
Description:
This method checks if the specified NiceLabel printer is a Cloud printer. This information is stored locally, in
the SAP system, in table /NICELAB/IF_PRNT (attribute CLOUD_PRINTER).
Class /NICELAB/CL_IF_LABEL
101
This API class provides methods for retrieving label information from NiceLabel automation.
/NICELAB/CL_IF_LABEL=> GET_LIST
Returning Parameters:
E_ERROR (type STRING): Error description
ET_LABEL_LIST (type /NICELAB/IF_LABEL_LIST_TAB): Label List
Description:
This method sends a request to NiceLabel automation with header element <CATALOG>True</CATALOG>.
Such a request will return a list of all labels from the NiceLabel Automation repository.
/NICELAB/CL_IF_LABEL=> GET_LABEL_VARIABLES
Returning Parameters:
I_LABEL (type /NICELAB/LABEL): Label Name
I_DIALOG (type BOOLEAN): Execution in dialog
Returning Parameters:
ES_LABEL_VAR (type /NICELAB/IF_LABEL_VAR): Label Variables
E_ERROR (type STRING): Error description
Description:
This method sends a request to NiceLabel automation with header element
<VARIABLES>True</VARIABLES>. Such request will return a list of variables used on a specified label in
exporting parameter ES_LABEL_VAR. The error description is returned in the E_ERROR variable in case of
errors. If the I_DIALOG parameter is set to True ('X') the error message will be displayed in a popup dialog.
102
Support
Online help
You can find the latest builds, updates, workarounds for problems, and Frequently Asked
Questions (FAQ) on the product website at www.nicelabel.com.
NOTE: If you have a Service Maintenance Agreement (SMA), please contact the premium support as specified in the
agreement.
Troubleshooting
Error creating logical port in transaction SOAMANAGER
When creating a logical port, you might receive the following error:
SRT Framework exception: Error in WSDL parsing: There was an exception in Library Handler
Error cause: SAP connected to the provided address where Web Service trigger is active in NiceLabel
Automation. However, the trigger response was not formatted in the way the ABAP Package expects it to
be.
103
The SM59 transaction includes the “Connect Test” button, which sends data to the RFC destination. When
you execute a connection test, you receive an error response. You receive the 500 HTTP status response and
a status message containing the “Exception type:
EuroPlus.NiceLabel.Core.Exceptions.ActionException…”
Despite the error report, the test was executed successfully. You have received a response from NiceLabel
Automation, which means you have a clear communication path with NiceLabel Automation.
What you see is a standard response from NiceLabel Automation for a detected error. The “Connection Test”
button did not send the data formatted in an XML structure as NiceLabel Automation expected. Therefore,
the response is an error message.
To summarize, the error that you see after running the “Connection Test” proves that you can communicate
with NiceLabel Automation. To test your ABAP Package, run the provided demo program
/NICELAB/INTERFACE_DEMO. This program sends the XML data the way NiceLabel Automation expects it
to be.
NOTE: Label catalog creates with labels from the DMS, not from any other source location.
Label catalog is not created in the main trigger that receives data from SAP. Creating the label catalog might
take a while, so the process is asynchronous. The main trigger does not wait for a response. The label
catalog creation is offloaded to another trigger within the NiceLabel Automation configuration with the name
Label Catalog Async Updater. When the catalog is created, it is saved as an XML file in the folder with
Automation configuration.
104
Do the following:
a. Make sure the Label Catalog Async Updater trigger is not currently in use (there must be no
progress indicator next to the trigger).
b. Do this check on each of your deployed Automation servers.
c. In Control Center, go to the Documents tab.
d. Navigate to the folder, where you saved the Automation configuration.
e. Delete the file LabelCatalogUpdateInProgress.txt.
ABAP Package contains the enhancement spot that hooks into the standard outbound delivery transaction
and invokes label printing through NiceLabel. All ABAP Package items are contained within /NICELAB/
namespace.
When running tcode SPAU_ENH after the SAP upgrade, it might display a red traffic light (manual
adjustment) next to the following items:
/NICELAB/ENH_IF_RVADDN01
/NICELAB/ENH_IF_RLE_DELNOTE
Customers cannot adjust these enhancements due to the missing change license for /NICELAB/
namespace. You might see the following errors:
• Namespace /NICELAB/ does not exist
• No valid change license exists for namespace /NICELAB/
Do the following:
1. You have to add the /NICELAB/ namespace in your system with a namespace repair key.
2. The repair key to use is 28595060430262820612.
3. The procedure to release a namespace for repairs is documented here:
a. If you see the error “No valid change license exists for a namespace /NICELAB/”:
https://help.sap.com/doc/saphelp_nw74/7.4.16/en-
us/bd/ddbe0bac5c11d2850e0000e8a57770/content.htm?no_cache=true
b. If you see the error “Namespace /NICELAB/ does not exist”:
https://help.sap.com/saphelp_snc700_ehp01/helpdata/en/bd/ddbe08ac5c11d2850e0000e
8a57770/content.htm?no_cache=true
Make sure to use “C - Recipient” for the namespace role.
105