Using Variables for Date Calculations 

Prerequisites

To use a selection variable for date calculation, you must have defined a date field as a parameter or select-option in your program.

PARAMETERS DATE LIKE SY-DATUM.

Procedure

To assign a date calculation variable to an existing variant:

  1. Enter the name of the variant on the initial screen of the variant maintenance tool.
  2. Select the Attributes option.
  3. Choose Change.
    The
    attributes screen appears.
  4. Select the Selection variable column for the appropriate attribute.
  5. Choose Selection variables.
    The selection variables screen appears. You can now assign a variable to the date field.
    Example:

  6. Position the cursor on the line in which the stoplight in the "D" column is yellow.
  7. Single-click the stoplight to turn it to green.
  8. Scroll to the right in the display and choose the F4 value help to display proposals for the date calculation:


  9. Select an entry and choose Choose.
  10. Add further parameters if necessary. To subtract days, the minus sign must follow the number (for example, 10-).

    Note that you cannot change the proposals in the list or add new proposals.

  11. Save your entries.
    The attribute screen reappears.
  12. Save the attributes.

Result

You have assigned a variable to a variant for date calculation. Note that after choosing the selection variable, you must save the attributes again on the attributes screen.

Use the selection options pushbutton on the selection variable screen to enter further options for the date variable.