Overview In principle, the S10 framework sets no limits on the design of pushbuttons,
so you can either use and customize the default button or define elements yourself that users can use to trigger an action.
Usually, a method should be called in the respective S10 ABAP class; you can achieve this by calling the JavaScript method S10Apply() .
HTML code for a pushbutton: HTML
<button type='button' class='button'
onclick='S10Apply("mybapmethod")'>
Click me
</button>
Called ABAP method: ABAP
method myabapmethod
* Implementation
endmethod
Hints:
The ABAP method to be called is searched for in the active application class.
You can also call your own JavaScript routine first and S10Apply() at the end there.
Example 1: Generate diagrams
(The complete example can be found here: Charts and Diagrams) HTML
<button type="button" class="toolbarbutton"
onclick="S10Apply('generate_random');">
Generate random data
</button>
The ABAP method generates some random data,
from which a diagram is generated later in the HTML:
ABAP
method generate_random.
data:
o_rand type ref to cl_abap_random_int,
seed type i.
" random number sequence.
seed = cl_abap_random=>seed( ).
cl_abap_random_int=>create(
exporting
seed = conv i( sy-uzeit )
min = 5
max = 150
receiving
prng = o_rand
).
diagram_01 = 'A;' o_rand->get_next( ) ';' o_rand->get_next( ).
diagram_01 = diagram_01 '|B;' o_rand->get_next( ) ';' o_rand->get_next( ).
diagram_01 = diagram_01 '|C;' o_rand->get_next( ) ';' o_rand->get_next( ).
HTML-Code:
(Here, in addition to the method name, a parameter
is included besides the method name, in this case the ID of the selected
customer contact)
HTML