Function Calls an ABAP method from HTML
Example <button type='button' class='button'
    onclick='S10Apply("save")'>
       Save
 
</button>
Parameters
Nr Description
1
Name of the method to call
2
Parameter string
3
Anchor object
4
true if no data transport of input fields is desired
5
true if no check of mandatory input is desired

Description  In the current ABAP object, the specified parameterless method is called. The method name can be specified in upper or lower case.

If the method does not exist, there is no termination, but a warning message in the SAP application log, transaction SLG2, if the log level is set to 2 or higher. For details see reference ABAP, s10applicationlog().

The string optionally specified as the second parameter can be retrieved in the ABAP method with  s10actionparameter() . You can use it, for example, to pass the value of a selection list directly if you do not want to bind the value to a class attribute via name="...":

<select size="1" style="width: 120px;" class="inputselect"
    
onchange='S10Apply("navigate", this.value)'>
      <option value="">Goto...</option>
      <option value="addr">Address</option>
      <option value="bank">Bank data</option>
     
<option value="tax">Tax data</option>
</select>

With an "external breakpoint" in ABAP we can stop in the called method. The passed string "bank" is accessible via s10actionparameter( ):

 

If the processing in the called method runs for some time, a "processing icon" is automatically displayed to let the user know:

Optionally, you can also output your own additional text here by specifying a text as "processing message" following the HTML element that triggers the action:

<!-- Display processing message -->
<div class="processingmessage">
   Data is read...
</div>

While the method called by S10Apply() is running, the user cannot start a second action that would trigger a method call.
The third parameter in S10Apply(), the anchor element, is rarely needed. You can use it to specify at which HTML element the processing message should be displayed. If you do not specify an anchor element, S10Apply() takes the element that triggered the action.

In the following example, the action is triggered at "Bank data" while the processing message is displayed at "Current view":

<div class="infoblock" style="width:150px;  height:50px;">
 
<label class='label'>Current view</label><br />
  <div class='output'
     style
="font-size:14px;  padding-top: 6px;  font-weight: bold;"
     name
='current_view' id='current_view'>
  </
div>
</div>

<div class="infoblock" style="width:150px;  height:50px;">
  
<select size="1" style="width: 120px;" class="inputselect"
      
onchange='S10Apply("navigate", this.value, document.getElementById("current_view"))'>

         <option value="">Goto...</option>
         <option value="addr">Address</option>
         <option value="bank">Bank data</option>
        
<option value="tax">Tax data</option>

   
</select>
</div>

<!-- Display processing message -->
<div class="processingmessage">
    View is changed
</div>

Messages from the called method are also output at the anchor element:

navigate to special screen
  
method navigate.

    
case s10actionparameter( ).
      
when 'addr'.   "....
      
when 'bank'.
          s10ErrorMessage
'Bank data not available' ).
      
when 'tax'.    "....
    
endcase.

  
endmethod.

For special application functions, e.g. "Cancel" or "Help", the values entered should usually not yet be transported to the object attributes. You can achieve this by setting the fourth parameter to "true".

Before S10Apply() calls the ABAP method, it automatically checks whether all input fields marked as mandatory are filled:

<label class='label' for="bstnk">Customer reference</label>
<br />
<input class='input' required type="text" id='bstnk' name='bstnk'
      
maxlength="35"  style="width: 150px; " />


If you specify "true" as the fifth parameter of S10Apply(), e.g. for a function like "Cancel, "Help" or "Value help", this check is omitted.


In the called method you can access further values of the HTML page with s10contextinfo(). This is necessary in table displays, for example, if the action is to refer to the table row in which the user triggered the action.
Components S10 Framework