Skip to Content
author's profile photo
Former Member

printing in web dynpro via javascript

Hi all

I'm having difficulties adding the functionality to print a report (a table) in web dynpro

What I've done so far:

  • I've created a view with a 'print' button

  • I've linked the print button to a action called 'onActionPrint'

  • I've created a controller context value called 'urlToPrintPage' and linked it to my view's context. The variable is of type string

  • I've created a html page with the following code (printing.html):

<html>

<head></head>

<body>

<button onclick="window.parent.print()">Print</button>

</body>

</html>

  • I've copied the printing.html file to MyProject/src/mimes/Components/MyComponent/printing.html (locally and not onto the server since I would think that the printing.html would be deployed as well)

  • Within the 'onActionPrint' method I've placed the following code:

wdContext.currentContextElement().setUrlToPrintPage("/path/to/where/this/file/is/located/printing.html");

  • From a previous thread which is answered (message id: 3314996) the contributor used the url:

wdContext.currentPrintElement().setAtrURL("/irj/go/km/docs/documents/print/print.html");

  • I assume that the currentPrintElement would be the same as using the currentContextElement and that setAtrURL would be the same as setUrlToPrintPage in my case?

The file gets deployed to:

C:\usr\sap\J2E\JC01\j2ee\cluster\server0\temp\webdynpro\web\local\MyProject\Components\com.lonmin.bns.view.webdynpro.MyApplication\printing.html

I tried to access the file with an absolute url, but no joy (anyways the url looks like a temporary one...)

Could anyone please help to clear my understanding of this printing sollution?

Regards

Anton

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

2 Answers

  • author's profile photo
    Former Member
    Posted on Sep 28, 2007 at 08:06 AM

    this is unanswered

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Posted on Sep 28, 2007 at 08:11 AM

    Hi,

    Try this:

    <b>wdContext.currentContextElement().setUrlToPrintPage("printing.html");</b>

    Warm Regards,

    Murtuza

    Add comment
    10|10000 characters needed characters exceeded