cancel
Showing results for 
Search instead for 
Did you mean: 

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

former_member625369
Discoverer
0 Kudos

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

Accepted Solutions (0)

Answers (1)

Answers (1)

Sandra_Rossi
Active Contributor
0 Kudos

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).