Skip to Content
avatar image
Former Member

Dynamic Date with Range- Changing only High value

Dear SAP guys,

I am trying to give a range of values dynamically for the date field in a variant but I have been unsuccessful. My requirement is that I have to fix the low value a constant and only change high value with respect to current date. I am not able to modify only High value.

For example, in the attached picture dynamic-date.jpg, the low value I need to keep the same as 24.06.2011 but the high value 12.09.2017 needs to be changed according to current date. Please let me know your valuable inputs.

Thanks & Regards,

Aswath.

dynamic-date.jpg (15.3 kB)
Add comment
10|10000 characters needed characters exceeded

  • Former Member

    closing this thread as There is no option provided by SAP, I understood that this is not possible

  • Get RSS Feed

2 Answers

  • Sep 12, 2017 at 11:56 AM

    The choices for variables within program variants are very limited. There's no option for what you want to do, so you have to find workarounds (for instance, define a variable in TVARVC, assign it to the date field in your variant, and update this variable daily using a custom program ; or, if the low date needs to always be 24.06.2011, you may hardcode it in the (custom?) program, and use "lower or equal to the current date" by using date variables, etc.)

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Rossi,

      Yes that option is always there, anything not possible we need to achieve through code only. I was just wondering why SAP has not provided such options though they have provided the concept of dynamic date calculations.

      I guess I have no choice but to use coding to calculate the dates dynamically when the program is being executed in background.

      Thanks & Regards,

      Aswath.

  • avatar image
    Former Member
    Sep 12, 2017 at 06:27 AM

    Hi,

    Something like this :

    REPORT ytestsele.

    SELECT-OPTIONS dat FOR sy-datum DEFAULT '20010101' TO sy-datum NO-EXTENSION.


    AT SELECTION-SCREEN OUTPUT.
    LOOP AT SCREEN.
    IF screen-name = 'DAT-HIGH'.
    screen-input = 0.
    MODIFY SCREEN.
    ENDIF.
    ENDLOOP.
    LOOP AT dat.
    dat-high = sy-datum.
    MODIFY dat.
    ENDLOOP.

    START-OF-SELECTION.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi,

      Thanks for the answer, sorry to say that this is not suitable for my requirement as I want to achieve the requirement using the dynamic variant concept only. The report needs to be scheduled with the variant as batch job. I don't want to code the logic inside the program.

      Thanks & Regards,

      Aswath.