Help Center>Foundation Help

Applies to:

  • Winshuttle Foundation

4-5. Create a rule to extract the vendor number

In this step we are going to build a feature into the form that will use a rule to extract the Vendor Number field from the Log field when a Vendor is successfully created in SAP.

On this page

  1. Create a vendor number and group
  2. Create rules for error conditions

Create a Vendor Number group and create a rule

  1. First we will create a new group called Vendor Number and add it to the bottom of the form. Give it the following properties:

  2. Next, add a Text Box element to the Vendor Number group. Give the Text Box element the following settings:
    • Name: Vendor_Number_Generated_by_SAP
    • Binding: Vendor_Number_Generated_by_SAP
    • Element Type: TextBox
    • Required: False
    • Read Only: True

  3. In the Text Box Properties pane, next to Rules, click the [...] options button.

  4. On the Create Rule screen:
    • Label: Type VendorNumberExtract.
    • Type: Select Action from the drop-down menu.

  5. Click Add, and then select Rule Wizard.
  6. On the Add Rule Action screen:
    • Action: Select Set a Field Value from the menu.
    • Field: Select Vendor_Number_Generated_by_SAP from the menu.
    • Value: Click the [F/x] (Formula)button.

      The typical SAP Log message that appears when a Vendor is successfully created lists a 10 digit string that occurs in the 8th positionof the output log. So we are going to create the rule such that it will set the Vendor number using the Substring function.

  7. On the Insert Formula screen, click Insert Function.
  8. On the Select a Function screen, select Substring from the drop-down menu.

  9. Click Insert Field Value.
  10. On the Select a Field screen, expand XK01_XML_Mapping_TXR, then expand XK01_XML_Mapping_TXR_Output. Click LOGFIELD,and then click OK.

    You should see this:

  11. Click OK.

  12. Click OK.

  13. Click OK a final time to finish.

Create rules for error conditions

Back to top

Now we are going to create 2 rules:

  • The first rule is a formatting rule that simply highlights the field when there is an error in the log field.
  • The second rule sets the Vendor number to 'blank'.

Create a formatting rule

Back to top

  1. Click the Vendor Number Field.
  2. In the TextBox Properties pane, next to Rules, click the [...] options button.
  3. On the Rules Editor screen, click Add, and then click Rule Wizard.

  4. On the Create Rule screen:
    • Label: Type SAP-Error.
    • Condition:Click None - Rule runs when field changes.

      On the Rule Condition screen, under RunRule When This Condition Is True: Select Logfield from the menu. In the next field, select Begins With..., and in the final field, type Err, as shown in the example below. Click OK.

  5. Under Type, click the drop arrow, and then select Formatting from the menu.
  6. Under Apply Styles to Fields, click the drop arrow, and then select Logfield from the menu.
  7. Set the text background color and text color to indicate an error. In our example below, we set the Logfield background to yellow, and the text to red.

  8. Click OK to finish.

Create a rule to blank the error field

Back to top

  1. Click the Vendor Number Field.
  2. In the TextBox Properties pane, next to Rules, click the [...] options button.
  3. On the Rules Editor screen, click Add, and then click Rule Wizard.
  4. On the Create Rule screen:
    • Label: Type BlankVendorNumberonError.
    • Type: Click the drop arrow, and select Actions.
    • Click Add.
  5. On the Add Rule Action screen:
    • Action: Select Set a field value from the menu.
    • Field: Select Vendor_Number_Generated_by_SAP_.
    • Value: Type quotation marks with a space in between them, like this: " ".

      Click OK.

  6. On the Create Rule screen, Under Condition, click None-Rule runs when field changes.

    On the Rule Condition screen, under RunRule When This Condition Is True: Select Logfield from the menu. In the next field, select Begins With..., and in the final field, type Err, as shown in the example below.

  7. Click OK.
  8. Click OK.

  9. Click OK to finish.