Working with 'Linked line items'
A link can be established between two line items of distinct business objects by adding a typed attribute of the 'Linked line item' (LinkedLineItemAttribute) type. This attribute is assigned for exactly one of the two line items to link and is stored in the context of its parent business object. This makes a link between line items asymmetric by definition, at least formally, whereas the relation between the linked line items or their parent business objects may or may not have a 'directional' nature in reality.
The dynamic enum Verknüpfter Positionstyp qualifies subtype choices for typed attributes of the type 'Linked line item'. Each subtype refers to a specific combination of business object types between which line items should be linked. Technically, a Source line item type is paired with a Linked line item type. It is possible to link between line items of business objects of the same type by a subtype referring to the same business object type for 'Source' and 'Linked line item' types.
In contrast to assumptions that the labels might suggest, the definition of a Verknüpfter Positionstyp does not relate to a specific Line item type. However, this relation is created in the context of an input form, where a 'Linked line item' element must be placed within a 'Line item' element referring to a distinct Line item type, which defines the source line item Line item type. The line item type of the linked line item must be assigned within the service configuration of the Combobox for Linked line item. The same Verknüpfter Positionstyp subtype may be used to define links between line items resembling different combinations of line item types depending on the context within an input form, but it requires a specific parent business object type at each end of a link.
Example:
An input form for shipments allows links from Direct line items (with line item type 'Default') to exactly on line item of a specific order.
In the screenshot above, a Linked Order has been selected which is plainly identified by its internal ID. By default the Combobox would be labelled 'Linked business object' to fit any business object type.
The Linked Order line item, which would be labelled 'Linked line item' by default, lists line items of the selected order as choices in a dropdown.
This two stage selection process for Linked business object and Linked line item yields the following object data, once line item 1.1.2 has been selected:
<?xml version=
"1.0"
encoding=
"UTF-8"
?>
<shp:Shipment xmlns:shp=
"SCM.SHIPMENT"
xmlns:ord=
"SCM.ORDER"
... >
...
<attributes/>
<lineItems>
<lineItem id=
"4851"
... >
<attributes>
<shp:ShipmentLineItemLinkedLineItem id=
"601"
creatorId=
"1901"
created=
"1569242860770.770000000"
ownerId=
"1902"
lastModified=
"1569242860770.770000000"
lastModifierId=
"1901"
>
<value linkedBtoId=
"3651"
linkedBtoType=
"ord:Order"
linkedLineItemId=
"3854"
linkedLineItemType=
"ord:OrderLineItem"
type=
"SHIPMENT_TO_ORDER"
/>
</shp:ShipmentLineItemLinkedLineItem>
</attributes>
</lineItem>
</lineItems>
</shp:Shipment>
The links is stored in a ShipmentLineItemLinkedLineItem-Attribute.
The Linked business object is identified by its internal ID (linkedBtoId) and business object type (linkedBtoType).
The Linked line item is identified by its internal ID (linkedLineItemId) and a type matching the business object (linkedLineItemType).
The Subtype of the typed attribute is stored in the field type.
Any further information regarding the linked business object or the linked line item, must be explicitly retrieved and/or defined and formatted in the service configurations of the respective Combobox elements.
For the Linked Order combobox, the default configuration was accepted here, although this will rarely be acceptable in practice:
Label expression: {id} ... this field is available without any explicit Projection defined.
No settings for Join, Search restriction and Search order were applied here. These settings can be applied as pointed out with respect to the 'Linked line item' in the following.
For the Linked Order line item combobox the following service configuration was applied:
The Search order was defined to present entries in ascending alphabetical order by Line item no., which should meet the intuitive expectation of most users.
For the purpose of selecting line items, the systematically assigned Line item no. should be accompanied by a Goods description and a text notification in case the Stackable flag is set for the line item. Since the Line item no. is an immediate property of the line item object, it can be addressed directly in the Label expression, whereas the other data is provided by typed attributes of the line item so their values need to be retrieved via Joins to these attributes. In our example, the Goods description is supplied by the text attribute (GOOD_DESCRIPTION) via Alias t_goodsdesc. In the same way, the flag attribute Stackable (STACKABLE) is supplied via alias f_stackable:
Based on the data provided by via Join, a Label expression can be compiled in the Projection tab:
The Label expression begins with the systematic Line item no. (lineItemId) which is followed by a pipe symbol between spaces.
On the right, the Searchable projections retrieve values for goodsDescription and stackable from values of the joined attributes.
The text for goodsDescription is read from the Text (textValue) property of the attribute value (~.value.~).
If the stackable flag is set, the applicable localization for the name of this Text type should be added as a suffix between parentheses. This is achieved by resolving the Flag value (flagValue) from the attribute value (~.value.~) and evaluating it by auxiliary function $if (see PARSE for details) in the Label expression. If the flag value is true, the applicable localization for the statically defined flag type is queried from Localization or Company specific localization (Resource STACKABLE in bundle de.lobster.scm.base.bto.attribute.FlagType).
The Linked line item type tab features specific settings for the Linked line item combobox:
The mandatory selection of a Line item type limits choices in the dropdown to exactly one Line item type. In this example the default selection 'Default' (DEFAULT) was accepted.
In the Line item level(s) field a comma separated whitelist of line items levels can be entered, to limit line item choices to items from these levels.
With no entry (as in picture) items from all levels are included.
Levels are identified by integer numbers ascending from 0 (for Direct line items of the business object).
Further restrictions for line item selection can be configured in the Search restrictions tab:
As a variation of the unrestricted initial example, a restriction has been added here, which limits the selection to line items flagged as Stackable.
This search restriction returns the following selection for the Linked Order line item in the context of our example:
►NOTE◄
If a user has write access to the combo boxes for the two-step linking of positions in an entry form, by default there is no mechanism that prevents the selection for the Linked business object from being deleted after a position has been selected. This also allows the user to create an inconsistent combination of position and business object selection. If required, this type of inconsistency may be prevented, e.g. by resetting the selection for Linked line item (to $null), when the choice for Linked business object is removed or altered.
If a Search restriction is defined for a Linked line item combobox, the user may end up without any selection, if no line item of a selected business object matches the conditions defined in the restriction. An interactive linking process may benefit, if the choices for Linked business object are also restricted to return only business objects with at least one eligible line item. However, adding a complex restriction to a search running on a large set of business objects including their line items, can have an unfavorable effect on the performance of the search.