Show TOC Start of Content Area

Background documentation Dynamic Metadata  Locate the document in its SAP Library structure

Overview

Non-typed metadata is information that is added directly to the instance of a context element without having defined a specific data type in the Java Dictionary. The main differences between typed metadata and non-typed metadata are that the life cycle of the typed metadata is determined by the life cycle of the context and that its name cannot conflict with the names of other data types.

If a context attribute is a simple data type of the type Simple Types and a program sequence of the application modifies metadata at runtime, this modification is only visible for this context attribute. All other attributes of the application still use the metadata definitions in the Java Dicitionary.

For data binding, the use of non-typed metadata has no disadvantages compared to the use of a typed metadata. A UI element must only be provided with the information of how to access this metadata. This is possible when using a data binding reference to a context attribute that provides the metadata. Therefore, there is no difference in the handling of metadata, and it is not important how the metadata is assigned to the context. All generic services work the same way, including the input help and the validation.

Example

The node described below can be filled with metadata at runtime, as follows:

1. Context description at design time:

Value-Node "myNode", collection type=list, cardinality=0..n, selection=0..n

and the attribute:

Value attributes “myValue”, type="String".

2. The corresponding Java source code example that you create in the wdDoInit method of the controller implementation:

// The ISimpleTypeModifiable interface enables access to

//a data type instance that can be modified at runtime:
ISimpleTypeModifiable myType = 
   wdThis.wdGetAPI().getContext.getModifiableTypeOf(“.myNode.myValue”);
//Sets the label text for this data type.
myType.setFieldLabel(“New label”)
//Sets the valid values of this data type. The individual elements are inserted

//when the put method is called and

//and the value set is filled with the appropriate

//key value pair.

IModifiableSimpleValueSet values = 
   getSVService().myType.getModifiableValueSet();
values.put(“key_1”,”Mister”);
values.put(“key_2”,”Mistress”);
values.put(“key_3”,”Miss”);

  

 

End of Content Area