Ansicht
Dokumentation

/IPRO/MGT_RULES - Define Rules

/IPRO/MGT_RULES - Define Rules

TXBHW - Original Tax Base Amount in Local Currency   rdisp/max_wprun_time - Maximum work process run time  
This documentation is copyright by SAP AG.
SAP E-Book

In this step you maintain evaluation rules for clauses. By means of rules, you determine whether one or more clauses are included in or excluded from a document. Element rules are evaluated until there are no more clauses remaining for evaluation.

Note

Due to the complexity of the subject, it is strongly recommended that a qualified person performs this activity.

You must have defined the relevant variables and elements.

  1. To edit a rule, select the corresponding entry and choose Maintain Rule: the two-pane window of the Formula Builder is displayed.
  2. In the left pane, the list of available fields is displayed, in the right pane the available functions. Click the corresponding buttons to build or extend your formula. Note that multiple criteria are allowed. You can also edit your formula in expert mode and perform a syntax check before saving your formula.
  3. Save your changes.

Key Concepts

  • Rules must be authored in a specific structure and syntax.
  • Rules test a condition to take action(s).
  • Rules can be simple or complex.
  • Rules may be nested using the true and/or false action to test another condition.
  • Rules use functions to perform true and false actions.
  • To author a rule the relevant variables and elements must exist.
  • The function Is Precondition Valid allows you to reuse the same boolean statement without the need of maintaining it inside multiple rules.
  • Functions can be added by means of Business Add-Ins to extend current functionality.

Hints

  • Rules can be authored in normal and in expert mode. Expert mode enables you to edit rules directly.
  • You can copy and paste an existing rule and use it as a baseline for your current rule.
  • You can refer to the evaluation of another rule.
  • You can author a NO ACTION in a rule as a True or False action.

Structure

The structure of a rule contains a conditional statement, a true and a false action:

IF(Conditional Statement, True Action, False Action)

You can use the following functions and conditions, respectively (Note that this list is non exhaustive.):

  • Include Mandatory Element
  • Include Optional Element
  • Include Recommended Element
  • Exclude Element
  • Is Value in Table
  • Is Element Included
  • Is Element Excluded
  • Is Precondition Valid
  • Is Value in Table
  • AND
  • OR
  • NOT
  • =, &lt;&gt;, >, <

This condition tests multiple criteria:

IF((VAR1= 'X', INCLUDE_MANDATORY_ELEMENT ( RegSet1 ClauseA), ")

IF((VAR1= 'X' OR VAR2= 'X') AND Total_Value > 100,000, INCLUDE_MANDATORY_ELEMENT ( RegSet1 ClauseA), ")

This example uses nested logic:

IF( VAR1 = 'X', INCLUDE_OPTIONAL_ELEMENT (REG1 Clause 1A ),

IF( VAR2 = 'X', INCLUDE_RECOMMENDED_ELEMENT (REG2 Clause 2A ),

IF( VAR3 = 'X', INCLUDE_MANDATORY_ELEMENT (REG3 Clause 3A ), '' ) ) )

This example uses the function "Is Precondition Valid":

Rule1 will be referenced from Rule2 to test the boolean logic specified in it. When Rule1 evaluates to True, the rule will return an 'X' (or TRUE) and when evaluated to False, the rule returns a null (or FALSE) value.

Rule 1:

IF(VAR1='X' OR VAR2='X' OR VAR3='X','X',")

Rule2:

IF(VAR4='X' AND IS_PRECONDITION_VALID(RULE1), INCLUDE_MANDATORY_ELEMENT ( RegSet1 ClauseA), ")

This example uses the function "Set Value":

IF( WORK_IN_US = 'X', SET_VALUE( 'COUNTRY', 'United States' ) AND INCLUDE_OPTIONAL_ELEMENT( ZFORM_2:ZREG: ), '' )

This example uses the function "Is Value in Table":

IF( IS_VALUE_IN_TABLE( 'LI_TABLE', 'LI_NO', '10' ), INCLUDE_MANDATORY_ELEMENT( RegSet1 ClauseB ), '' )

The following steps will guide you through the formula building process. You are however free to build your formulae differently, depending on their complexity.

To build a conditional statement:

  1. On the function panel in the middle of the screen or in the right pane, select the IF function. The function is displayed as follows on the upper part of the screen:
    IF( , , )
  2. The cursor is automatically positioned between the opening parenthesis and the first comma.
  3. Select a variable in the left pane. You can use various search criteria. You can for example filter variables by type, search for text contained in a variable or sort variables. The formula is displayed as follows:
    IF(VAR1, , )
  4. Select a conditional statement. The formula is displayed as follows:
    IF(VAR1=, , )
  5. Select String to enter a character string (for example X). The formula is displayed as follows:
    IF(VAR1='X', , )
  6. Select the next logical statement.
  7. Finish the conditional statement by going through the steps 4 to 6. Your formula should look like this:
    IF(VAR1='X' OR VAR2='X', )
  8. Position your cursor after the last comma and go through the second step.

To build a TRUE action:

  1. Select a function in the right pane (for example INCLUDE_MANDATORY_ELEMENT). Your formula should look like this:
    IF(VAR1='X' OR VAR2='X', INCLUDE_MANDATORY_ELEMENT ())
  2. Position your cursor after the function and between the opening and closing parenthesis.
  3. Select the relevant element in the left pane. You can use the Show me filter to display only elements. Your formula could look like this:
    IF(VAR1='X' OR VAR2='X', INCLUDE_MANDATORY_ELEMENT (REG1 CLAUSE 1A))
  4. Save your formula.

To build a FALSE action:

Perform the same steps as above for building a TRUE action.






PERFORM Short Reference   ABAP Short Reference  
This documentation is copyright by SAP AG.

Length: 6954 Date: 20240426 Time: 033954     sap01-206 ( 82 ms )