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 variant date calculation based on X days

manu_dasa
Explorer
2,064

Hi All,

Is there a way in which the date can directly be calculated on the dynamic variant in SAP for a certain number of days. For example I would want to fetch the data for every 10 days before today. So that means, I will need all the records before 10,20,30 days which are basically multiples of 10. Currently SAP allows a dynamic variant on just X number of days, i.e it will help be fetch data 10 days before the current date, but not days in multiple of 10.

The scenario for me is that I need a batch job (run daily) to send remainder emails after every 10 days the entry is created in a custom table. While I know i can handle in the code, I am trying to check if there is a way to handle it dynamically like when the customer might want to increase or decrease the frequency of sending the remainder emails every 7/10/15 days.

Hi All,

Is there a way in which the date can directly be calculated on the dynamic variant in SAP for a certain number of days. For example I would want to fetch the data for every 10 days before today. So that means, I will need all the records before 10,20,30 days which are basically multiples of 10. Currently SAP allows a dynamic variant on just X number of days, i.e it will help be fetch data 10 days before the current date, but not days in multiple of 10.

The scenario for me is that I need a batch job (run daily) to send remainder emails after every 10 days the entry is created in a custom table. While I know i can handle in the code, I am trying to check if there is a way to handle it dynamically like when the customer might want to increase or decrease the frequency of sending the remainder emails every 7/10/15 days.

2 REPLIES 2
Read only

Sandra_Rossi
Active Contributor
0 Likes
1,831

It's not very clear what you are looking for. In program variants, you can enter a value = today +/- any number of days. Why do you need something else?

Read only

tom_wan
Product and Topic Expert
Product and Topic Expert
0 Likes
1,831

A workaround comes to my mind is:

use selection variable (TVARVC).

Define your job as two steps job.

1st step: a z-program that update/calculate the selection variable in TVARVC to expect value

2nd step: the program that you want to run

Note: TVARVC is a buffered table, pay attention to the dirty read:

2285937 - The updated data for the table TVARVC can not be read