cancel
Showing results for 
Search instead for 
Did you mean: 

Printing from wda

Former Member
0 Kudos

Hi experts,

I have a question for you. I have a simple table with many rows. This table isn't a ALV table, so I don't have automatically the button "Print Version". Are there methods (that I can to associate at button) for wda that allow to print directly the table bypassing the "Print Version" of ALV table?

Thanks a lot.

Accepted Solutions (0)

Answers (1)

Answers (1)

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

Short answer - no. The ALV print is fairly complicated and integrated into the ALV framework. It isn't something designed to accessed from outside the ALV component.

That said, you can do a simple print from an ABAP table using the old classic dynpro ALV routines. I've got a code sample for this that I adapted from its original usage in BSP - but works fine in WDA as well (adjusting for the message management and some other minor differences):

http://code.google.com/p/abap-sdn-examples-tpj/downloads/detail?name=NUGG_WEB_PRINT_TABLE.nugg&can=2...

In NetWeaver 7.02 there is also an API to trigger browser printing, but you would have to change the visibleRows on your table to -1 to display all rows on the client in order to print them all (and with a large table that might not be advisable).

ChrisPaine
Active Contributor
0 Kudos

>The ALV print is fairly complicated and integrated into the ALV framework. It isn't something designed to accessed from outside the ALV component.

this very true - but does not exclude you from trying!

That said - why would you want to "print" to PDF (sorry that's the functional consultant overriding the techy within) when you have the option to export to Excel?

The ALV export to Excel functionality is not that complex - and I've posted a weblog on how this can be used from any WDA table. [Weblog - Using WD ABAP ALV export - the hacked way|/people/chris.paine2/blog/2010/06/11/using-wd-abap-alv-export--the-hacked-way], but as I mention in the blog - perhaps SAP didn't design the solution expecting us to use it like this.

Recently there has been the announcement of the first release of the abap2xlsx project - that's another option...

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

>why would you want to "print" to PDF

Who said anything about PDF. The solution I posted above prints the content directly to the SAP Print Spooler. So the benefit of this approach is output via the already setup backend print queues without having to go to any intermediate format (PDF or Excel).

Former Member
0 Kudos

Yes, in effect I needed a solution without any intermediate format. Tks Thomas.

ChrisPaine
Active Contributor
0 Kudos

Sorry Thomas I didn't mean to demean your code, I was referring to the ALV "print" functionality - not your (Thomas') solution. I've been getting into a bit of trouble the last few weeks using "you" when a "one" might be a better pronoun.

Managing all the user's printers though, isn't that likely to be problematic? I don't think there is any WD component built to allow setting of user's default printer? Although I imagine it wouldn't be too hard to build. Unless there is now some sort of way that users can print to a generic print server and then log-on at any printer in the company and retrieve the output. (I wouldn't be surprised - I am so out of touch with printing, I try to live as "paperless office" as possible (although you wouldn't believe it if you saw my home office desk))

The ability to force a hard copy which the user could not alter in anyway would certainly be an interesting idea for many companies I work with, if they had some easy way to set the printer used. With most of the companies I deal with now, only 1 or 2 printers are actually set up in SAP, as everyone tends to just use their local printer and the SAPLPD or SAPSprint service.

I wonder if it would be possible to write a utility to read from a spool and pass through to local application that could using ACFUpDownload to pass the spool and then ACFExecute to launch the app to send the spool to the default printer (possibility using SAPSprint, possibly not...)

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

>Thomas I didn't mean to demean your code

Don't worry, I didn't take any offense.

>Managing all the user's printers though, isn't that likely to be problematic?

The company I used to work for already had thousands of printers setup on the SAP Print Spooler. This isn't that uncommon for long time SAP installations (There was a time when there was no local/frontend printing). At my old company we even had printers that were only setup on SAP and didn't allow Windows Print Queue access.

>I don't think there is any WD component built to allow setting of user's default printer?

I believe that souce code nugget above has a printer selection dialog (for backend print queues and settings) implemented in WDA as a reusable component. If not, it is in a separate nugget as I have built this.

>Unless there is now some sort of way that users can print to a generic print server and then log-on at any printer in the company and retrieve the output

Actually that is possible as well. There is a spool monitor. You can send output to a generic printer (not acutally attached to any physical printer) and then use Output Control (transaction SP01) later to view, print (to a different queue), download, etc.

ChrisPaine
Active Contributor
0 Kudos

>then use Output Control (transaction SP01) ...

ahh, but that would mean unfortunately needing SAP GUI/Business Client access.

>This isn't that uncommon for long time SAP installations

I know, I've been at some of these places - and at one of them when the Basis team finally threw in the towel (feed up of maintaining all the printers, they almost had a person employed doing just that) deleted all but 3, One for Finance, one for HR team and one for Payroll team and changed everyone to using SAPLPD.

Anyway I should stop spamming this poor person's forum post before I get a slap on the wrist from a moderator - thanks for the clarifications!

Chris

Former Member
0 Kudos

Hi Thomas,

I need your help to use this functionality. I am using the importing parmeter col_def to set the title of the coulmns but I am not able to see the title completely , so i guess I have to use the width field to set the column width but still it is not working fine. Can you suggest any thing to set the width automatically as per the title of the columns.

Thanks a ton in advance ,

Shilpa