You created a UI Panel Screen Section for the SalesOrder entity where you add these fields:
The solution is to create a looked-up field in a form's data structure, which will automatically load the values when the form loads, but also when the field value changes, e.g. while the user edits the data.
1. Create a Lookup
- Select BusinessPartner entity.
- Right click > Actions > Create Lookup.
- As a Display Field select PhoneNumber.
- Press OK.
This will create a lookup which loads a phone number by providing a customer's id.
Now you add the looked-up field to the form's data structure.
- Go to the form's data structure Data > Entities and select the BusinessPartner SalesOrder entity.
- Right click > New > Lookup Field.
|Field||refBusinessPartnerId||The field by which we will load the phone number.|
|UseLookupValue||True||This indicates we will actually look-up the value|
|DefaultLookup||Lookup||BusinessPartner_PhoneNumber||By this lookup the value will be looked-up--, so the result will be the phone number instead of the customer's id.|
|Name||BusinessPartner_PhoneNumber||Let's rename the field so it indicates the content (what we take and from where from it will contain).|
Now we have the data source configured that so it will contain a phone number. It will also automatically reload it when the lookup source parameter (refBusinessPartnerId) changes so the UI does not have to care about this.
In this last step we will place the Phone Number field on the form. Since the panel designer only displays entity fields, we will not see our special BusinessPartner_Phone field in the tree. We will need to add it manually.
- Open the UI panel Screen Section based on the BusinessPartner SalesOrder entity.
- Expand In the Basic Controls SalesOrder tab in the toolboxSelect AsTextBox Toolbox select the BusinessPartner_PhoneNumber field.
- Change to the Widgets tab in the Toolbox, select AsTextBox/AsDateBox and drag it onto the panel.
- In the Properties find the (DataBindings) and expand it
- Click on (Advanced) and then click on the [...] button
- From the list of fields select Text and enter the following: AsapDataSet . The DateValue should show OrigamDataSet - SalesOrder.BusinessPartner_Phone PhoneNumber (replace the SalesOrder with being your current entity name and the BusinessPartner_Phone with PhoneNumber your looked-up field).
- Set ReadOnly to True as this field is not editable anyway.
That's it. Now you have manually bound the text field with the looked-up field that will be provided when you execute the form.