Background documentationData Types in the Context Node Locate this document in the navigation structure

 

Internal and External Data Types

When an editable field is filled with values in the user inteface of a business application, these characters are initially in an external format for the Web Dynpro ABAP application. Only when processed are these characters checked and transformed to an appropriate internal format.

Prices and Quantities

A currency or quantity reference field must always exist for a price or quantity input field. This reference field provides the data type for the internal format. For example, if "50" is entered in an input field, the value of the reference field determines whether this means 50 dollars or 50 Japanese yen. No checks can be made (for example, the correct number of decimal places) until the correct data type has been determined.

This graphic is explained in the accompanying text.

Data and Data Types: Price and Currency

The context attribute for the value of the input and the context attribute for the currency must share a node (here the node input_node). Otherwise the value cannot be assigned to the data type. If, for example, you use a wizard to generate the node from an existing ABAP Dictionary structure, the required reference of the value attribute to the data type attribute is created automatically, since the reference structure is usually the same as the ABAP Dictionary structure. In very rare exceptions, however, the reference structure can be taken from a different ABAP Dictionary structure. In this case, the reference structure cannot be located in the node created by the wizard and the reference type is unknown at runtime. You must configure the reference manually. To enable this, the interface IF_WD_CONTEXT_NODE_INFO includes the method SET_ATTRIBUTE_REFERENCE_FIELD. If a reference fields does not exist at runtime or is not recognized, a default format applies (with two decimal places)

The value of a price or quantity field must always be a packed number (in BCD format).

Note Note

Since the application may at some point be required to handle currencies that do not use two decimal places (such the Japanese yen), you must run comprehensive tests on the application programs.

End of the note.
Additional Notes

The following gives you some useful background information about data types in context nodes and their conversion from input to output.

Data Input
  • All data input is checked and transformed in accordance with the referenced data type. Corrections may be made, such as when the year in a date was entered as two digits and the two missing digits are obvious and can be added.

  • Conversion exits are called automatically. Any conversion errors are displayed.

  • For prices and quantities, the system first finds the reference field and then converts the input accordingly.

  • If a ValueSet exists for the attribute whose values is entered by the user, the conversion checks whether the input value is actually part of the ValueSet.

  • Conversions from external formats to internal formats retain any space characters in string and character input. This is not the case for other data types, unless the format has been modified explicitly by the application developer. This is done dynamically with CONTEXT_NODE_INFO.

Data Output
  • Internal data formats are also converted to external data formats automatically. The conversion includes any local user settings, such as local output formats or dates and times.

  • Any conversion exits declared in the data element are called.

  • Digits are displayed with or without a leading zero, depending on the data type.

  • You can change some formatting properties of context attributes, depending on the data type. To do this the CONTEXT_NODE_INFO is changed dynamically.

  • If the output consists of packed numbers, the sign is placed to the right of the number by default. All other data types place the sign on the left.