Skip to Content

Issue while communicating to javascript

Hi All,

I am facing a small issue while communicating to javascript from .htm page. My current code is as below.

<% DATA:lv_url TYPE CRMT_IC_LTX_URL_PART1.
SELECT SINGLE url
FROM ZMYTABLE
INTO lv_url
WHERE SYSTEM_NAME = sy-sysid. %>

<script type="text/javascript">
var lv_url_js;
lv_url_js = <%= lv_url %>.
window.open(lv_url_js,"mywindow","menubar=1,resizable=1,width=350,height=250");
</script>

The issue is when I assign the variable lv_url to lv_url_js. If I just give www.google.com in window.open, it is working. But the above code is not working. Could anybody help?.


Thanks,

Faisa;

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    Posted on Apr 28, 2016 at 07:51 PM

    Hi Faisal,

    Your JS code is pretty straightforward, But it might be an escaping issue. You can directly escape your URL on the BSP Layou by doing:

    lv_url_js = '<%javascript= lv_url %>';

    See the BSP Escaping Help Topic for more info.

    Let me know if it works.

    BR - JYves

    PS: Line 09 in your example ends with a period and is missing some quotes (unless they are already part of lv_url).

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Apr 28, 2016 at 10:43 PM

    the issue is the dot(.) and missing quotes, put it like this

    lv_url_js = "<%= lv_url %>";

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Apr 28, 2016 at 03:12 PM

    Hi All,

    Any javascript experts?...

    Thanks,

    Faisal

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.