cancel
Showing results for 
Search instead for 
Did you mean: 

Print in WebDynPro

Former Member
0 Kudos

Hi All,

I know this issue is discussed earlier. I am using NW 2004s SP 10.

Is there any new feature which allows us to print the view content.

My requirement is I have a view in which user enters data. I provide a print button when user clicks this,

a new external window(with all the element and data of the present window) should popup and browser print function should be invoked.

1)Modalwindow is good for this but it should open in a new browser.

2)If I use createExternalwindow() how to share data from present window. Because it is a new applicaiton.

3) How to invoke browser print function.

Please give me some detailed explanation. Points will be awarded.

Thanks a lot in advance.

Joe

Accepted Solutions (0)

Answers (3)

Answers (3)

former_member185029
Active Contributor
0 Kudos

Hi,

Recommended way is to export the data in printable format (PDF/HTML/Excel) and then allow user to print.

Regards,

Ashutosh

Former Member
0 Kudos

Hi,

See if this blog is of any use for you.

/people/community.user/blog/2007/08/20/open-views-in-non-modal-external-windows--the-patch-version

Thanks & Regards,

Sudhir

former_member1
Active Participant
0 Kudos

Hi,

You can open an External window with passing all the data in HTML format.And in the Button for print you can give window.print();

Regards,

Anish

Former Member
0 Kudos

Hi Anish,

Thanks for your quick response. Could you please explain me in detail.

Joe

former_member1
Active Participant
0 Kudos

Hi Sreekanth,

<b>Create the context Variables</b>:

AttrUrl of type string

htmlfile of type binary

<b>Create an action called Print()</b>

In Print Action Declare a Variable byte[] content = null;

<b>Eg:</b>

public void onActionPrintFriendly(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent ){
byte[] content = null;
content = ("<html><head><title>abc</title></head><body><form>The Title is::"+wdContext.currentDetailNodeElement().getTitle()+"<br><INPUT TYPE=BUTTON value=Print name=button1 onClick=javascript:window.print()>").getBytes("UTF-8");

wdContext.currentContextElement().setHtmlfile(content);
wdContext.currentContextElement().setAttrUrl(_contentType.format(content));
}

<b>Atlast define the Attribute</b>:

ISimpleTypeModifiable _contentType = null;

I hope this will help.

Regards,

Anish

former_member185029
Active Contributor
0 Kudos

Anish,

I tried your code..

It does not work for me

Problem 1

NullPointerException at following code.

wdContext.currentContextElement().setAttrUrl(_contentType.format(content));

Problem 2:

When the above problem is rectified and the application is executed, nothing happens on button click.

Ashutosh