cancel
Showing results for 
Search instead for 
Did you mean: 

Printing from webdynpro

vijay_ramarao
Explorer
0 Kudos

Hi All,

In my webdynpro I have 2 buttons PREVIEW and PRINT.

With PREVIEW button click Iu2019m able to open my custom built adobe form in a separate window. Working fine and no issues here.

With PRINT button click, I have to send the same form directly to the local printer. I have written the below code for button event.

DATA: fm_name TYPE funcname,

fp_outputparams TYPE sfpoutputparams,

fp_docparams TYPE sfpdocparams,

fp_formoutput TYPE fpformoutput.

CALL FUNCTION 'FP_FUNCTION_MODULE_NAME'

EXPORTING

i_name = 'YICS_RECEIPT'

IMPORTING

e_funcname = fm_name.

fp_outputparams-device = 'PRINTER'.

fp_outputparams-nodialog u2013 abap_true.

fp_outputparams-preview = abap_false.

CALL FUNCTION 'FP_JOB_OPEN'

CHANGING

ie_outputparams = fp_outputparams.

CALL FUNCTION fm_name

EXPORTING

/1bcdwb/docparams = fp_docparams

i_header = ls_header

it_item = it_item

i_cmode = ls_cmode

it_acc = it_acc

IMPORTING

/1bcdwb/formoutput = fp_formoutput.

CALL FUNCTION 'FP_JOB_CLOSE'.

Once I click on the PRINT button, Iu2019m able to see an entry in spool list with status u2018COMPLu2019 in green color, but the output is not printed to the printer. When I double click on the status Im seeing the below spool information.

Description Value

Status: Compl.

Last event:

Message: Front end did not get print data after timeout

Date: 25.03.2010

Time: 18:10:48

Job status: Waiting for spool server

Error class: Problem

Some more information:

In SE38 I have created an executable program and executed the same above code, form has been printed to the printer. Same code is working fine through GUI, but not working with webdynpro button event.

With basis help I have configured new output device ZLP01 with below parameters.

Device Type: PDF1

Device Class: Space (Standard Printer)

Access Method: G (Front End Printing with Control Tech)

Host Printer: __default

Regards,

Vijay.

Accepted Solutions (1)

Accepted Solutions (1)

ChrisPaine
Active Contributor
0 Kudos

Hi Vijay,

I'm not 100% sure - but I think your issue is that you are trying to print directly to the users local printer? And you are trying to use the standard SAP local printer setup to do that?

That uses the GUI as a conduit to the PC - the print driver that pops up in the background when you print from the GUI...

In Web Dynpro - you have no access to that conduit so no ability to directly print.

Think about how any web pages you've visited allow you to print - they all give you a preview - it's up to you as a user to then get those previews to your print device.

have a read of this reference - it may help understand the issue with "auto printing" from a browser

[why printing from a browser is problematic|http://javascript.about.com/od/events/a/print.htm]

Hope this helps,

Cheers,

Chris

vijay_ramarao
Explorer
0 Kudos

Thanks Chris for your reply. Looks like printing is not possible from webdynpro screens.

Friends, any more suggestions.

Regards,

Vijay.

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi ,

The problem is the way the printer was defined by your basis folks: <em>Access method G</em> cannot be used, see OSS note [616762 - Front-end printing in BSP or Web Dynpro applications|https://service.sap.com/sap/support/notes/616762] for further details on how to proceed.

Cheers, harald

Former Member
0 Kudos

we can achieve by changing the code in the driver program as foolows

CS_OUTPUTPARAMS-NOPRINT = GC_TRUE.

Change this parameter to GC_FLASE and through webdynpro print will come for PDF

thansk