Skip to Content

Not able to assign the value of a Javascript Variable to an ABAP variable in Layout of a BSP Application

Hi Experts,

I have a requirement of passing the value of a JavaScript variable to the ABAP variable in a BSP Application. The ABAP variable is declared in the Page Attributes section of the BSP Application. The reverse is easily possible but since I have a list thro' which I have to iterate in JAVASCRIPT and then, the values are coming to my variable in Javascript separated by comma. So, then further I want this variable (JS variable) to be assigned to the ABAP workarea-fieldname.

Is there any way around to get this done ?

I am trying this but unable to help myself:

var products = "abc";

'<%= ls_product-text %>'' = products;

Kindly suggest something.. Please 😊

Thanks & Regards,

Vaishali Gupta

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Posted on Oct 06, 2016 at 06:07 PM

    No, it can't work the way you did it. ABAP variable values (<%= ...%>) are used to build dynamically the content of the HTML page (with possibly Javascript, CSS and so on) on the server, but the HTML/javascript is being run on the client, so it's not possible to initialize ABAP variables directly from the client.

    You have to use the classic way of interacting between an HTML page, and the server, i.e. by using for instance form fields in an "HTML form", or data in the "URL query string". You can find examples in the web (and maybe in SCN).

    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.