12-14-2011 10:23 PM
hi experts,
I am fairly new to ABAP programming so please bear with me. To my issue.
I am creating a BSP which will read from the tax number table in CRM into an itab.
Next it loops into an wa and then passes each tax number through a javascript/JQuery API to validate the number.
The JSON response then comes back and is stored in a JS variable.
I am unclear how to get this into an ABAP variable so I can handle as needed. I have read some posts but they seem to be created for those ABAP experts which I am not there yet.
Any help is most appreciated.
thank you kindly!
Chris
12-15-2011 10:24 AM
12-15-2011 10:24 AM
12-15-2011 5:14 PM
Thanks for the reply Kiran.
I am still stuck where I try to create the hidden field, assign the JS variable value to it and then retrieve on server side using ABAP.
I read some places where it mentions accessing in the controller but this is not specific enough for me to know what to do. Here is a snippet of my JS/html code.
<form id="api">
<div><input type="hidden" name="json" id="json" value="" /></div>
var json = data;
document.getElementById("json").value = json;
document.api.submit();
</form>
I am using a Jquery api to get a boolean value and storing it in the json variable. then I want to pass that value to an ABAP variable. I did maintain a page attribute of json type STRING as well. I also tried maintaining a controller class attribute of the same. I did not redefine any controller class methods.
Your help is most appreciated.
thx
Chris
12-16-2011 4:20 AM
12-16-2011 5:43 AM
Hi,
Below code may be useful to you. Define hidden field in ur html. Call JS function apiValidation, in this case, on the click of any button that you might be using in html code. Here the json value will be transfer into your hidden field and as the form will be posted you can retrieve the value of hidden fied using the HTTP request method (POST).
function apiValidation{
"your valisation code".
var json = data;
document.getElementById("taxnum").value = json;
document.api.submit();
}
<form id="api" method = "post">
<input type="hidden" name="taxnum" id="taxnum" value="" />
</form>
12-17-2011 4:55 PM
Thank you two so much! I was able to see the value now. My only remaining issue is getting it into an abap variable. I have read folks doing it in the controller but I am very unclear how this is accomplished.
Thanks again for your help!
Chris
12-17-2011 7:15 PM
hi all,
I actually found the answer. i referred to this very EASY to read step by step example of how to accomplish what I need.
http://www.sapdev.co.uk/webapps/bsp/bsp_userinput.htm
Enjoy and thanks for your help!!
Chris