Remote Operation Default Value Precedence

Understand runtime precedence of default values during remote operation execution. Set default values in SAP Mobile WorkSpace, from Properties view > Input > Default Values for a given operation.

  • Structure/complex operation arguments – if the parent's structure value is empty and not mapped to MBO attributes, the parent's default value is used and all child default values are ignored. If a child element of a parent default value is empty and not mapped to MBO attributes, the child’s default value or personalization key value is used.
  • Structure/complex load arguments – where the parent's structure default value is not empty and at least one child element has a default value, if the parent's structure value is empty, the parent's default value is used. If the default value of the parent's sub-element is null, the corresponding child's default value is used.
    The parent's default value is ignored and the child's default is used in cases where the child element's value is empty.
    Note: Map structure load arguments to personalization keys of the same structure type.
  • Non-nullable operation arguments – where a simple datatype or a simple datatype contained in a structure type and mapped to an attribute or a client parameter, if the client does not set any value to server, the real processed value is the default value of the type, for example: empty string for string type, 0 for int type.

Structure wrapper node behavior

Using Items-->Item as an example. In this case "Items", "itemNotes", and "orderNotes" are wrapper level arguments. SAP Mobile WorkSpace does not allow the MBO developer to set default values for these nodes (and the other child Notes if it contains only a single structure element). This is consistent with personalization key behavior. In summary:
  1. If a project is created prior to version 2.3 SP03, during migration, SAP Mobile WorkSpace:
    1. Removes the default value of the parent (wrapper level) argument and disables it.
    2. Moves the original default values at the wrapper level to the structure fields of its single child structure node if its single child structure does not have a default value and if the project was created in SAP Mobile Platform version 2.2 or earlier.
  2. If newly created MBOs and operations have a wrapper level load/input argument, SAP Mobile WorkSpace sets its default value empty and disables editing. The MBO developer can only set the default value of the wrapper node's child structure.
  3. For MBO Preview and MBO Operation Test execute, SAP Mobile WorkSpace:
    1. Uses its single child structure node's default value.
    2. Saves the root level default value to its single child structure node when the MBO developer selects 'Save as default value'.

default value precedence 1

Default value precedence examples

The default value precedence can be summed up as:
  1. Within a complex input argument, the first node found with a default value is applied.
  2. If MBO attributes are bound into a node of a complex input argument, any default values defined for the node are ignored.
This example focuses on the “items” input argument:
  • If a default value is defined for “items” it is used to invoke the remote operation.
  • If no default value is defined for “items” and a default value for “item” is defined, then the “item” default value is used.
  • If a default value for both “items” and “item” is defined, the default value for “items” is used:

default value precedence 1
The “item” input argument is mapped to the “Item” MBO:
  • If the modeler defines a default value for “items” or “item” the default value is ignored if the modeler has mapped the input argument node "item" to MBO attributes.
  • If the client does send “Item” MBO data, but some attributes are empty or not mapped (for example “item.discount”), then a defined attribute level default is used .
  • If a default value has been defined for “itemNotes” or “itemNote” and the client does send “Item” MBO data, then the default value for “itemNotes” or “itemNote” is used:

default value precedence 2
The “item” input argument is mapped to the “Item” MBO and the “itemNote” subnode is mapped to the “ItemNote” MBO:
  • If the modeler has defined default values for “itemNotes” or “itemNote” the default values are ignored :

input mapping subnode

Personalization key example

Personalization keys behave similarly to default values.

In this example the “item” input argument is mapped to the “Item” MBO, and the “itemNote” subnode is mapped to a personalization key:
  • If the client sends “Item” data and has set a value for “PersonalizationKey1” then the values for “PersonalizationKey1” are used for “ItemNote”.
    Note: If a default value for “itemNotes” is defined then the default value takes precedence over the personalization key and will be used even if the personalization key contains data.
  • If a default value for “itemNote” is defined and “PersonalizationKey1” is empty then the default value on “itemNote” will be used.

personalization key default value