| Function | Returns the HTML context info object | ||||||
| Example |
ABAP
|
||||||
| Format |
ABAP
|
||||||
| Parameters |
|
||||||
| Description | When executing an ABAP method that the user has triggered by an action in the
HTML page, it may be necessary to know more precisely what the action refers
to, e.g. which line in a table display.
For this purpose, a call to s10contextinfo() returns an object containing the following information about the origin of the action in the HTML page: ABAP
The name= attribute of the HTML
element where the action was triggered, in lowercase.
ABAP
The current value of the HTML element where the action was triggered, in the
external representation, for example a customer number without leading zeros.
You can use the s10userinput()
function to get the value in internal format.
ABAP
The name of the table in which the action was triggered, in lowercaseABAP
The number of the table row where
the action was triggered.
ABAP
The id= attribute of the HTML element in which the action was triggered, or of
the next parent HTML element with an id. For table cells, the id is set
dynamically when the table is built in HTML unique per cell.
ABAP
The getvalue() method provides s10contextinfo() to retrieve additional values
from the HTML page. You can use it to retrieve the values that were
provided in the HTML page by elements of the class "linkkey", e.g.HTML
The current value of the attribute "kunnr" is then noted in the HTML page
and can be retrieved later by s10contextinfo->getvalue( 'kunnr' ). All elements
with class "linkkey" that are on the same level in the HTML hierarchy as the
element that triggered the action are taken into account. It is best to insert
the "linkkey" elements right after the corresponding action element.
The getvalue() method returns the values in the external representation, for example a customer number without leading zeros is returned. With the s10userinput() function you can get the value in internal format. Or you can use s10fromcontextinfo(), which already combines s10contextinfo->getvalue() and s10userinput(). If a child object is named as name= in the linkkey element, e.g. name="abc.kunnr", the value is taken from the attribute "kunnr" of the object "abc", but provided under "kunnr", not under "abc.kunnr". The reason for this is that the called method can also be in the object "abc" and the name attribute name "abc" is not known there. As an example for the use of s10contextinfo() here is a customer list, where we can display the customer address per line by a click. Below the address we have displayed a pushbutton with which the user can branch to a change dialog for the address:
HTML
ABAP
In order that the changed address is also displayed immediately in the list, something more is to be done, which is explained in detail elsewhere. But here, for the sake of completeness, is the whole method including the update of the list display: ABAP
This will then display the changed address immediately:
Instead of the class "linkkey" we can also use the number of the row on
which
the user clicked. If all the needed information can be found in the table row,
in our case only the customer number, this is even a bit easier:
Reading the address twice is necessary in both variants of the method, once for "mykna1" and once for the object <c> corresponding to the list line, because address information is displayed both in the directly displayed table line and in the detailed information (after clicking on the list line). For example, if we use the line ABAP
a change of the country would not be displayed in the list but only in the
detail info of the list line. |
||||||
| Components | S10 Framework |