Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Pass parameters through URL

Former Member
0 Kudos

Hello all

Can anyone tell me how to pass parameters from an ABAP to a simple HTML page?

Here is the scenario. I am using the class cl_gui_html_viewer to display a web page. The web page is going to have a simple text-inputfield in which i have to pass a value from my ABAP program. I am appending the query value to the url of the html page(stored locally).

Can anybody help me with the coding required in the target HTML page to understand the parameter?

2 REPLIES 2

Former Member
0 Kudos

You have a plain HTML page that loads with a url with something like ?field=value

And you want "value" to show on your page, correct?


<html>
<body>

<script>
var qsParm = new Array();
function qs() {
var query = window.location.search.substring(1);
var parms = query.split('&');
for (var i=0; i<parms.length; i++) {
   var pos = parms<i>.indexOf('=');
   if (pos > 0) {
      var key = parms<i>.substring(0,pos);
      var val = parms<i>.substring(pos+1);
      qsParm[key] = val;
      }
   }
}
qsParm['field'] = null;
qs(); 

if (qsParm['field'])
	document.write('You selected ' + qsParm['field'] ); 

</script>  

</body>
</html>

Call that as test.html?field=Hello

Here's a nice link that explains it in detail: http://www.eggheadcafe.com/articles/20020107.asp

0 Kudos

Hey Craig

Thanks very much for the link, it was very useful. I got the coding that is required for the HTML page at the client side.

However the problem is that I am not able to test the coding by creating a HTML page and storing it locally. when I try to

call that page I get an error that it cannot find the file. Is this a normal problem?

Also when I try to directly call(not from my ABAP prog.) the locally stored page then I get the same error. Is it that the windows explorer doesnt recognise '?' or '&' ?

Thanks

Regards

Siddhesh