How to set up a StreamServe virtual printer connected to... Contents

Transcription

How to set up a StreamServe virtual printer connected to... Contents
How to set up a StreamServe virtual printer connected to SAP
Revision: 2010-05-26
Author: Christian Josefsson
Contents
How to set up a StreamServe virtual printer connected to SAP ................................................................... 1
Introduction .............................................................................................................................................. 1
Transferring the spool data to StreamServe............................................................................................. 2
Defining a local StreamServe printer (windows) ...................................................................................... 3
Enabling remote printing from SAP to StreamServe using SAPSprint (windows) .................................. 10
Enabling remote printing from SAP to StreamServe using LPD/CUPS (Unix) ......................................... 15
Using a shared file system to transfer spool data................................................................................... 17
Local printing with command set........................................................................................................ 18
Introduction
This how-to document describes how to set up StreamServe as a virtual printer to connect with SAP.
Several approaches are possible; this document highlights the different options and gives detailed stepby-step instructions.
Setting up StreamServe as a printer in SAP allows using the SAP Spool system as a robust transfer
mechanism of spool data between SAP and StreamServe. Since the SAP spool system is file based and
capable of handling high volume and large spool jobs with little overhead (assuming raw data output),
this is the typical and generally recommended approach of connecting StreamServe with SAP.
The overall architecture is depicted below.
Note: To automatically process the spool files from SAP, a StreamServer project needs to be defined and
configured in Design Center to map the input data depending on the format used, apply a document
design template and then output the formatted document. The Design Center project needs to be
deployed to StreamServer instance in Control Center on the relevant host with access to the defined
spool folder. These topics are outside the scope of this document.
Transferring the spool data to StreamServe
The transfer mechanism used depends on the “Host spool access method” used in the SAP printer
device. The available access methods are documented on help.sap.com:
http://help.sap.com/saphelp_nw70/helpdata/en/4f/9c033cff903105e10000000a114084/frameset.htm
In essence there are two main approaches available:
•
•
The first method, which is recommended in high volume scenarios, is to have a common file
share between the SAP spool server and the StreamServer host. In a high-availability
environment that would be realized using a SAN to avoid single point of failures.
The second approach would use an external print (LPD) server typically available by the OS
(LPD/CUPS on Unix/Linux, the local Spooler service on Windows) or alternatively using the
SAPSprint service which implements a simple but efficient LPD server for windows
(http://help.sap.com/saphelp_nw70/helpdata/en/d9/4a91c651ea11d189570000e829fbbd/fra
meset.htm ). The SAPSprint service is then installed on the StreamServe host(s).
Apart from these methods StreamServe also implements the BC-XOM interface, part of an interface
component called “StreamServe Delivery Manager” meaning that also access method “E: External
Output Management System” can be used. This method can in turn either make use of a shared file
system to transfer data using the “Command line submit” mode or alternatively using an HTTP base
transfer method. This approach is thoroughly documented in “StreamServe Connect for SAP –
DM.pdf” and will not be covered further in this document.
Defining a local StreamServe printer (windows)
This section will define how to set up a local windows printer that can transfer spool files to a local
folder. This method is applicable if StreamServe is installed on a Windows server. The following steps are
performed on the StreamServe Windows server to be used.
1. Create a destination folder on the local file system (this folder will be used by StreamServer
instances to receive spool data)
2. Enter “Add new printer wizard”
3. Click Next
4. Select “Local printer attached to this computer”, deselect “auto detect”, press Next.
5. Select “Create new port”, and select Type of port: “StreamServe”. Click Next.
6. Enter a name of the port and most importantly enter the path to the spool folder created
earlier. Press OK.
7. Select “Generic” Manufacturer and “Generic / Text Only” printer driver. Click Next.
8. Select “Keep existing driver” and click Next.
9. Enter a suitable printer name e.g. “STRS” mark as not default printer and click Next.
10. If you need to share the printer to access it remotely, enter a share name and click Next.
11. Optionally enter location and comment (typically left blank). Click Next.
12. Select No test page and click Next.
13. Finish the StreamServe printer creation by confirming with Finish.
The printer created can now be used as a shared printer from SAP using local printing with access
method C (if the SAP system is itself running on windows). Or using remote LPD printing, access method
S or U. See next section “Enable remote printing from SAP to StreamServe using SAPSprint (windows)” .
Enabling remote printing from SAP to StreamServe using SAPSprint
(windows)
This approach is applicable if StreamServe runs on a Windows host and a local StreamServe printer has
been created as above, and furthermore the use of a shared file system is for some reason not suitable.
The first step is to install the SAPSprint service on the StreamServe host. This is described in
http://help.sap.com/saphelp_nw70/helpdata/en/d9/4a91c651ea11d189570000e829fbbd/frameset.ht
m
1. After installation, verify that the SAPSPrint service runs on the StreamServe host
2. Now log in to the SAP NetWeaver system to be connected and go to transaction SPAD. Press
“Display Output Devices”.
3. Press the “Create” new device icon.
4. Give the device a technical name, and select a suitable device type. In this case we selected
SAPGOF for printing pre-formatted ABAP List and OTF data. However the raw data formats RDI,
XSF/XDF or XFP is recommended for high-volume scenarios (PLAIN/UCPLAIN, XSF/XDF, or XFP
device type respectively). Also make sure you select the correct spool server instance.
5. Now switch to the Access Method tab and select an appropriate Host Spool Access method. In
this case to print remotely to the SAPSprint service on the StreamServe host, select method “S”
and enter the name of the local StreamServe printer name as set up in section “Defining a local
StreamServe printer (windows)” above. Also enter the host name or IP address of the
StreamServe host. TIP: For better performance also select “Do Not Query Host Spooler for
Output Status”.
6. Save and activate the device. It is now ready to use.
7. You can test that the communication works: if you have a SAPGOF type device you can print any
ABAP list to this device. For example try print the Device list shown in step 4 above. Select the
output device as printer and make sure you mark it for immediate output.
8. If the test printout worked you should see the spool file in defined spool folder on the
StreamServe host:
IMPORTANT: The above steps used the SAPGOF device type for test purposes. You typically also need to
create devices suitable for high volume raw data output (device type PLAIN/UCPLAIN for SAPScript RDI,
device type XSF or XDF for SmartForms xml output, or device type XFP for xml output from PDF-based
print forms).
Enabling remote printing from SAP to StreamServe using LPD/CUPS (Unix)
The method is analogous to the approach in the previous section, with the exception that SAPSprint
cannot be used. Instead we assume CUPS (Common Unix Printing System) which is available for most
Unix environments and typically the default local spooler on a Linux system.
First step is to review SAP Note: 791747 “Linux: Printing from the SAP System (access method U) “. This
involves enabling xinetd for LPD printing.
A possible xinetd cups printer configuration can look like below. Note that to disable the cups banners in
the spool files you need option “-o job-sheets=none”.
/etc/xinetd.d/printer
service printer
{
socket_type = stream
protocol = tcp
wait = no
user = lp
group = sys
server = /usr/lib/cups/daemon/cups-lpd
server_args = -o document-format=application/octet-stream -o job-sheets=none
}
Secondly you need to enable raw printing in cups typically editing the files /etc/cups/mime.types,
/etc/cups/mime.convs to uncomment the section for supporting document format application/octetstream to be redirected to a raw device.
Finally to print to a file in CUPS you need to add a backend script that is capable of transferring the spool
data to the proper location.
A typical such script can look like below:
Contents of /usr/lib/cups/backend/filespooler
#!/bin/bash
TARGETFILE=${DEVICE_URI#filespooler:}
JOBID=$1
TITLE=$3
USER=$2
FILE=$6 || FILE="-";
PID=$$
# if there are no arguments: print the "I'm here" message for cupsd's probing
if [ $# -eq 0 ]; then
echo "direct filewrite \"Unknown\" \"Print any job to file specified in
device-URI\""
exit 0
fi
cat $FILE > "$TARGETFILE/$JOBID.$TITLE.$PID.prn"
exit 0
Assuming that a filespooler backend script exists with execute permissions in
/usr/lib/cups/backend/filespooler, then the below commands can be executed to set up the printer:
1. Create a file area accessible to the StreamServer process, e.g.:
sudo mkdir /mnt/strs_spool
2. Create a local virtual printer queue for streamserve:
sudo lpadmin -p strs -v filespooler:///mnt/strs_spool –E
3. Next you define a printer device in the SAP system following same as step 3-5 in section
“Enabling remote printing from SAP to StreamServe using SAPSprint (windows)” above. Then
select the Access Method tab, select Host Spool Access Method as “U: Print using Berkley
Protocol ”, enter the host name or IP address where the CUPS server runs. The Host printer
name should be the same as the name of the virtual printer queue created in step 2 above.
4. Save and activate the print device. It is now ready to be used.
Note that the above steps is an example set of steps to enable remote unix printing with CUPS, other
approaches are possible depending on the environment.
Using a shared file system to transfer spool data
As noted earlier this approach should make use of a SAN in a high availability environment. But the
below steps will assume that the StreamServer server host makes a file share available that then is made
accessible on the SAP NetWeaver application server. To make this possible in windows environments
you typically need to have the SAP system and the StreamServe system in the same domain,
alternatively creating the sap service user SAPService<SID> locally (using the same password) on the
StreamServe host.
Local printing with command set
This method makes use of a device with Host spool access method L, which can define an arbitrary
Command set to transfer spool data. This method is defined in the SAPScript RDI interface specification
and works on both Unix and Windows environments.
1. The first step is to make sure a file share is created which is accessible both on the SAP system
and the StreamServer host. In the sample below the spool folder created as first step in section
“Defining a local StreamServe printer (windows)” above has simply been shared using windows
file sharing and allowing access for the SAP service user on the SAP NetWeaver system.
2. Next you define a printer device in the SAP system following same as step 3-5 in section
“Enabling remote printing from SAP to StreamServe using SAPSprint (windows)” above. Then
select the Access Method tab, select Host Spool Access Method as “L: Print locally using LP/LPR”
and then from the menu select “Edit -> Command set”.
3. Now the “Command set” field becomes visible. Specify a printer name (normally insignificant in
this scenario). And type a number for the command set to create.
4. Double click the number specified in the “Command Set ID” field to get to define the command
used to transfer the spool data.
5. The command specified uses &F as the file path to the original spool file to be transferred and
&f is the file name of the same. The commands must be “silent” if processing is OK, otherwise
any text appearing on STDOUT/STDERR will be interpreted as an error message. The full sample
commands are given below:
a. Windows:
copy /Y &F \\192.168.4.170\spool\&f > NUL || echo "Error
copying &F"
b. Unix:
cp &F /mnt/nfs/strs_spool > /dev/null || echo "Error
copying &F"
6. Save and activate the device. It is now ready to use.
Any spool output to this device will now result in the spool file being transferred to the StreamServe
accessible file share to be processed by a configured StreamServer instance.