cancel
Showing results for 
Search instead for 
Did you mean: 

Printing from BSP Application

Former Member
0 Kudos

Hi,

In my BSP, there is a button used for printing the page. when user clicks on that button, that page should get printed on printer. Is there any function module to do it?

Regards

Jyoti.

Accepted Solutions (1)

Accepted Solutions (1)

athavanraja
Active Contributor
0 Kudos

Hi,

you can just use javascript function to do that.

see the sample below.


<htmlb:button id            = "printButton"
              text          = "Print"
              tooltip       = "Click here to print"
              onClientClick = "javascript:window.print()"
              design        = "small"
              width         = "50" />

Regards

Raja

Former Member
0 Kudos

Qucik and simple - good job Raja!!

Also note there are some problems with printing some of the BSP Elements - colors, graphics and things sometimes don't look exactly right.

maximilian_schaufler
Active Contributor
0 Kudos

Yes, to add on to Craig's mentioned printing problems:

In Internet Explorer, go to menu Extras -> Internet Options -> Advanced:

There look for Printing, and the Checkbox "Print background colors and images" - check this setting when/before printing your pages, to make sure you will get the right output.

Former Member
0 Kudos

Oh forgot about that Max!

You can also find a hack on the internet regarding making that a standard setting where as lots of installs come with that as unchecked.

Answers (1)

Answers (1)

Former Member
0 Kudos

Thanks Raja..

It worked.

Regards

Jyoti.

Former Member
0 Kudos

Please be sure to give Raja the points they deserve!

athavanraja
Active Contributor
0 Kudos

Tough luck Craig!. Didnt get the points.

Former Member
0 Kudos

Oh come on Raja, not tough luck it's only tough luck if you pass me up

former_member181879
Active Contributor
0 Kudos

> Didnt get the points.

Now you did

Yes, unfortunately the discipline to just close the loop is not always there. Soon changes in forum might make this easier (more intuitive) in the next many weeks. I am just tired of chasing people.

brian

PS: If you don't mind, I will put this answer into FAQ?

athavanraja
Active Contributor
0 Kudos

Thanks Brian.

No problem, go ahead and put it in the FAQ.

Regards

Raja

maximilian_schaufler
Active Contributor
0 Kudos

Btw, does any of you have any idea how to set the printing layout of the browser from within a page?

I did some research on various sites, but couldn't find anything useful - maybe there is a different (and easy) way to do this.

Former Member
0 Kudos

Print layout is a topic in its own right.

The best way to solve the issue is to define

a custom style sheet that you use in addition to the standard SAP stylesheet.

Define the style sheet and save it in the mime repository. (inline in each BSP is also possible)

when you linke the style sheet include,

you should specify <b>MEDIA = PRINT</b>

so that the stylesheet is only used when printing.

here an article on the web about this concept.

<LINK rel="stylesheet" type"text/css"

href="print.css" media="print">

http://www.meyerweb.com/eric/articles/webrev/200001.html

The CSS can be used to hide elements you dont want printed. And to move (to some extent) elements.

Do some research on on CSS on the web.

pay specific attention to the

"! important " attribute.

an example.

.classvalue

.anotherclass

but with the complexity of the underlying stylesheet

and classes defined, it can be a big job trying to re-align everything.

But changing the colors and other formatting features

is approachable.

good luck.

Phil.

maximilian_schaufler
Active Contributor
0 Kudos

ok, I didn't state my problem clear enough ...

I'm familiar with css and the possibilites you have with it - also that there is a parameter called "size" in printing (defining the page layout: portrait or landscape) defined for the CSS2 standard, but this parameter is not interpreted by any browser around.

So it's not the layout (displaying elements in different way) "within" the page, but the page layout itself - paper format so to say

I want to set printing format to landscape for my application.

Former Member
0 Kudos

Ok, now I know what you are trying to do.

I know of only 1 way to solve this issue.

A very ugly word. Active X.

Using the event "beforeprint", or whatever trick,

to start the active X.

A pdf version sounds better ?

anyway...

no nice solution I fear.

Cheers

maximilian_schaufler
Active Contributor
0 Kudos

> A pdf version sounds better ?

You mean generating a PDF from the page displayed in the browser?

That would require PDF writer to be installed on the client, wouldn't it? That's very unlikely to happen in our environment.

former_member181879
Active Contributor
0 Kudos

No, it means taking the data you have in the back-end and generating a complete new PDF representation of the data. Typical example, on screen you show a confirmation of an order. In the print view (which is PDF file), you include things such as your company logo, etc.

maximilian_schaufler
Active Contributor
0 Kudos

So, is there some kind of pdf converter to use from within bsp application?

As I have only started with SAP software a few months ago, I do not have any experience other than my WAS, basic ABAP knowledge and some administrative use of a few SAP transactions outside WAS - so there might be something that a "regular" SAP developer should know which I haven't heard of yet.

former_member181879
Active Contributor
0 Kudos

There is no such a thing as BSP-->PDF. There are many ways to create PDF files within WebAS systems of which I know none. But this forum is full of snippets of information on this topic. Why not search it through?

maximilian_schaufler
Active Contributor
0 Kudos

Maybe will do so if it is necessary after our application is finished - it's not my main task, just added a printing question because it fit in here ...

Thx anyways

athavanraja
Active Contributor
0 Kudos

Small addition to the example:

Scenario: When the print button is clicked if you want to print printable version of the page (stored separately) instead of the page currently showing

you could put the following tag in your <head> </head>

section of the page

<link rel=alternate media=print href="printableversion.htm">

Regards

Raja