Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
former_member202465
Contributor

In some scenarios we need a flexible number of selections, such that we can't know beforehand. for example: multiple dates range, where the user may add or remove time periods. One way to achieve this is to have a number of fields on a Form View, showing the controls of the relevant ones and hiding the others:

The user presses + on the last visible line to add another row, and - to remove the last visible one.

Another solution using clusters

Modeling the scenario:

1. Have a Form View connected to the relevant search Data Service. Its fields could be as follows:

2. Add a Data Share element. In the Define Data dialog add a numeric field called time_selections and set its default value to 1. This field stands for the number of selection rows:

3. The mapping between the Form View and the Data Service looks like this (notice the number of time selections coming from the Data Share):

4. Move to the layout board and arrange the From / To controls in different columns (right click => Insert Column to add a column to the Form View).

5. Add another column for the + / - buttons. Where more than one button is required add a Melting Box control and add the buttons to it.

6. Set visibility conditions for the Date Picker controls according to the row, depending on the time_selections variable. example 1:

Example 2:

7. Set visibility condition for the buttons. In this example we want them visible on the last visible row only. example 1:

example 2:

8. Define the Add / Remove row Actions for the control. We need to increment / decrement the value of the time_selections variable. Example 1:

Example 2:

Another solution using clusters

1 Comment