cancel
Showing results for 
Search instead for 
Did you mean: 

HTML view in Web Dynpro

0 Kudos

Hello everybody,

I'm developing an application and i need to display a html page inside a view.

I'm developing in SAP NetWeaver Developer Studio, Version: 7.1.0 and UI element like iFrame, or IView does not exists.

Do you have a suggestion, idea or advice?

Thank you,

Constantin

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Use LinkTOURL element and set the reference property to the html link you want to open.

Regards

Firasath

Former Member
0 Kudos

Hi Riyaz,

Please go through the link below, which is a similar kind of thread

regards

Anil

Answers (5)

Answers (5)

Former Member
0 Kudos

Hi,

very simple ..

Inclued a iframe element ,

Just in source specify the html page name.

Store the HTML file it in src>MIMEs>Components> if any package appears store it in that

ADjust the height and width as required...

Also on click od linktoUrl u can open that file:

Just specift the complete path as in reference ../../../resources/sap.com/ifrstool/Components/com.sap.ifrs.comp.IFRSComp/Video.html

U can get this path from the page view Source incase u have added any image as such u can get that path from their also just replace the last image name with html page name

i had included video in html page and displayed :

<html>

<head>

</head>

<body>

<OBJECT ID="MediaPlayer" WIDTH="192" HEIGHT="190" CLASSID="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95" STANDBY="Loading Windows Media Player components..." TYPE="application/x-oleobject">

<PARAM NAME="FileName" VALUE="Proton.wmv">

<PARAM name="ShowControls" VALUE="true">

<param name="ShowStatusBar" value="false">

<PARAM name="ShowDisplay" VALUE="false">

<PARAM name="autostart" VALUE="false">

<EMBED TYPE="application/x-mplayer2" SRC="Proton.wmv" NAME="MediaPlayer" WIDTH="192" HEIGHT="190" ShowControls="1" ShowStatusBar="0" ShowDisplay="0" autostart="0"> </EMBED>

</OBJECT>

</body>

</html>

Thanks if you need any more info..............reply

hope this works

siddharth_jain
Active Contributor
0 Kudos

Hi Constantin,

For writing Html in iFrame u can use com.lowagie.text package and u can use these inbuild classes.

com.lowagie.text.BadElementException;

com.lowagie.text.Cell;

com.lowagie.text.Chunk;

com.lowagie.text.Document;

com.lowagie.text.DocumentException;

com.lowagie.text.Element;

com.lowagie.text.Image;

com.lowagie.text.Paragraph;

com.lowagie.text.Table;

com.lowagie.text.html.HtmlWriter;

com.lowagie.text.rtf.style.RtfFont;

first u have to create a method

like this

private void <method name>() {

try {

String filename = this.<name/id> + ".html";

IPrivateView.IContextElement elem =

wdContext.createContextElement();

elem.setRTFOutPut(getBytesFromFile(new File(filename)));

final IWDCachedWebResource resource =

WDWebResource.getWebResource(

elem.getRTFOutPut(),

WDWebResourceType.HTML);

//resource.setResourceName("HTML_inline.html"); original

resource.setResourceName("HTML_inline"this.<name/id>".html");

resource.setAttachement(false);

resource.setReadOnce(false);

wdContext.currentContextElement().setUrl(resource.getAbsoluteURL());

} catch (WDURLException e) {

logger.errorT(e.getMessage());

wdThis.wdGetPortfolioMessagesInterface().reportError(

"<custom message",

<Parameters>,

true);

//wdComponentAPI.getMessageManager().reportException(new WDNonFatalException(e), false);

//e.printStackTrace();

}

than for writing in iframe create a method like this.

private void generateIframe() {

String newLine = "";

Document doc = new Document();

String filename = this.<name/id> + ".html";

HtmlWriter html = null;

try {

RtfFont rtffontN = new RtfFont(FONT, FONT_SIZE, RtfFont.NORMAL);

RtfFont rtffont = new RtfFont(FONT, FONT_SIZE, RtfFont.BOLD);

RtfFont headfont = new RtfFont(FONT, 12, RtfFont.BOLD);

DataOutputStream ds =

new DataOutputStream(new ByteArrayOutputStream());

ds = new DataOutputStream(new FileOutputStream(filename));

html = HtmlWriter.getInstance(doc, ds);

//html = HtmlWriter.getInstance(doc,new FileOutputStream(filename));

doc.open();

//now here u can use the classes like Cell ,table,Document for writing the html code in the iFRAME .for more information on this u can refer this site all the api documentation is given here.

http://itext.ugent.be/library/api/

after writing the html code using com.lowagie.text package.

at the end call the method which u declared earlier to this method.and create a context element URL map it to the source of Iframe in properties view.

Please Reward points for an helpfull answer.

Regards,

Siddharth jain.

0 Kudos

Thank you for the answer,

...but i don't want to display the page in a window (new or existing).

I want to have the page displayed in one view inside a window.

I want to obtain the old "IFrame effect".

Constantin

Former Member
0 Kudos

hi Constantin,

You can make use of the suspend resume plugs.This enables you to call an external application within the same page.

<a href="http://help.sap.com/saphelp_nw04s/helpdata/en/45/19bf8c16f25d7ae10000000a11466f/content.htm">Suspend Resume Calls</a>

Regards

Amit

0 Kudos

Yes,

For example i have a window composed by 3 view and in one view i want to display a html page like www.sap.com.

Regards,

Constantin

Former Member
0 Kudos

Hi..

first u have to create one button...after that u have to write onaction in corresponding button

IWDWindow window=wdComponentAPI.getWindowManager().createExternalWindow("http://www.sap.com","Sap page",false);

window.open();

Regards,

Arun

Former Member
0 Kudos

Hi..

Do u want to bring an already existing HTML page in a view?

Regards,

Arun