CL_GUI_HTML_VIEWER and external javascripts

Hi,
is it possible to display HTML document what has a reference to the external file with javascripts (but it could be CSS styles as well ) what were generated by abap program as well.
So I need to generate a file with javascripts. Download it to the workstation and later display a HTML page in HTML viewer what has a reference to generated external file.
Thank you for any help.
Marian

Hi ,
I dont really understood the problem what you have but can give as simple sample code. This code reads a .txt file containg a html code and shows the output on html viewer.
*& Report  ZHTML_PROG                                                  *
REPORT  ZHTML_PROG                              .
data: custom_control    type ref to  cl_gui_custom_container,
      html_control      type ref to  cl_gui_html_viewer,
      html_handle       type ref to  html_events.
data:it_W3HTML type standard table of W3HTML with header line.
  data:HTML type standard table of W3HTML with header line.
DATA:  doc_url0(80),
       doc_url(80),
      alignment         type i,        " Ausrichtung tree_control
      okcode type sy-ucomm.
CONSTANTS: ALIGN_AT_LEFT           TYPE I VALUE 1.
CONSTANTS: ALIGN_AT_RIGHT          TYPE I VALUE 2.
CONSTANTS: ALIGN_AT_TOP            TYPE I VALUE 4.
CONSTANTS: ALIGN_AT_BOTTOM         TYPE I VALUE 8.
CONSTANTS: ALIGN_CENTERED          TYPE I VALUE 16.
start-of-selection.
call screen 9006.
end-of-selection.
*&      Form  call_context_menu
      text
     -->P_ACTION  text
FORM call_context_menu  USING    P_ACTION.
ENDFORM.                    " call_context_menu
*&      Module  display_html  OUTPUT
      text
MODULE display_html OUTPUT.
set pf-status '9006'.
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
  CODEPAGE                      = ' '
   FILENAME                      = 'D:\281143\Sandy_signature\html.TXT'
  FILETYPE                      = 'ASC'
  HEADLEN                       = ' '
  LINE_EXIT                     = ' '
  TRUNCLEN                      = ' '
  USER_FORM                     = ' '
  USER_PROG                     = ' '
  DAT_D_FORMAT                  = ' '
IMPORTING
  FILELENGTH                    =
  TABLES
    DATA_TAB                      = it_W3HTML[]
EXCEPTIONS
  CONVERSION_ERROR              = 1
  FILE_OPEN_ERROR               = 2
  FILE_READ_ERROR               = 3
  INVALID_TYPE                  = 4
  NO_BATCH                      = 5
  UNKNOWN_ERROR                 = 6
  INVALID_TABLE_WIDTH           = 7
  GUI_REFUSE_FILETRANSFER       = 8
  CUSTOMER_ERROR                = 9
  NO_AUTHORITY                  = 10
  OTHERS                        = 11
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CREATE OBJECT CUSTOM_CONTROL
  EXPORTING
    CONTAINER_NAME              = 'CONTAINER'
CREATE OBJECT HTML_CONTROL
  EXPORTING
   SHELLSTYLE         =
    PARENT             =  CUSTOM_CONTROL
   LIFETIME           = LIFETIME_DEFAULT
   SAPHTMLP           =
   UIFLAG             =
   NAME               =
   SAPHTTP            =
   QUERY_TABLE_DISABLED =
EXCEPTIONS
   CNTL_ERROR         = 1
   CNTL_INSTALL_ERROR = 2
   DP_INSTALL_ERROR   = 3
   DP_ERROR           = 4
   others             = 5
  alignment = align_at_left + align_at_right + align_at_top +
              align_at_bottom.
  CALL METHOD html_control->set_alignment
    EXPORTING
      alignment = alignment.
CALL METHOD HTML_CONTROL->LOAD_DATA
  EXPORTING
   URL                  =
    TYPE                 = 'text'
    SUBTYPE              = 'html'
   SIZE                 = 0
   ENCODING             =
   CHARSET              =
  IMPORTING
    ASSIGNED_URL         = doc_url0
  CHANGING
    DATA_TABLE           = it_W3HTML[]
EXCEPTIONS
   DP_INVALID_PARAMETER = 1
   DP_ERROR_GENERAL     = 2
   CNTL_ERROR           = 3
   others               = 4
  APPEND:
  '<html><frameset>' TO html.
  CONCATENATE
  '<frame name=Frame0 src="'
  doc_url0
  '" scrolling=auto >'
  INTO html.
  APPEND html .
  APPEND:
'</frameset></html>' TO html.
create final link to welcome-screen;
  CALL METHOD html_control->load_data
    EXPORTING
      type                 = 'text'
      subtype              = 'html'
    IMPORTING
      assigned_url         = doc_url
    CHANGING
      data_table           = html[]
    EXCEPTIONS
      dp_invalid_parameter = 1
      dp_error_general     = 2
      OTHERS               = 3.
  IF sy-subrc = 0.
  ENDIF.
  CALL METHOD html_control->show_data
    EXPORTING
      url = doc_url0.
ENDMODULE.                 " display_html  OUTPUT
*&      Module  USER_COMMAND_9006  INPUT
      text
MODULE USER_COMMAND_9006 INPUT.
if okcode = 'BACK'.
leave program.
endif.
ENDMODULE.                 " USER_COMMAND_9006  INPUT

Similar Messages

  • Jspx and external javascript file (display empty page ?!?!)

    I have created a JSPX file...
    Now I want to add a javascript control to verify that only numbers are pressed from keyboard..
    This is a simple javascript function:
    function isNumberKey(evt)
    var charCode = (evt.which) ? evt.which : event.keyCode
    if (charCode > 31 && (charCode < 48 || charCode > 57))
    return false;
    return true;
    When I add a function directly to jspx I get error in phase of compile of the page...
    So I tryed to write an external javascript file with function above...
    In My jspx page i have put <script src="functions.js"></script> the tag has a reference to external javascript file...
    When I run the page I get "blank" page.. (it's like that all html code is a comment)..
    If I remove the script tag the page will display correctly...
    Is there any example how to include an external javascript file inside jspx?
    this is a piece of jspx:
    <f:view>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1250"/>
    <title></title>
    <link href="css/oracle.css" rel="stylesheet" media="screen"/>
    <script src="functions.js" type="text/javascript"></script>
    </head>
    ..

    Hi,
    you should not add
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1250"/>
    <title></title>
    <link href="css/oracle.css" rel="stylesheet" media="screen"/>
    <script src="functions.js" type="text/javascript"></script>
    </head>
    to f:view. There are JavaScript equivalents to this. Alternatively use
    <f:verbatim>
    <script src="functions.js" type="text/javascript"></script>
    </f:verbatim>
    I assume you use JDeveloper 10.1.3 because in JDeveloper 11 there are other options
    Frank

  • External Javascript not working with C# and XAML windows phone app

    I've added a WebView into my project. If I navigate to the html file that contains external javascript files they don't work. Bit if I write the javascript code hardcoded into the html file it works properly.
    Here is the html portion:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    <html lang="en" xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta charset="utf-8" />
    <title></title>
    <script type="text/javascript" src="testjs.js"></script>
    </head>
    <body>
    <div id="abcd"></div>
    <br/>
    hello! this is a simple html block.
    </body>
    </html>
    Here is the javascript portion:
    document.getElementById("abcd").innerHTML = "New text!";
    When I open the webview it shows
    hello!
    this is a simple html block.,
    but if the javascript code worked it would show
    New
    Test! hello! this is a simple html block.
    And in the C# code the uri is called this way:
    url = onlineTestWebView.BuildLocalStreamUri("myUrl", "problem_page/test.html");
    StreamUriWinRTResolver myResolver = new StreamUriWinRTResolver();
    onlineTestWebView.NavigateToLocalStreamUri(url, myResolver);

    I assume this is because you are using NavigateToString. Please see
    http://blogs.msdn.com/b/wsdevsol/archive/2014/06/20/a-primer-on-webview-navigatetolocalstreamuri.aspx
    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.
    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined
    objects and unknown namespaces.

  • How to  include external javascript and css resources to a jsf?

    I need to include external css and javascript files to my jsf page. Using the code below does not work because all the styles on the css page are ignored and the functions within the js files are not executed.
    <link rel="stylesheet" type="text/css" href="/resources/styles/style.css" />
    <script language="JavaScript" src="/resources/javascript/util.js"></script>When I try to execute any js function within a script tag on a jsf page I get an object expected error.
    I googled about my problem and found this piece of code for importing styles for an external css.
    <style type="text/css">
    @import url("/resources/styles/style.css");
    </style>How could I add an external javascript file to my jsf?

    Used the relative urls in my first post as well as these, and both were not working.
    <link rel="stylesheet" type="text/css" href="./resources/styles/style.css" />
    <script language="JavaScript" src="./resources/javascript/util.js"></script>The ./ tells that the external file can be found by starting at the current directory and working down the path to the specified file. This is my directory structure. Index.jsf is the file that references the external js and css files.
    -Webcontent
    |_index.jsf
    |_resources
    |__styles
    | |__style.css
    |__javascript
    |__util.js
    Either way I still can't reference the files that I need. Calling a javascript function results in an object expected error, and the styles are ignored.
    If I include the js file directly in the jsf then I can get it to work. I don't want to do this because I have created a handful of seperate js files, and do not want to include all of them in one page. I am using myfaces and tomahawk if that helps.

  • Including external javascript and css files in servlet

    Hello,
    I am struggling to generate an HTML page from within a servlet using external javascript and css files. I am not sure how to point the servlet to the external files.
    Any code sample to accomplish the above will be much appreciated.
    Thanks inadvance,
    Antana.

    Can't you just include the following in your servlet?
           response.setContentType("text/html");
            PrintWriter out = response.getWriter();
            out.println("<html>");
            out.println("<head>");
            out.println("<title>Getting CSS</title>");
            out.println("<link rel='stylesheet' type='text/css' href='yourCSS.css' />");
            out.println("<script language='JavaScript' SRC='yourScript.js'></script>");
            out.println("</head>");
           //...

  • How to include external javascript file in an html

    hello
    i've an html file placed in apache/webapps/test folder this html file includes an external javascript file placed at same level
    i'm includind the file as
    <script src="file1.js"></script>but the file does not gets included
    but when the sam folder "test" is paste outside apache the html file including the external file runs properly.
    Thank You

    flounder wrote:
    cotton.m wrote:
    What's really pathetic is that this is your third cross post on this same stupid off topic topic.
    You are really a dumb f&#117;ck you know that?If they knew that they were a dumb f&#117;ck then they wouldn't be a dumb f&#117;ck!That's a logical and reasonable conclusion. Therefore I very much doubt that the OP is capable of it.
    Hmmm this is interesting. It now shows the entity escapes rather than their values when you quote.

  • Loading an external javascript with different charset with the page with Firefox

    My page is in UTF-8 while my external javascript file is in UTF-16. I am trying to load it with the html code <script src="x" charset="utf-16"></script>, but eventually Firefox returns with error and indicating that there are illegal characters in the javascript, which is encoded as UTF-8.
    Anyone has similar experience? thx in advanced.

    My problem has been solved. Regards

  • Webkit. How to connect external javascript from dir C:

    I can't execute javascript from dir C:
    I have some html, that I load in Webkit with loadContent(). In that html invoked function test(). Function contains in a separate javascript file.
    <head>     
    <script language='javascript' type='text/javascript' src="file:///C:/temp/test.js"></script>
    <script>
         function getText() { var val = document.getElementById('text_area').value;
              prompt('getText', "val");
    </script>          
    </head>
    <body>
           <textarea id='text_area' name='text_area' style="width:100%; height:100%"></textarea>     
           <script> test(); </script>
    </body>External javascript (test.js)
    function test() {
            alert('It works!');
         getText();           
    }External js doesn't work. PromptHandler (AlertHandler) doesn't catch anything. If I use wEngine.executeScript('test'), appear error: netscape.javascript.JSException: ReferenceError: Can't find variable: getText.
    But that code works on any other browsers.

    Thank you for the problem report!
    This looks like a bug in WebView. A Jira issue has been filed to track this: http://javafx-jira.kenai.com/browse/RT-17330. Note that the issue may end up classified as not-a-bug because the ability to run local scripts from dynamic contents may be considered a security hole.
    As a workaround, try saving your HTML into a temporary file and load it using WebEngine.load(). It should work as in any other browser. Another option is to include all necessary code in the HTML document loaded with WebEngine.loadContent(), but I gather that is undesirable in your case.
    Edited by: 890759 on Oct 11, 2011 5:19 AM
    Edited by: 890759 on Oct 11, 2011 5:21 AM

  • Call External Javascript file in Custom Visual WebPart

     Hi..
     How to call external javascript file in Custom Visual WebPart in sharepoint 2010
    Ravindranath

    Hello,
    Download that script and save in layout folder or within a site. Then use below script tag in webpart:
    <SharePoint:ScriptLink ID="ScriptLink2" Name="location/jquery-1.5.min.js" runat="server" OnDemand="false" Localizable="false" />
    http://stackoverflow.com/questions/5068663/how-to-call-an-external-javascript-file-from-a-webpart
    http://stackoverflow.com/questions/5243821/external-javascript-file-in-sharepoint-web-part
    Hope it could help
    Hemendra:Yesterday is just a memory,Tomorrow we may never see
    Please remember to mark the replies as answers if they help and unmark them if they provide no help

  • External JavaScript Editor

    I'm curious which external JavaScript Editor others use?
    I use PSPad, which has lot of nice features, but I don't have a syntax highliter and clip/autocomplete for all the Acrobat JavaScript methods. Is there a simple list of all these methods available?
    Also PSPad supports access to indexed .chm or .hlp files. Is the Acrobat 3D JavaScript available as a standard .chm or .hlp Help File?
    Anyone has experience with JSEclipse for Acrobat JavaScript?
    Thanks for your input!
    - Jess

    First I would look at the options Adobe provides, and Notepad++ is one of them. Since many are free, you could try them and then select which one you find most helpful. These text editors can also be used independently of Acrobat for other editing task so you might want to also consider that in making your choice.

  • Invoking external javascript file from xdp source

    Is it possible to invoke an external javascript file from within the xdp source? I know it is possible to embed the javascript in the form.
    If this is possible, would I be correct in assuming that this is also possible from pdf source?
    Basically I am looking to show / hide buttons based on the status associated with a form at a given time in the flow. My understanding of PDFs is that the source cannot be edited once it has been created? If this is the case I was hoping that there could be code embedded that would call on the external file which would return the status of the letter. Based on the response buttons / fragments etc could be shown / hidden as required.
    Feedback required asap please!
    Thanks in advance.

    You cannot call outside of the rendered form. So you have a couple of means to get information into the form. Merge dat aonto the form (in your case you can use a field as a flag and key off of that),or use Web Service call to check the status.
    Hope that helps
    Paul

  • Having problem with calling external javascript functions in LV

    Hi,
    I found this VI: http://lavag.org/topic/10304-discuss-calling-external-javascript/, which I believe can be really helpful for my work. The problem is I can't get it to run based on the following problem:
     - Apparently the "ScriptControl" cannot be loaded
    I am using LabView 8.6, and this vi has been produced in a 8.0 version. Do you think this is the problem? If not, what could cause this problem running this VI?
    Thanks,
    Diogo

    Hi,
    To start I am using this examplo from the google code page.
    <!DOCTYPE html "-//W3C//DTD XHTML 1.0 Strict//EN"
      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
      <head>
        <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
        <title>Google Maps JavaScript API Example</title>
        <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=abcdefg&sensor=true_or_false"
                type="text/javascript"></script>
        <script type="text/javascript">
        function initialize() {
          if (GBrowserIsCompatible()) {
            var map = new GMap2(document.getElementById("map_canvas"));
            map.setCenter(new GLatLng(37.4419, -122.1419), 13);
            map.setUIToDefault();
        </script>
      </head>
      <body onload="initialize()" onunload="GUnload()">
        <div id="map_canvas" style="width: 500px; height: 300px"></div>
      </body>
    </html>  
    It loads a basic map, and is saved in a html file created for example in Notepad. Basically as I said the VI is very simple, see next image.
    But like I said, this strategy does not allow labview to interface dinamically with the javasscript code in the html file. Doing it this way, I would have to constantly update the code in the file with new coordinates and loading the map again. This causes the mentioned flickering problem that I also had with static maps.
    Diogo

  • How to call Edge Animate's play function from external javascript

    I have a symbol on the stage called "cart".... inside the symbol is my graphic that has a motion path put on it to the timeline (it is called "car_v1").
    On my stage I have a code to hide the symbol cart with an external css class :
    sym.$("cart").addClass( "hidden" );  ( this is the css - .hidden { display: none; } )
    I have a function that calls an external javascript file.. from that external file I want to get the timeline animation to work:
    here is the function called:
    checkCar();
    and here is the function:
    function checkCar() {
    if (AdobeEdge.countCar == 5){
    AdobeEdge.getComposition("EDGE-172492634").getStage().$("cart").removeClass( "hidden" ); // this works!
    AdobeEdge.getComposition("EDGE-172492634").getStage().$("cart").play(); //doesn't work!        <------------this is the line I need help with!
    // sym.getSymbol("cart").play(); // this works inside of edge and the timeline animation runs!!!
    Can anyone help me get the play function to work from my external javascript file? Thanks!
    Kristen

    Hi,
    You can try:
    function checkCar() {
    if (AdobeEdge.countCar == 5){
    var iCall = AdobeEdge.getComposition("EDGE-172492634").getStage();
          iCall.$("cart").removeClass( "hidden" );
          iCall.getSymbol("cart").play();

  • External javascript variable problem

    QUESTION: Why would an external javascript variable be undefined if I set it equal to all the links in a page?
    BACKGROUND: I have a simple image swap function that works when the script is all in the html. But when I tried taking the script to an external javascript file, when I gather all the anchors on the page. The variable that is supposed to refer to the anchors is considered undefined in the middle of the script.
    EXAMPLE: I have place an example online. You may check it out. Please.
    Thanks!
    Message was edited by: UteFanJason

    So I checked out that link, and some information on scope. I got the function to work. Check it out.
    I did some more reading, and it turns out that the onload event is when the entire DOM has finished loading. (That is according to a book put out a couple of years ago so it could be different now).
    This is what I changed the the code to:
    function prepare_thumbs() {
        var main_img = document.getElementById('main_img');
        links = document.getElementsByTagName('a');
        for (x=0; x<links.length; x++) {
            links[x].onclick = function() {
                main_img.setAttribute('src', this.getAttribute('id'));
                return false;
    window.onload = prepare_thumbs;
    Again, thanks for the help!

  • Access symbols from external javascript code?

    Because the coding support in the Edge editor (e.g. code completion) and the debugging tools are limited (and errors in browser console are useless), I've been moving as much of my code as possible into external javascript files.  From external js files, it has worked fine to access things on stage by jquery class selectors.  But I would also like to access symbols by instance name.  Does anyone know how to do this from an external js file?
    I noticed that using the new in version 3.0 way of adding js libraries to the project doesn't work so well for my own js because "Preview in Browser" doesn't re-load my edited code each time.  So I'm still using yepnope for my own external js.
    Doug

    Have you checkout Bootstrapping in Edge Animate http://blogs.adobe.com/edge/2012/05/15/bootstrapping-edge-compositions/
    Once the composition is loaded store the composition ID.Later you can access the symbols using the regular Animate API's
    Like :
    AdobeEdge.getComposition(compId).getStage().getSymbol('symbol_name')

Maybe you are looking for

  • No connectivity - ports up and down?

    I have a 2950 switch which we use to for connectivity to VOIP phones and terminals/pcs on the floors. At random times during the day maybe twice 2-3 hour span, we lose connectivity between two of the terminals and our server which is connected to the

  • There was a problem downloading the software for the IPhone. An unknown error occured (-23). How can I update to the latest IOS 5?

    Hi all, I'm trying to update to IOS 5. However, the error message keeps popping out with error -23. I've tried all the methods in Apple's troubleshooting page and it didn't help. Anyone knows how to fix it?

  • IMac G3 sees 5G USB connection as firewire???

    Anyone seen this issue? Distress call from my neighbour who has an iPod 5G 30Gig video, an iBook G4 and an iMac G3 CRT (2001 slot loader). The iBook G4 belongs to the school where she teaches, so she wants to have all her music library on her G3 iMac

  • PDF into Aperture or Keynote

    i am trying to import pdf images into keynote or aperture. these are single page pdf's that i dragged out of a multi-page pdf in Preview. the original pdf was created in AutoCad. these are coming up as either washed out or as having black backgrounds

  • Airtunes stops working after upgrade to Leopard

    I have a 12" G4 and my wife has a Macbook. We've used airtunes/airport express connected to a netgear wireless router for years to play music over our stereo system. Ever since upgrading to Leopard, our airtunes has ceased to function. The airport ex