Function Returns the standard name of an attribute value
Example ABAP
mytext =
s10standardname( "kunnr" ). 
Format ABAP
data:
  myattrname type string,
  mytext type string.

mytext =
  s10standardname( myattrname ). 
Parameters
Name Type Description
attrname string
Attribute name
text string
Text for attribute value
Description The s10standardname() method is implicitly called by the S10 framework when the name "attr@text" is specified in HTML for a class attribute "attr", for example

HTML

<div class="output" 
    name="kunnr@text"> </div>

You can use the same notation in table columns, for example
HTML

<div class="outputoutcelldiv" style="width:200px" 
    name="land1@text"> </div>

It is also possible to call s10standardname() in your ABAP program, e.g.

ABAP

land1 = 'CA'.
countrytext = s10standardname( 'land1' ).

A standard name for the specified key is returned, for example the country name "Canada" for the country key "CA". To assign the text, the S10 framework uses the text table defined in the SAP Data Dictionary for the data element. For some data elements such as customer number, the primary table, in this case KNA1, is read and the customer name is returned.

In some cases, other fields are required in addition to the actual value field to determine the text. For example, the region "BW" means "Baden-Württemberg" in Germany and "Berwickshire" in England according to SAP table T005U. Even in such cases, the assignment of the correct text usually works, because the S10 framework for accessing the text table automatically adds further attributes - in this case the country key - if a suitable attribute is defined in the class. The assignment is done via the SAP memory ID and the domain name.

If the assigning of the standard name does not provide anything for some attributes, for example, because you have defined an attribute only as a "string" without reference to the Data Dictionary, or because no text table is assigned in the Data Dictionary, you can use the inheritance mechanism to redefine the method s10standardname() of the superclass /s10/any and implement it appropriately for the attribute in question.

As an example, when outputting a customer, we want to output the name of the user who created the customer master record. In table KNA1, the ERNAM field contains the SAP user name, but no text table is assigned to it. As default name we read the name of the user.

HTML

<div class="output" name="ernam@text"> </div>

ABAP

methods:
      s10standardname redefinition.
* redefinition of s10standardname() for certain attributes
  method s10standardname.

    case to_lower( attrname ).
      when 'ernam'.
      
* read user name  
        data: usr type usr03.

        call function 'SUSR_USER_ADDRESS_READ'
          exporting
            user_name  = ernam
          importing
            user_usr03 = usr
          exceptions
            others     = 1.

        if usr-name2 is not initial.
          concatenate  usr-name1 usr-name2
             into text separated by space.
        else.
          text = ernam.
        endif.

* call up super method for all other attributes
      when others.
        text = super->s10standardname( attrname ).
    endcase.

  endmethod. 
Components S10 Framework