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: 

Printing directly to a printer from an ABAP program

Former Member
0 Kudos

Hello,

In my ABAP program, I have a string that contains ZPL code. I'd like to send that string directly to a label printer. If I were to take that string and copy it into a text file called LABEL.TXT and then run "COPY C:\LABEL.TXT LPT1" from a command prompt, the label prints successfully. I'm looking for the same kind of functionality from within ABAP. Does anyone know how to do this?

Thank you,

4 REPLIES 4

former_member194669
Active Contributor
0 Kudos

Try this way

1. Using fm GUI_DOWNLOAD please download to C;

2. Call fm GUI_RUN with COMMAND = 'copy c:lable.txt lpt1'

PS : I am not 100% sure about this.

0 Kudos

I tried using GUI_RUN but I get an error saying file doesn't exist. I think it is looking for the actual COPY.EXE file and it can't find it.

Isn't there a way to print directly to the printer in ABAP using the PRINT and PRINT-CONTROL commands?

thank you

0 Kudos

I tried this but nothing prints:

DATA: PARAMS LIKE PRI_PARAMS,

VALID TYPE C.

CALL FUNCTION 'GET_PRINT_PARAMETERS'

IMPORTING OUT_PARAMETERS = PARAMS

VALID = VALID.

IF VALID <> SPACE.

NEW-PAGE PRINT ON PARAMETERS PARAMS NO-DIALOG.

WRITE / MY_LABEL.

NEW-PAGE PRINT OFF.

ENDIF.

0 Kudos

hi i had a requirement where when u execute the report it should directly go to the printer , can anybody help me

regards

bhanu