Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Dynamic Date with Range- Changing only High value

0 Likes
3,333

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.

6 REPLIES 6
Read only

Former Member
0 Likes
2,132

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.

Read only

matt
Active Contributor
0 Likes
2,132

It's not clear, but I think he's wanting to set it in the variant, not in the code.

Read only

0 Likes
2,132

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.

Read only

Sandra_Rossi
Active Contributor
2,132

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.)

Read only

2,132

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.

Read only

0 Likes
2,132

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