cancel
Showing results for 
Search instead for 
Did you mean: 

how to assign value of javascript variable to ABAP variable

Former Member
0 Kudos

I have a variable "w_temp" in ABAP(defined in page attributes) and another variable "x" in javascript.

I can assign value of w_temp to x as follows :-

x = <% w_temp. %>

but I want to do vice versa i.e. assign value of x to w_temp.

How to do that ???????

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

can u give me an example of how to pass it using hidden field of form or via ajax.

its urgent.

thanks in advance !!!

eddy_declercq
Active Contributor
0 Kudos

Hi,

This forums are meant for urgent support.

Anyway,

A form can look like this

<script language="javascript">

function submitform() {

document.aform.avar.val='some_val';

document.aform.submit();

}

</script>

<form name="aform">

<input type="hidden" name="avar">

<input type="button" name="abutton" onclick="submitform();">

</form>

If you define a page attribute avar (set it to auto), you have the 'some_val' in you abap var.

Eddy

PS.

Put yourself on the SDN world map (http://sdn.idizaai.be/sdn_world/sdn_world.html) and earn 25 points.

Spread the wor(l)d!

Answers (2)

Answers (2)

Former Member
0 Kudos

hey Eddy u r simply GREAT !!!!!!

thanks !!!

eddy_declercq
Active Contributor
0 Kudos

Hi,

This has been the subject of many forum post already.

The answer is that you can't directly.

You need pass it via a (hidden) field of a form, URL or AJAX.

Eddy

PS.

Put yourself on the SDN world map (http://sdn.idizaai.be/sdn_world/sdn_world.html) and earn 25 points.

Spread the wor(l)d!