Skip to Content
Former Member
Jan 08, 2007 at 02:39 PM

calling a abap method in a javascript


Hi all,

I've been browsing a bit through this forum, but there has no answer been completely covering my problem...

I would like to call an abap method in the javascript in order to check some values...

This is what I have done:

<script language="JavaScript" defer="defer">

function do_checks(htmlbevent)




var doubles = "<%= controller->check_doubles( )%>";

if(doubles == true){

var Check = confirm("Test??");

if(Check == false){

htmlbevent.cancelSubmit = true;









The method has the following code:

mehod check_doubles. " returning parameter = rv_double of type flag

rv_double = abap_true.


the button is defined like this...


id = "Save"

onClick = "save"

onClientClick = "do_checks(htmlbevent);"

text = "<%= otr(crm_ic_appl/Save) %>"


The funny thing is, that the controller->check_doubles( ). is already processed at load of the page (although there is no on_load used somewhere...

If I leave out the " if(doubles == true){ } ", the javascript reacts as foreseen..., but when I keep the " if(doubles == true){ } ", the javascript doesn't go through the method anymore...

Can anybody help me out here???