Skip to Content

HTML view in Web Dynpro

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

6 Answers

  • Best Answer
    avatar image
    Former Member
    Jun 25, 2007 at 06:28 PM

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

    Regards

    Firasath

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jun 25, 2007 at 12:47 PM

    Hi..

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

    Regards,

    Arun

    Add comment
    10|10000 characters needed characters exceeded

  • Jun 25, 2007 at 12:52 PM

    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

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      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

  • avatar image
    Former Member
    Jun 25, 2007 at 02:35 PM

    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.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Nov 11, 2011 at 11:59 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • Jun 25, 2007 at 01:09 PM

    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

    Add comment
    10|10000 characters needed characters exceeded