2010年1月5日 星期二

Printing ABAP Report over LAN and WAN

For the LAN setup for local printer you can defined it as device LOCL

Device type: SAPWIN
Host printer: __DEFAULT
Host spool access method: F (Printing on front end computer)

This printer will works fine on your LAN.

For the WAN, assuming that you have 2 office connected over the internet and they work fine with the printer LOCL.

Now, you need to have a Print Server where you have installed many of the printer, some of them over WAN and they will work fine if you do this :-

The server must have SAPLPD installed.

Output device: LPFP
Device type: SAPWIN
Destination host: sapdev
Host printer: HP_HP1 (printer name on the Printer Server)
Host spool access method: S (Print on LPDHOST via SAP protocol)

Print SAP Documents Using Linux

A lot of people keep asking me how to print SAP R/3 documents using printer attached on Linux PC.

SAPGUI for Java is already installed on my Linux PC but I was unable to print any SAP documents ? We can't use Frontend Printing (F acces method) since there was no SAPLPD program on it. Tell me how ??

Well, actually SAPLPD package on SAPGUI for Windows is duplicate Linux's LPD flow. It is using same architecture and working method. Since Linux already had it LPD (and CUPS), it doesn't need SAPLPD anymore. You can use LPD (and CUPS) to replace SAPLPD function.

SAPGUI for Java on Linux can use U : Print Using Berkeley Protocol acces method. Fill the Host printer column with name of your printer defined on your Linux PC. Use simple name and no space. On Destination host, fill with IP address of your Linux PC where your printer attached.

After that, open your inetd.conf file and add this at the end of lines.

printer stream tcp nowait lp /usr/lib/cups/daemon/cups-lpd cups-lpd
and you need to restart your inetd daemon or reboot your PC.

If you are using xinetd.conf, please add this at the end of lines.

service printer
{
socket_type = stream
protocol = tcp
wait = no
user = lp
server = /usr/lib/cups/daemon/cups-lpd
}
Restart your xinetd daemon.

Before you print your SAP R/3 documents, please make sure your LPD (and/or CUPS ) daemon is running well.

Now, you can test your SAP R/3 documents printing. It should work.

Output Type Trouble Shooting

The output device is change by one inexistent when the output is executed. When the user creates the outbound delivery the output is determinate, but not prints yet (status not processed). Here the output device is correct and is the one set in the condition record. Then, when the user executes the post good issue the output device is change by one inexistent call SIS0, and the field Spool request: Name is complete with the name of the message.

Please first check the entry in table NAST, field LDEST. Is it correct after saving the delivery ?

I think the best is then to set a breakpoint during the creation of the goods issue in function module MESSAGING in order to find out if the printer is changed here. If this does not help please goto TA V/34, find out the used print program and set a breakpoint there (normally at the beginning of form ENTRY).

Spool Consistency Check

RSPO1041 is the report to delete the old spool request,

RSPO1043 is the report to check the consistency of spool DB

Try to schedule these report in SA38 with variants, schedule once or as periodically.

You can use the spool consistency check to check whether tables that contain spool requests, output requests, and output data are inconsistent. If necessary, you can delete inconsistencies.

Along with deleting old spool requests, the spool consistency check is one of the most important functions for maintaining the SAP spool database. You should perform the spool consistency check regularly in the background.

As the spool consistency check affects performance, you should schedule it either during the night or at the weekend.

You require an administrator authorization.

The spool consistency check checks the following table entries for spool requests:

- Header entry in table TST01 (TemSe objects)

- Object associated with the header entry; it can be stored in the file system or in the database table TST03 (TemSe data of the object)

- Entry in table TSP01 (spool requests)

- Entry in table TSP02, if output requests exist

You can identify and delete inconsistencies both in the background and in dialog:

- You can use report RSPO1043 to identify and delete inconsistencies in the background. This has the following advantages:

- Inconsistencies are only deleted if they appear during repeated runs. There is therefore no danger of accidentally deleting temporary inconsistencies.

- Temporary inconsistencies are not actual inconsistencies and must not be deleted. Temporary inconsistencies may occur, for example, if a user is writing data to the TemSe during the consistency check.

- No timeouts

- You can use transaction SPAD or report RSPO0043 to display and delete inconsistencies in dialog. However, we do not recommend these methods for your production systems due to the following disadvantages:

- Accidental deletion of temporary inconsistencies
Only after a minimum of a second check can you determine whether an inconsistency was only temporary, because, for example, another user was writing to the TemSe during the check, or whether the check has found an actual inconsistency.

- Timeouts

For more information about spool consistency checks, see SAP Notes 48400 and 98065 in the SAP Service Marketplace.

Only delete inconsistent spool requests with the spool consistency check and not with the TemSe consistency check due to the following disadvantages of the TemSe consistency check:

- The TemSe consistency check does check the header entries in table TST01 and associated objects only for spool requests, but rather for all TemSe objects.

- Deleting TemSe inconsistencies includes only the header entry in TST 01 and the actual TemSe object. However, to delete a spool request, you must also remove the entry in TSP01 (spool requests) and, if an output request exists, in table TSP02 (output requests).

Change Output Device Settings At Runtime

SAP ERP ==> SAP Basis

We have a requirement to change output device settings on the fly in a program. For instance, in case A, we would like to use the output device as it was originally configured in SPAD. However, in case B, we would like to override the output device's access method and host dynamically in code.
Is there any function module or technique that can change these output device properties via code at runtime (printtime)?

By default you will get the output device which you have configured in SPAD.

If you want different output device then you need to write write ABAP code and Pass the required output device during runtime. While calling the function module that is generated after creating the smartform you need to pass the Output device name to the control parameters and output parameters.

Try out this.. The "wa_output_options-tddest = 'LOCL'." is the output device name..

p_output_options-TDCOPIES = 3. "number of copies.

p_output_options-tddest = 'LP01'. "def

p_output_options-TDIMMED = 'X'.

p_output_options-tddelete = 'X'.

p_output_options-TDIMMED = ' '.

p_output_options-tddest = 'LP01'.

p_output_options-TDNEWID = 'X'.

wa_ctrl-no_dialog = 'X'.

deactivate the popup window

p_control_parameters-no_dialog = 'X'. "no dilog box

p_control_parameters-preview = 'X'. "no preview

wa_output_options-tdimmed = 'X'.

wa_output_options-tddelete = 'X'.

wa_output_options-tdimmed = ' '.

wa_output_options-tddest = 'LOCL'.

wa_ctrl-no_dialog = 'X'.

CALL FUNCTION '/1BCDWB/SF00000154'

EXPORTING

ARCHIVE_INDEX =

ARCHIVE_INDEX_TAB =

ARCHIVE_PARAMETERS =

CONTROL_PARAMETERS = p_control_parameters

MAIL_APPL_OBJ =

MAIL_RECIPIENT =

MAIL_SENDER =

OUTPUT_OPTIONS = p_output_options

USER_SETTINGS = 'X'

IMPORTING

DOCUMENT_OUTPUT_INFO =

JOB_OUTPUT_INFO =

JOB_OUTPUT_OPTIONS = wa_job

TABLES

wt_header = wi_itab1

wt_personal = wi_itab2

wt_payroll = wi_itab3

wt_absence = wi_itab4

EXCEPTIONS

FORMATTING_ERROR = 1

INTERNAL_ERROR = 2

SEND_ERROR = 3

USER_CANCELED = 4

OTHERS = 5.

IF sy-subrc 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

List Of Output Device Type Table

Which is the table for output device?

Check these following tables:

TSP03 - Printer Declaration
TSP03A - Device Description
TSP03C - Device Description Extension
TSP03D - Device Description (New Format)
TSP0A - Device Types
TSP01 - Assignment of printers to terminals

---

Parameter ID for output type

I have set up some kind of output type for printing billing document. And now I want to set up this output type to be automaticaly inserted into billing document according settings in customer master data. In SPRO in Maintain Output types, I set up print parameter as S - User parameter, but I don´t know what Parameter ID I have to use to set up the particular output type for the particular user.

In TA VOK2 -> you will find all steps you have to do.

- Define condition table
- Define access sequence
- Define condition type
- Define output determ. procedure

In the definition of the condition type you will find the print parameters. The tables where they are stored are:

- TNAD1
- TNAD2
- TNAD3
- TNAD4
- TNAD5
- TNAD7
- TNAD8
- TNAD9
- TNADP
- TNADPT
- TNADR
- TNADU

In TNADU you could store the printer per user. The other possibility is to set the printer directly in TA SU01 -> tab defaults -> spool control -> output device.

---

I need to get the value for "Output Device" from the User's own data (transaction su3, tab defaults).

Check table USR01.

Basic Understanding Regarding to Spool

Explain on Local Printing, Remote Printing, Front End Printing.
Concept of logical server and SAPLPD.

Tcode : SPAD











Local Printing means that your spool server (R/3) and print manager (OS) are running on the same machine and the printer is connected locally or via network connection to the Print manager (OS).
Access Method for local printing :
C : Direct operating system call - for windows
L : connect locally via lp/lpr with signal - for unix

Remote Printing means that your spool server (R/3) and print manager (OS) are running on different machine and the printer may be connected locally or via network connection to the print manager (OS).
Access Method for Remote printing :
U : Print on LPDHOST via berkeley protocol - for windows and unix
S : Print on LPDHOST via SAP protocol - for windows

Front end printing means that printer is connected to the front end system. there is no need to define the printer on the SAP system.
Access method for front end printing :
F : Print on front end (locally) via SAPLPD

Logical Server are mapped to the physical server or another logical server. These servers are used for load balancing purpose.

SAPLPD daemon is an interface between Spool server (R/3) and Print Manager (OS). when using the access method U,S and F this daemon program should be running on the print manager (OS) (in case of U,S) and on the front end system (in case of F).


Sending faxes from SAP

Some guidelines how to you can setup faxing from SAP :-

You will need an additional software to be installed.

The best way to do this is to get a standard desktop PC with a modem attached. Buy a copy of Winfax 10 (its only about $100 to buy.)

When you have Winfax setup and working locally, install SAPLPD (put it in the startup group so its loads on startup).

WinFax will create a shared fax on the PC (For e.g. IFAX).

When this is done create a printer/Fax in transaction SPAD.
Device type = SAPWIN Rel.4.x/SAPlpd
Device class = Fax
Host Spool access method = S;print using SAP protocol
Dest. host = PC IP address
Host printer = Shared fax name on PC(i.e IFAX)

Make sure you have all the lasted SAPLPD + dll's

After that is done create the locations in transaction SCOM, they are self explainitory from there.

Delete multiple spool request

The program are RSPO0041 or RSPO1041.

This is handy whenever you encounter a user who managed to create a lot of spool requests which are choking your system.

Deleting them with SP01 will be too slow and you will get time out if it exceed the online time limit specify by your basis people.

How can I print A3 format in SAP

My printer is HP LaserJet 5100

Note I can print ms word document in A3 format but I can't print A3 format in SAP

My output device setting are:

DeviceAttributes:
Device Type = THSAPWIN: MS-Windows-Printer via SAPLPD
Device Class = Standard printer
Access Method:
Host Spool Access Method = S: Print Using SAP Protocol

When I print SM50 output and select format X_65_255, it can print successfully but its format is A4.

What may I do wrong? Please help me how to set up for A3 printing in SAP.

Ps. Do I need to assign A3 format to be default format in that printer?

Is this task for BASIS or ABAP?

Bankly

In printer settings - SPAD - tray info - you can give the Page format for that tray .
did you try setting that ? Try setting DINA3.

Liju

Go to START --> SETTINGS ---> Printers

Right click on HP LaserJet 5100 ... Properties..
General Tab --> Printing Preferences --> Advanced --> Paper Size -->
Change it to 14x11 or A3

and

hplaserjet 5100 --> Properties --> Advanced Tab
Printing Defaults --> Advanced --> Paper Size -> change it to 14x11
or A3

hplaserjet 5100 --> Properties --> Device Settings tab -> Autoselect -
-> A3 or 14x11...

PrakashP

Our ABAPer already changed some attributes(ex. font name & size) in print control of SPAD followed by SAP Notes 21738.

Like this ->
# THSAPWIN Z_65_255

# SAPWIN indicatior makes it possible to send via berkeley protocol
\e%SAPWIN%
# change WinCharSet to 222 (Thai)
\eW222;
# set orientation(LANDSCAPE)
#\ePL
# set font name
\eFAngsana New;
# set font size(5.5ponits)->8p->5.5
\eS220
# set vertical spacing(8.7LPI)
#\el3.0;
# set horizontal spacing(24.0CPI)->20->18 (255/11) ->23
#\ec5.0;
# set top/left margin(1.0cm=568.5)
#\eMT567;
#\eML567;

However, it take moderately time to change font size and test report printing for A3 format.

Thank you for your recommend.

Bankly

I follow by your instruction. It's work well.

Note It doesn't need to setup these config at all.

Tab "Output Attributes"
Paper tray = "Paper tray 3"

Tab "Tray Info"
Tray 3 = "DINA3"

Key points of this solution, If the SAP spool server and the Microsoft Windows spool system are not on the same host, you must create a remote PC connection to the printer and force paper size to be A3 (Prakash's instruction)

By the way, I also adjust HP Laserjet 5100 from "EXEC" to "A3" in Tray 3 physically too. After that I can print ABAP List in A3 Format successfully.

Auto convert spool output to PDF file

As of Release 4.6D, PDF format (Adobe Acrobat data format) can be created via the SAP spooler by using the device type "PDF1".

As a workaround, a report (RSTXPDFT4) is made available for the missing "direct PDF printing", which can read spool requests, convert to PDF and perform a frontend download.

Read OSS Note 317851 - Printing PDF files in 4.6C/4.6B/4.5B

Note the restrictions specified in Note 323736 with the print output with PDF.

Caution when modifying device type ZPDF1, see Note 437696.

Version <4.6d

If you are in version less than 4.6D, you can configure an output type to convert the spool automatically into a PDF format into your local harddisk but not do a "direct PDF printing".

When you print to this PDF output type, it will prompt you to enter the file name of your PDF file to be stored into your local harddisk.

First you have to add a printer using

Windows -> Start -> Settings -> Printers -> Generic / Text Only -> Port : Print to File

Next create a new device type e.g. ZPDF -> Select device type ZPDF1

Options for HostSpoolAccMethod ->

Host spool access method : F : Printing on Frontend Computer

Host Printer : __DEFAULT or Generic / Text Only

Save your entries.

When you print to the device type ZPDF, choose Generic / Text Only for the Frontend Computer if it is not the default type.

A user prompt Print to File will appear to let you specify the Output File Name.

Parallel printing to all the SAP device printers

If you have a situation where reports need to be send to multiple printers, you can configure a pool device type. A pool device type contain a list of SAP printers which the reports will be directed to.

Do this in transaction code SPAD for spool administration.

For example, in SPAD, type ZXXX next to the field 'Output devices',

Click the button Output devices.

In change mode, click the Create button.

Specify the Device type of your printer.

Click the tabstrips 'HostSpoolAccMethod'.

In the field "Host spool access method" set to "P: Device Pool".

Click the tabstrips 'DevicePool'

Click the options "Send to all devices in pool".

Type in the list of the SAP printers device you want the report to go to in this pool under the section 'Pool Device List'.

Now, when the users send a print to the new device for e.g. ZXXX, it will print to all the spool device you have specify.

The above step is done using SAP 4.6c

Print to an USB printer from SAP

Is printing to a USB-printer using LOCL from SAP possible?

Yes, as long as this printer is defined on local workstation, it will work.

SAPLPD doesn't care on how the printer is connected, as long as Windows can print to it, SAPLPD will do its work.

Define one new device, also consider giving :

Device type as SAPWIN

Host Printer __default (yes, two underscores default)

Access Method : F

Make sure your desktop/PC Windows default printer is set to this USB printer.

Mass Lock All Printers with SPAD

If you have lots of printers (50 or more) and need to lock them for maintenance, you can used this mass locked printers tips to locked or unlocked all the SAP printers at one go.

To mass Lock all the printer in SAP:

Go to transaction code SPAD

On top of the screen menu click Utilities -> For output devices -> Export devices

On the screen Import and Export of Device Descriptions:

Export/Import file name: c:\temp\printer.txt

Frontend computer: Tick

Export: Tick

Export Export: Tick

Output device: Choose the Selection options Pattern and type a *
(* for all or a* for all printers starting with a)

Click the Execute button

Open the text file do a replace all of PADISABLED = "" to PADISABLED = "X"

Then import the same file.

or

Another way is to go through each output device in SPAD and click on 'Lock Printer in SAP System' which is in the DeviceAttributes tab