Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to check if the given Printer exists?

Former Member
0 Kudos

Hello Experts,

I'm writing a Batch Program where in it has P_File & P_Printer (File Path and Printer path with names).

I want to check if the provided value for P_PRINTER (the Printer name) exists or not. For example, we check for the File names exists.

I searched in SCN, but couldn't find a relevant thread. Is GET_PRINT_PARAMETERS FM used ti check? If yes, how?

Is there any Function Module to check if the Printer (input given in Selection-screen) exists or not?

Awaiting reply..

Thanks in advance.

Best Regards,

Sowmya

1 ACCEPTED SOLUTION

obadiah_king
Explorer
0 Kudos

You will just need to check table tsp03d.

SELECT COUNT(*)

  FROM tsp03d

WHERE name = p_printer

   AND padisabled = abap_false.

IF sy-subrc = 0. "Printer exists and is not locked

  "Do something

ENDIF.

9 REPLIES 9

former_member203305
Active Contributor
0 Kudos

Hello.

Check the table TSP03D, that table contains the name of the Printers on SAP.

Regards

siva_subramanian2
Participant
0 Kudos

Hi Sowmya,

Check the 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

This might help.

Thanks

Siva

obadiah_king
Explorer
0 Kudos

You will just need to check table tsp03d.

SELECT COUNT(*)

  FROM tsp03d

WHERE name = p_printer

   AND padisabled = abap_false.

IF sy-subrc = 0. "Printer exists and is not locked

  "Do something

ENDIF.

former_member182041
Active Contributor
0 Kudos

Hi,

I am not sure of any standard FM to validate the printer name but table TSP03 can certainly be used to validate the printer . Thanks.

Regards,

Kumud

0 Kudos

Dear Sowmya,

I agree with Siva Subramanian and table TSP03 can be used to check the the printers even it is a check table for foreign key table TSP03C, TSP01.

Hope this helps you.

Kindly let me know your feedback.

Thanks & Regards,

Vignesh Yeram

raymond_giuseppi
Active Contributor
0 Kudos

This message was moderated.

Former Member
0 Kudos

Hi,

By using the table TSP03 you can know whether a printer exits or not.

Regards,

Vineesh.

Former Member
0 Kudos

Hi Sowmya,

Check this " RSPO_DEVICE_GET"  FM , Just Pass "Output Device Name " in NAME like 'LP01'.

you got Printer Name with Path from this field "S_PAPROSNAME" , you can cross check with SPAD T-code -->Access Method Tab--> Host Printer filed name .

Also Check in  SE37   " RSPO* " and press F4  you got Some FMs

OR  Check this Piece of Code .

TABLES: TSP03D.


PARAMETERS :

S_DEVICE(30) OBLIGATORY LOWER CASE DEFAULT 'LP01'"Output Devices like LP01,LOCL

*

FORMAT INTENSIFIED OFF.

SELECT SINGLE * FROM TSP03D WHERE

NAME = S_DEVICE.

IF SY-SUBRC EQ 0.

   WRITE : / TSP03D-NAME COLOR COL_HEADING INVERSE.

   WRITE : / TSP03D-PADEST, '<< short name  !'.

   WRITE : /6 TSP03D-PASTANDORT.

   WRITE : /41 TSP03D-PATYPE.

   WRITE : /52 TSP03D-PAMSSERVER.

   WRITE : /61 TSP03D-PAPROSNAME.

   WRITE : /72 TSP03D-PALPDHOST.

Regard's

Smruti

0 Kudos

I've got similar requirement recently.

Declaring parameter like following should solve the issue.

Parameters:

     p_prntr TYPE SYPDEST.

Conversion routing 'SPDEV'  does all the necessary checks.