Application Development and Automation 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: 
Read only

Taking printouts while executing a report

Former Member
0 Likes
1,082

Hi,

I have one report which displays output in ALV and the user taking print out of the list using print button. Currently user wants an option to select print functionality in selection screen and based on the selection report should automaticaly gave the print out .

Can i use the below FMs to do this.

SLVC_TABLE_PS_TO_SPOOL -


send the internal table data to Spool.

RSPO_OUTPUT_SPOOL_REQUEST' -


Spool to printer

Please reply.

Regards,

Ratheesh

10 REPLIES 10
Read only

vinod_vemuru2
Active Contributor
0 Likes
1,043

Hi,

Not sure if above works. But you can try in this way.

IF po_print EQ 'X'.  "Selection screen parameter is selected.
PRINT-CONTROL ON.  "Redirect the o/p to spool.
CALL ALV FM
PRINT-CONTROL OFF.

CALL ALV FM again as usual

.

You may need to set the print parameters accordingly and printer is connected to SAP system.

Thanks,

Vinod.

Read only

0 Likes
1,043

Hi ,

Can you tell me what you mean by call the ALV FM again and please tell me how to set the print parameters.

Regards,

Ratheesh BS

Read only

0 Likes
1,043

Hi,

o/p displayed by the first FM call between PRINT-CONTROL statements is sent to the spool. second FM call with same data is used to display on screen. You need to add one more condition for checking sy-batch is initial or not.

IF po_print EQ 'X' AND sy-batch IS iNITIAL. "Means running in foreground.

I think print parameters are taken by default if not specified. First try above solution. If not works you can try setting the print parameters. There is some FM for this. Search in SE37 with SETPRINTPARAM

Thanks,

Vinod.

Read only

0 Likes
1,043

Can you tell me what you mean by call the ALV FM again and please tell me how to set the print parameters

it means the "Reuse_alv_list_display " or "resuse_alv_grid_display" funtion module......

Regards,.

Read only

0 Likes
1,043

Hi,

Call the FM again, call the reuse ALV FM...

I think you got another better solution.(Set IS_PRINT = 'X'). Try this and let us know if it works.

Thanks,

Vinod.

Read only

Sandra_Rossi
Active Contributor
0 Likes
1,043

There is a parameter IS_PRINT to print directly. See demo program BCALV_TEST_FULLSCREEN_PRINT.

Read only

0 Likes
1,043

Hi Sandra,

The example program will Pop up a dialog box for entering the output device, i want to avoid this pop up box.

How can i do this?

Regards,

Ratheesh BS

Read only

0 Likes
1,043

As I can see, it uses REUSE_ALV_GRID_DISPLAY, which then calls form PRINT_PARAMS_SET2 in program SAPLKKBL. There it initializes L_NO_DIALOG variable to 'X' only if it runs in background. Do it using SUBMIT VIA JOB ... and of course you have to define a printer in the job print parameters.

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
1,043

Hello Sandra,

Does this mean we cannot suppress the dialog box when executing the ALV in online mode ?

If i remember correctly the PRIPARAMS in the ALV print params structure has NO_DIALOG field. But it does not seem to work in online mode.

Can you please explain your solution in detail ?

BR,

Suhas

Read only

0 Likes
1,043

> Does this mean we cannot suppress the dialog box when executing the ALV in online mode ?

That's right (at least with REUSE_ALV_GRID_DISPLAY)

> If i remember correctly the PRIPARAMS in the ALV print params structure has NO_DIALOG field. But it does not seem to work in online mode.

No, NO_DIALOG field doesn't exist in PRI_PARAMS. It's only a parameter in GET_PRINT_PARAMETERS function module. As I explained, the only control you have on it is to run it in background.

> Can you please explain your solution in detail ?

You create another program which runs REUSE_ALV_GRID_DISPLAY with IS_PRINT-PRINT = 'X', and you call this program in background using SUBMIT VIA JOB.

If you want more information about SUBMIT VIA JOB, then could you ask a new question. Only one by thread as explained in forum rules. Or, search forum: http://www.sdn.sap.com/irj/scn/advancedsearch?query=pri_paramssubmitvia+job