Help Center>Foundation Help

Applies to:

  • Winshuttle Foundation

6-2. Add vendor search

In this step we will add a powerful search function to enable form users to search vendors prior to creating a request for a new vendor. An overview of the process is as follows:

  1. Create a search function in Winshuttle Query that searches for vendors.
  2. Create a vendor search group and associated fields in the form.
  3. Import the Winshuttle Query script into Composer and then configure it.
  4. Add a checkbox element to the Composer form that will invoke the search.
  5. Configure one or more rules that govern the search checkbox behavior.

On this page

  1. Create the vendor search script in Query
  2. Create the vendor search section of the form
  3. Import the vendor search script
  4. Configure vendor search fields
  5. Add a Web service for the search
  6. Add a vendor search button
  7. Add a rule changing lower case to upper case
  8. Test the search feature

Additional Resources

Query Help

Create the vendor search script in Query

Back to top

Create the search function using Winshuttle Query. The screenshot (right) shows the Output fields.

Note that the Selection column checkbox is checked for match code fields.

  • Match code 1 (MCOD1) = name
  • Match code 3 (MCOD3) = city

 

Test the search in Winshuttle Query.

Here we search for the term 'Acme' and the query successfully returns results.

 

Map the fields to output to XML, and then save the file as Vendor Lookup.qsq.

 

Create the vendor search section of the form

Back to top

In this step we will create a group of form fields to use for the Vendor Lookup information. The end result should look something like this when we are finished:

Create the Search Existing Vendors Group

  1. In Composer, click the Form tab.

  2. Click the Originator tab.

  3. On the ribbon, click New Group.

  4. In the Properties pane, click Elements.
  5. Under Basic Elements, click Textbox.2 times to create 2 new text boxes.
  6. In the Properties pane, under Container Elements, click Repeating Table.
  7. In the New Repeating Table dialog box, under Number of Columns, type 4, and then click OK.

    At this point the newly added group should look like this:

    In the remaining steps, we will format the new group and rename its elements.

  8. Click the Group Label, click the placeholder text, and then replace it with Search Existing Vendors.

    Optional: Make the Search Existing Vendors text more prominent and easier to see. On the Composer ribbon, click the Increase Font icon (Composer increase font icon graphic) twice.

  9. Below Search Existing Vendors, click Label (click to edit), and then replace the text with Vendor Name, as shown below.

  10. Below Search Existing Vendors, click Label (click to edit), and replace the text with City Name, as shown below.

  11. In the Repeating Table, rename each of the headers as described below:

    Header 1: Click and rename to Name of Vendor.

    Tip: You can press the Tab key to move to the next header and rename it.

    Header 2: Rename to City

    Header 3: Rename to Country

    Header 4: Rename to Account Number

    As the last step, we will move the Vendor Search section above the Basic Vendor Information group.

  12. Right-click the Search Existing Vendors group, and then click Move Up. Repeat this step until the Search Existing Vendors group is just below the Requester Information group.

The end result should look something like this:

Import the vendor search script

Back to top

  1. In Composer, click the Solution tab.

  2. In the Solution pane, right-click Query Scripts, and then click Import.

  3. Click Choose File, and then browse to the folder location of the Vendor Lookup.qsq file.
  4. Click Open, and then click Next.
  5. In the Confirm dialog box, click Yes.
  6. In the Field Mapping screen, set the following properties (leave others not listed at their default values):
    • Description: VendorLookup
    • Group Name: Lookup
    • Mapping Name: Vendor Lookup
    • Connection: Use the Logged in Windows Account

     

  7. Click Generate.
  8. You should see a Field Mapping screen similar to the one shown below. Click OK.

    On the Field Mapping Parameter screen, click Generate Form Fields, and then click OK. Composer-importing a script and generating form field screenshot

  9. Click OK to finish.

Configure vendor search fields

Back to top

Now we will configure the input and output field bindings for our Vendor Search feature.

  1. Click the Form tab.

  2. In the Search Existing Vendors group, click the Vendor Name field.
  3. In the Properties pane, next to Binding, click the arrow and then select LikeOP from the list.

  4. In the Search Existing Vendors group, click the City Name field.
  5. In the Properties pane, next to Binding, click the arrow and then select LikeOP_1 from the list.

    Now we will connect the Repeating table fields to the output generated by the Vendor Lookup Query.

  6. In the Search Existing Vendors group, click the Name of Vendor field.
  7. In the Properties pane, next to Binding, click the arrow and then select LFA1_Name_1 from the list.

  8. In the Search Existing Vendors group, click the City field.
  9. In the Properties pane, next to Binding, click the arrow and then select LFA1_City from the list.

  10. In the Search Existing Vendors group, click the Country field.
  11. In the Properties pane, next to Binding, click the arrow and then select LFA1_Country_Key from the list.

  12. In the Search Existing Vendors group, click the Account Number field.
  13. In the Properties pane, next to Binding, click the arrow and then select LFA_Account_Number_of_Vendor_or_Creditor from the list.

Add a Web service for the search

Back to top

In order to activate the Vendor Search function in our form, we need to add a Web Service element to it.

This Web Service is the Vendor Lookup Query we imported into the solution earlier in this section. Now we need to add a Web Service and connect it to the Query. In later steps we will create a button that activates this Web Service.

diagram-button-webservice-query-output

To add and configure the Web service:

  1. In Composer, click the Form tab.

  2. In the Properties pane, click Elements.

  3. Click Advanced Elements, and then click Web Service.

  4. Below the View tab, click the WebService element.

  5. In the Properties pane, set the following properties for the Web Service element:
    • Name: (Optional) Type a name for the service (such as SAPWebService-VendorLookup), or you can leave the default name.
    • Web Service: Click the arrow, and then select Vendor Lookup from the list.
    • Invoked by Rule: Check the box.

Add a vendor search button

Back to top

Now we will add a button to the form that invokes the Vendor Search function.

  1. Click the Form tab.

  2. Click the Search Existing Vendors group.
  3. In the Properties pane, click Elements.

  4. In the Properties pane, click Basic Elements, and then click Button.

  5. In the Form Canvas, in the Search Existing Vendors group, click the button element you just inserted.

  6. In the Properties pane, configure the following properties:
    • Name: Search_Vendors
    • Label: Search Vendors
    • Button Behavior: Click the arrow, and select Custom from the list. (This will show the Rules option as show below.)

  7. Next to Rules, click the Options button. [...].
  8. Click Add, and then click Rule Wizard.
  9. On the Create Rule screen, set the following properties:
    • Label: Type a name (for example, CallWebService) for the rule.
    • Type: Click the arrow, and select Actions from the list.
  10. Click Add.

  11. On the Add Rule Action screen, set the following properties:
    • Action: Click the arrow, and then select Execute Web Service from the list.
    • Web Service Control: Click the arrow, and then select VendorLookup from the list.

    Tip: The name of the Web Service Control you select here should be the same one created when you imported the vendor search script (in case it's different from our sample screens/steps).

  12. Click OK.
  13. On the Create Rule screen, click OK.

  14. On the Rules Editor screen, click OK to finish.

Add a rule changing lower case to upper case

Back to top

The Vendor Name Search field must be upper case for SAP. To accommodate this, we will add a rule/formula to change the lower case values to upper case.

  1. Click the Form tab.

  2. In the Form Canvas, click the Vendor Name field.

  3. In the Properties pane, next to Rules, click the Options[...] button.

  4. In the Rules Editor screen, click Add,and then click Rule Wizard.
  5. On the Create Rule screen, set the following properties:
    • Label: Type a name (for example, MakeUpperCase) for the rule.
    • Type: Click the arrow, and select Actions from the list.
  6. Click Add.

  7. On the Add Rule Action screen, set the following properties:
    • Action: Click the arrow, and then select Set a Field Value from the list.
    • Field: Click the arrow, and then select the name of the field to which the Search Vendor field is bound to. For this tutorial, the Search Vendor field was bound to the LikeOp field, which was configured in the step Configure vendor search fields.

  8. Click the Function F(x) button.
  9. On the Insert Formula screen, click Insert Function.

  10. On the Insert Function screen, under Functions, click the arrow and then select toUppercase from the list.

  11. Click OK.
  12. On the Insert Formula screen click in the formula, and then select and delete the word text.

  13. With the cursor in between the (), click Insert Field Value.
  14. On the Select a Field screen, expand Lookup, Lookup_Input, and then click on LFA1_SEARCH_TERM_FOR_MATCHCODE.

    What we are doing here is adding a formula that acts upon the Vendor Search field and then converts the input to upper case after the data is entered by the user.

  15. The end result should look like this:

  16. Click OK.

  17. Click OK.

  18. Click OK.
  19. Click OK to finish.

Test the search feature

Back to top

We should now have a fully functional search function built into the form. Publish the solution to your development environment, and test the search function to make sure it works.