<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to read response from local html file containing java script in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-read-response-from-local-html-file-containing-java-script/m-p/12621310#M2012714</link>
    <description>&lt;P&gt;Thanks a lot. It solved my problem&lt;/P&gt;</description>
    <pubDate>Tue, 08 Nov 2022 14:19:34 GMT</pubDate>
    <dc:creator>Sucheta</dc:creator>
    <dc:date>2022-11-08T14:19:34Z</dc:date>
    <item>
      <title>How to read response from local html file containing java script</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-read-response-from-local-html-file-containing-java-script/m-p/12621300#M2012704</link>
      <description>&lt;P&gt;I need to read response from my local html file in my sap program. I have seen most of the sample code tries to read URL. If I try those codes it is checking the 'https:' or 'http' in the URL and as I have local file ( file:///C:/Users/COMPANY/Desktop/SIG/Data/test1.html) it is not getting http and showing error. Please help.&lt;/P&gt;
  &lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Contents of html file is as follows:&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;
  &lt;P&gt;&amp;lt;html&amp;gt;&lt;/P&gt;
  &lt;P&gt;&amp;lt;head&amp;gt;&lt;/P&gt;
  &lt;P&gt;&amp;lt;SCRIPT type="text/javascript"&amp;gt;&lt;/P&gt;
  &lt;P&gt;function testWebSocket()&lt;/P&gt;
  &lt;P&gt;{ &lt;/P&gt;
  &lt;P&gt;var connection = new WebSocket('wss://999.9.9.1:2212');&lt;/P&gt;
  &lt;P&gt;connection.onopen = function () {&lt;/P&gt;
  &lt;P&gt; console.log('Connection Opened');&lt;/P&gt;
  &lt;P&gt;};&lt;/P&gt;
  &lt;P&gt;connection.onerror = function (error) &lt;/P&gt;
  &lt;P&gt;{&lt;/P&gt;
  &lt;P&gt; alert('Please check the server connection: ' + error);&lt;/P&gt;
  &lt;P&gt; document.getElementById("signData").value=error;&lt;/P&gt;
  &lt;P&gt;};&lt;/P&gt;
  &lt;P&gt;connection.onmessage = function (e) &lt;/P&gt;
  &lt;P&gt;{&lt;/P&gt;
  &lt;P&gt; if(e.data.indexOf("subProtocol")==-1)&lt;/P&gt;
  &lt;P&gt; {&lt;/P&gt;
  &lt;P&gt; alert(e.data);&lt;/P&gt;
  &lt;P&gt; setData("signData", "signData");&lt;/P&gt;
  &lt;P&gt; }&lt;/P&gt;
  &lt;P&gt; {}&lt;/P&gt;
  &lt;P&gt;};&lt;/P&gt;
  &lt;P&gt;var completeData = '';&lt;/P&gt;
  &lt;P&gt;var splitData = [];&lt;/P&gt;
  &lt;P&gt;var i = 0;&lt;/P&gt;
  &lt;P&gt;var splitLength = 0;&lt;/P&gt;
  &lt;P&gt;var j = 0;&lt;/P&gt;
  &lt;P&gt;var actualData = '';&lt;/P&gt;
  &lt;P&gt;var textId = '';&lt;/P&gt;
  &lt;P&gt;var k = 0;&lt;/P&gt;
  &lt;P&gt;var bufLength = 16300;&lt;/P&gt;
  &lt;P&gt;alert("Begin");&lt;/P&gt;
  &lt;P&gt;function setData(txf1, msg)&lt;/P&gt;
  &lt;P&gt;{&lt;/P&gt;
  &lt;P&gt;alert("in set Fuction");&lt;/P&gt;
  &lt;P&gt;msg="action=signpdf\ndatatosign=' '\nsignaction=3\noutputpath=\nsigntype=sign\nexpirycheck=true\ncoordinate=425,100,545,160\nissuername=\ncerttype=ALL\ncertclass=0\npageno=All\ncoSign=true";&lt;/P&gt;
  &lt;P&gt;actualData = msg;&lt;/P&gt;
  &lt;P&gt;textId = txf1;&lt;/P&gt;
  &lt;P&gt;completeData = msg;&lt;/P&gt;
  &lt;P&gt;//alert('completeData length ' + completeData.length);&lt;/P&gt;
  &lt;P&gt;if(completeData.length &amp;lt; bufLength)&lt;/P&gt;
  &lt;P&gt;{&lt;/P&gt;
  &lt;P&gt;//alert('not splitting');&lt;/P&gt;
  &lt;P&gt;splitData[0] = msg;&lt;/P&gt;
  &lt;P&gt;call(txf1,msg);&lt;/P&gt;
  &lt;P&gt;}&lt;/P&gt;
  &lt;P&gt;else&lt;/P&gt;
  &lt;P&gt;{&lt;/P&gt;
  &lt;P&gt;//alert('splitting');&lt;/P&gt;
  &lt;P&gt;splitLength = completeData.length / bufLength;&lt;/P&gt;
  &lt;P&gt;//alert('splitLength ' + splitLength);&lt;/P&gt;
  &lt;P&gt;var t = 0;&lt;/P&gt;
  &lt;P&gt;var tt = k + bufLength + 1;&lt;/P&gt;
  &lt;P&gt;for(i = 0; i &amp;lt; splitLength; i++)&lt;/P&gt;
  &lt;P&gt;{&lt;/P&gt;
  &lt;P&gt;splitData[i] = completeData.substring(t, tt);&lt;/P&gt;
  &lt;P&gt;k = k + bufLength;&lt;/P&gt;
  &lt;P&gt;t = k + 1;&lt;/P&gt;
  &lt;P&gt;tt = t + bufLength;&lt;/P&gt;
  &lt;P&gt;}&lt;/P&gt;
  &lt;P&gt;call(txf1,msg);&lt;/P&gt;
  &lt;P&gt;}&lt;/P&gt;
  &lt;P&gt;}&lt;/P&gt;
  &lt;P&gt;function call(txf1,msg)&lt;/P&gt;
  &lt;P&gt;{&lt;/P&gt;
  &lt;P&gt;if(connection==null)&lt;/P&gt;
  &lt;P&gt;{&lt;/P&gt;
  &lt;P&gt;alert('Please check the server connection2');&lt;/P&gt;
  &lt;P&gt;return;&lt;/P&gt;
  &lt;P&gt;}&lt;/P&gt;
  &lt;P&gt;var data="";&lt;/P&gt;
  &lt;P&gt;var startindex="";&lt;/P&gt;
  &lt;P&gt;if(msg.length &amp;lt; bufLength)&lt;/P&gt;
  &lt;P&gt;{&lt;/P&gt;
  &lt;P&gt;completeData = splitData[0] + 'completed';&lt;/P&gt;
  &lt;P&gt;connection.send(completeData);&lt;/P&gt;
  &lt;P&gt;}&lt;/P&gt;
  &lt;P&gt;else&lt;/P&gt;
  &lt;P&gt;{&lt;/P&gt;
  &lt;P&gt;if(j == i-1)&lt;/P&gt;
  &lt;P&gt;{&lt;/P&gt;
  &lt;P&gt;completeData = splitData[j] + 'completed';&lt;/P&gt;
  &lt;P&gt;}&lt;/P&gt;
  &lt;P&gt;else{&lt;/P&gt;
  &lt;P&gt;completeData = splitData[j];&lt;/P&gt;
  &lt;P&gt;}&lt;/P&gt;
  &lt;P&gt;j++;&lt;/P&gt;
  &lt;P&gt;connection.send(completeData);&lt;/P&gt;
  &lt;P&gt;}&lt;/P&gt;
  &lt;P&gt;connection.onerror = function (error) &lt;/P&gt;
  &lt;P&gt;{&lt;/P&gt;
  &lt;P&gt; alert('Please check the server connection: ' + error);&lt;/P&gt;
  &lt;P&gt; document.getElementById("signData").value=error;&lt;/P&gt;
  &lt;P&gt;};&lt;/P&gt;
  &lt;P&gt;connection.onmessage = function (e) &lt;/P&gt;
  &lt;P&gt;{&lt;/P&gt;
  &lt;P&gt; if(e.data.indexOf("subProtocol")==-1)&lt;/P&gt;
  &lt;P&gt; {&lt;/P&gt;
  &lt;P&gt; if(e.data == 'sendmore')&lt;/P&gt;
  &lt;P&gt; {&lt;/P&gt;
  &lt;P&gt; call(textId, actualData);&lt;/P&gt;
  &lt;P&gt; }&lt;/P&gt;
  &lt;P&gt; else{&lt;/P&gt;
  &lt;P&gt; data = data + e.data;&lt;/P&gt;
  &lt;P&gt; startindex=data.indexOf('completed');&lt;/P&gt;
  &lt;P&gt; if(startindex != -1)&lt;/P&gt;
  &lt;P&gt; {&lt;/P&gt;
  &lt;P&gt; // Client can use the signature&lt;/P&gt;
  &lt;P&gt; alert(data)&lt;/P&gt;
  &lt;P&gt; //document.getElementById(txf1).value=data;&lt;/P&gt;
  &lt;P&gt; splitData = [];&lt;/P&gt;
  &lt;P&gt; i = 0;&lt;/P&gt;
  &lt;P&gt; splitLength = 0;&lt;/P&gt;
  &lt;P&gt; j = 0;&lt;/P&gt;
  &lt;P&gt; actualData = '';&lt;/P&gt;
  &lt;P&gt; textId = '';&lt;/P&gt;
  &lt;P&gt; k = 0;&lt;/P&gt;
  &lt;P&gt; }&lt;/P&gt;
  &lt;P&gt; }&lt;/P&gt;
  &lt;P&gt; }&lt;/P&gt;
  &lt;P&gt;};&lt;/P&gt;
  &lt;P&gt;}&lt;/P&gt;
  &lt;P&gt;}&lt;/P&gt;
  &lt;P&gt;&amp;lt;/script&amp;gt;&lt;/P&gt;
  &lt;P&gt;&amp;lt;/head&amp;gt;&lt;/P&gt;
  &lt;P&gt;&amp;lt;body&amp;gt; &lt;/P&gt;
  &lt;P&gt;&amp;lt;p&amp;gt;Click the following button to call websocket&amp;lt;/p&amp;gt; &lt;/P&gt;
  &lt;P&gt;&amp;lt;input type = "button" onclick = "testWebSocket()" value = "Sign&lt;/P&gt;
  &lt;P&gt;"&amp;gt; &lt;/P&gt;
  &lt;P&gt;&amp;lt;/body&amp;gt; &lt;/P&gt;
  &lt;P&gt;&amp;lt;/html&amp;gt;&lt;/P&gt;</description>
      <pubDate>Sat, 17 Sep 2022 10:09:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-read-response-from-local-html-file-containing-java-script/m-p/12621300#M2012704</guid>
      <dc:creator>Sucheta</dc:creator>
      <dc:date>2022-09-17T10:09:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to read response from local html file containing java script</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-read-response-from-local-html-file-containing-java-script/m-p/12621301#M2012705</link>
      <description>&lt;P&gt;What error is it showing? What are you doing to obtain this error? What is your code?&lt;/P&gt;</description>
      <pubDate>Sun, 18 Sep 2022 08:00:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-read-response-from-local-html-file-containing-java-script/m-p/12621301#M2012705</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2022-09-18T08:00:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to read response from local html file containing java script</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-read-response-from-local-html-file-containing-java-script/m-p/12621302#M2012706</link>
      <description>&lt;P&gt;Is it an html file on your application server or on cient side?&lt;/P&gt;</description>
      <pubDate>Mon, 19 Sep 2022 08:30:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-read-response-from-local-html-file-containing-java-script/m-p/12621302#M2012706</guid>
      <dc:creator>thkolz</dc:creator>
      <dc:date>2022-09-19T08:30:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to read response from local html file containing java script</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-read-response-from-local-html-file-containing-java-script/m-p/12621303#M2012707</link>
      <description>&lt;P&gt;We have created the html file in our presentation server. There is a button in the html file against which there is a java script. We need to capture the the response from the java script after the button is pressed. Please advise.&lt;/P&gt;</description>
      <pubDate>Mon, 19 Sep 2022 09:32:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-read-response-from-local-html-file-containing-java-script/m-p/12621303#M2012707</guid>
      <dc:creator>Sucheta</dc:creator>
      <dc:date>2022-09-19T09:32:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to read response from local html file containing java script</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-read-response-from-local-html-file-containing-java-script/m-p/12621304#M2012708</link>
      <description>&lt;P&gt;Please have a look at how DEMO_HTML_INPUT program from SAP in SE38. It demos how to get data from HTML page into ABAP.&lt;/P&gt;</description>
      <pubDate>Tue, 20 Sep 2022 00:06:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-read-response-from-local-html-file-containing-java-script/m-p/12621304#M2012708</guid>
      <dc:creator>Juwin</dc:creator>
      <dc:date>2022-09-20T00:06:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to read response from local html file containing java script</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-read-response-from-local-html-file-containing-java-script/m-p/12621305#M2012709</link>
      <description>&lt;P&gt;From what version is that available? On a 7.31 I have DEMO_HTML_BROWSER only.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Sep 2022 08:13:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-read-response-from-local-html-file-containing-java-script/m-p/12621305#M2012709</guid>
      <dc:creator>abo</dc:creator>
      <dc:date>2022-09-21T08:13:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to read response from local html file containing java script</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-read-response-from-local-html-file-containing-java-script/m-p/12621306#M2012710</link>
      <description>&lt;P&gt;Not sure of the version in which this was provided. I have attached the source code here:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;REPORT demo_html_input.
CLASS demo DEFINITION.
  PUBLIC SECTION.
    CLASS-METHODS main.
  PRIVATE SECTION.
    CLASS-METHODS handle_sapevent
      FOR EVENT sapevent
                  OF cl_abap_browser
      IMPORTING action
                  query_table.
ENDCLASS.
CLASS demo IMPLEMENTATION.
  METHOD main.
    DATA error_list TYPE cl_abap_browser=&amp;gt;html_table.
    SET HANDLER handle_sapevent.
    DATA(html_str) =
       `&amp;lt;html&amp;gt;`
    &amp;amp;&amp;amp; `  &amp;lt;head&amp;gt;`
    &amp;amp;&amp;amp; `    &amp;lt;meta http-equiv="content-type" `
    &amp;amp;&amp;amp; `          content="text/html; `
    &amp;amp;&amp;amp; `          charset=utf-8"&amp;gt;`
    &amp;amp;&amp;amp; `    &amp;lt;script language="JavaScript"&amp;gt;`
    &amp;amp;&amp;amp; `      function sendInput(form) `
    &amp;amp;&amp;amp; `          { fname=form.name;       `
    &amp;amp;&amp;amp; `            document[fname].submit();} `
    &amp;amp;&amp;amp; `      function InputKeyDown(form) {`
    &amp;amp;&amp;amp; `        if(event.keyCode == 13) {`
    &amp;amp;&amp;amp; `            fname=form.name;`
    &amp;amp;&amp;amp; `            document[fname].submit();} }`
    &amp;amp;&amp;amp; `    &amp;lt;/script&amp;gt;`
    &amp;amp;&amp;amp; `  &amp;lt;/head&amp;gt;`
    &amp;amp;&amp;amp; `  &amp;lt;body&amp;gt;`
    &amp;amp;&amp;amp; `    &amp;lt;form name="INPUT" accept-charset="utf-8" `
    &amp;amp;&amp;amp; `          method="post" action="SAPEVENT:INPUT"&amp;gt; `
    &amp;amp;&amp;amp; `      &amp;lt;input type="text" id="in1" name="field1" `
    &amp;amp;&amp;amp; `             size=30 maxlength=30 title="" value="aaa" `
    &amp;amp;&amp;amp; `             onKeyDown="InputKeyDown(this.form);"&amp;gt;&amp;lt;br&amp;gt;`
    &amp;amp;&amp;amp; `      &amp;lt;input type="text" id="in2" name="field2" `
    &amp;amp;&amp;amp; `             size=30 maxlength=30 title="" value="bbb" `
    &amp;amp;&amp;amp; `             onKeyDown="InputKeyDown(this.form);"&amp;gt;&amp;lt;br&amp;gt;`
    &amp;amp;&amp;amp; `      &amp;lt;input type="text" id="in3" name="field3" `
    &amp;amp;&amp;amp; `             size=30 maxlength=30 title="" value="ccc" `
    &amp;amp;&amp;amp; `             onKeyDown="InputKeyDown(this.form);"&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;`
    &amp;amp;&amp;amp; `     &amp;lt;button id="enterButton" type="button" `
    &amp;amp;&amp;amp; `             title="Enter" onClick="sendInput(INPUT);" `
    &amp;amp;&amp;amp; `             onKeypress="if(event.keycode=13) `
    &amp;amp;&amp;amp; `             sendInput(INPUT);"&amp;gt;`
    &amp;amp;&amp;amp; `             Enter&amp;lt;/button&amp;gt;`
    &amp;amp;&amp;amp; `    &amp;lt;/form&amp;gt;`
    &amp;amp;&amp;amp; `  &amp;lt;/body&amp;gt;`
    &amp;amp;&amp;amp; `&amp;lt;/html&amp;gt;`.
    cl_abap_browser=&amp;gt;show_html(
      EXPORTING
        html_string = html_str
        title       = 'Input Demo'
      IMPORTING
         html_errors = error_list ).
    IF error_list IS NOT INITIAL.
      MESSAGE 'Error in HTML' TYPE 'I' DISPLAY LIKE 'E'.
    ENDIF.
  ENDMETHOD.
  METHOD handle_sapevent.
    DATA(out) = cl_demo_output_stream=&amp;gt;open( ).
    SET HANDLER cl_demo_output_html=&amp;gt;handle_output FOR out.
    out-&amp;gt;write_data( iv_name = 'ACTION'      ia_value = action ).
    out-&amp;gt;write_data( iv_name = 'QUERY_TABLE' ia_value = query_table ).
    out-&amp;gt;close( ).
  ENDMETHOD.
ENDCLASS.
START-OF-SELECTION.
  demo=&amp;gt;main( ).&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 21 Sep 2022 10:50:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-read-response-from-local-html-file-containing-java-script/m-p/12621306#M2012710</guid>
      <dc:creator>Juwin</dc:creator>
      <dc:date>2022-09-21T10:50:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to read response from local html file containing java script</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-read-response-from-local-html-file-containing-java-script/m-p/12621307#M2012711</link>
      <description>&lt;P&gt;Thanks, but it cannot be activated because of a missing parameter, I guess this is why it was not supplied in our system.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Sep 2022 11:00:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-read-response-from-local-html-file-containing-java-script/m-p/12621307#M2012711</guid>
      <dc:creator>abo</dc:creator>
      <dc:date>2022-09-21T11:00:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to read response from local html file containing java script</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-read-response-from-local-html-file-containing-java-script/m-p/12621308#M2012712</link>
      <description>&lt;P&gt;Thanks &lt;SPAN class="mention-scrubbed"&gt;juwin.thomas2&lt;/SPAN&gt;.&lt;/P&gt;&lt;P&gt;I had tried copying the program demo_html_input. But the parameter html_string is of type string and it was unable to capture the entire html file as the length of my file is quite large approx 5000 characters.&lt;/P&gt;&lt;P&gt;Hence I used the parameter html which is an internal table. But it is not working as expected. Can you please provide a sample program where html table is used and it is capturing the output form the html response.&lt;/P&gt;</description>
      <pubDate>Sat, 24 Sep 2022 12:30:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-read-response-from-local-html-file-containing-java-script/m-p/12621308#M2012712</guid>
      <dc:creator>Sucheta</dc:creator>
      <dc:date>2022-09-24T12:30:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to read response from local html file containing java script</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-read-response-from-local-html-file-containing-java-script/m-p/12621309#M2012713</link>
      <description>&lt;P&gt;String has the capability to take unlimited length. So, 5000 chars shouldn't be any issue. When you say "not working as expected", what do you mean?&lt;/P&gt;</description>
      <pubDate>Sat, 24 Sep 2022 17:08:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-read-response-from-local-html-file-containing-java-script/m-p/12621309#M2012713</guid>
      <dc:creator>Juwin</dc:creator>
      <dc:date>2022-09-24T17:08:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to read response from local html file containing java script</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-read-response-from-local-html-file-containing-java-script/m-p/12621310#M2012714</link>
      <description>&lt;P&gt;Thanks a lot. It solved my problem&lt;/P&gt;</description>
      <pubDate>Tue, 08 Nov 2022 14:19:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-read-response-from-local-html-file-containing-java-script/m-p/12621310#M2012714</guid>
      <dc:creator>Sucheta</dc:creator>
      <dc:date>2022-11-08T14:19:34Z</dc:date>
    </item>
  </channel>
</rss>

