cancel
Showing results for 
Search instead for 
Did you mean: 

Display sapscript form in Web Dynpro Java

mark_manuel2
Explorer
0 Kudos

Hi,

Is it possible to print an existing sapscript form i.e. PO from ECC to my Web Dynpro application? I have successfully created a Web Dynpro Java application to create POs but now have a requirement to display or print the PO?

Can someone provide me with a sample code? I'm hoping to be able to do this without using Adobe.

Again, thanks for all your help.

Best regards,

Jaypee

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi mark,

Without Adobe also u can display PO order.

Below is the code to open a HTML window from WDJava, with data from WDJava...

Inside DoInit()

IWDAttributeInfo attr1 =

wdContext.getNodeInfo().getAttribute("htmlfile");

ISimpleTypeModifiable mtype1 = attr1.getModifiableSimpleType();

IWDModifiableBinaryType btype1 = (IWDModifiableBinaryType) mtype1;

btype.setFileName(attr.getName() + ".html");

btype.setMimeType(WDWebResourceType.HTML);

_contentType = mtype;

Where htmlfile is a context attribute of type binary... and do a global declaration like this

ISimpleTypeModifiable _contentType = null; (This declaration can be done at the end of your view's coding between Begin Others and End Others)

Now,

inside on action print

public void onActionPrintData(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent, java.lang.String videoName )

{

//@@begin onActiondisplayVideo(ServerEvent)

byte[] content = new byte4028;

try {

content = this.displayPrint().getBytes("UTF-8");

wdContext.currentContextElement().setHtmlfile(content);

wdContext.currentPrintElement().setAttrUrl(

_contentType.format(content));

//Where content is loaded with data from displayPrint() method, which is holding the HTML *page to be displayed to the user *

IWDWindow win =

wdThis

.wdGetAPI()

.getComponent()

.getWindowManager()

.createNonModalExternalWindow(WDWebResource

.getWebResource(content, WDWebResourceType.HTML)

.getURL(),"ShowVideo");

win.setWindowSize(445,460);

win.removeWindowFeature(WDWindowFeature.ADDRESS_BAR);

win.removeWindowFeature(WDWindowFeature.TOOL_BAR);

win.removeWindowFeature(WDWindowFeature.MENU_BAR);

//win.open();

win.show();

// wdComponentAPI.getMessageManager().reportSuccess("444444444444");

} catch (Exception e) {

wdComponentAPI.getMessageManager().reportException ("Unable to open window"+e,false);

}

//@@end

}

Now finally, design your HTML Page inside the method displayPrint() like this

public java.lang.String displayPrint( java.lang.String strVideoName )

{

//@@begin displayPrint()

String htmlcontent=null;

htmlcontent="content what you want to show in print window";

use script inside the html content to do a print... like window.print();

return htmlcontent;

//@@end

}

Regards,

Sunaina Reddy T

Former Member
0 Kudos

This message was moderated.

Former Member
0 Kudos

Hi Mark

Please check this link .You fine forume ,blog etc about sapscript

https://www.sdn.sap.com/irj/scn/advancedsearch?query=displaysapscriptforminWebDynproJava

Regards

Ruturaj