Form design notes - search query
When using match codes in a query (which usually requires all caps in SAP to work correctly) it is recommended to correct all case to upper case in the form. To do this in an InfoPath form, use the translate function in the properties section (see example and video below). This will eliminate any errors that could occur from the case not being in all caps.
To create the query output, first add a RepeatingTable from the Controls menu for the form. Then right-click on the Repeating Table and select Change Binding and choose the output of the query (at this time you can choose the order of the output fields for the table). Only after this is set then you can change the names on the form if you don’t like the default names.
You can insert other fields (columns) into the table if required. Like the selection check box in the table below, these extra fields will not exist in the Query, but will be visible on the form (see video below).
In this example, we added a check box to allow the user to identify which Material number they want to copy based on the results of the SAP query. Please note only one selection is possible.
When using InfoPath, this would (ideally) be a radio button (not a check box – which allows multiple selections), but a radio button does not work in this case because it is in a repeating table. Each line in the repeating section is a new instance of the control for the radio button. This means that each line has no relation to any other lines. We recommend a check box in this case.
In this example, we recommend hiding the search section in case the user knows the info for the material they want to copy from, which will reduce the number of fields visible by only showing necessary fields. A check box has be provide at the beginning of the form so if the user chooses to search – then the section is unhidden when the check box is checked. Once the user makes a selection from the output of the search it will auto fill in the material number and material type for the next step (see Prepopulating fields).
As noted above a check box is recommended for the selection of material (from the output of the Query) additional rules can be added to hide the section as soon as one (only one) check box is checked; therefore only allowing the user to select one item at a time. The section can also be unhidden if a different selection is desired and this action will clear any previous selection made.
Hiding the section is done with a rule (Formatting type) and the condition is set so that when the checkbox is set to false/unchecked, this is also the default selection when opening the form.
The auto fill is also done with a rule (Action type) based on the selection to set a field value of the Material Number and Material Type with a condition that the selection is true /checked.