Application Development 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: 

How to display varying from and to dates in a variant in SAP non custom prg

Former Member
0 Kudos

I have a SAP non custom program which the user goes to every day and enters current date for from and to dates if the program runs between Tuesday and Friday in a variant. However, on a Monday, it is supposed to make the from date as the last business date + 1 which could be Saturday and the to date to be Monday. We want to automate to make it display the from and to dates in the variant without having the user to go every day and change the date manually. Again, this is a SAP program and not a Z program. It runs in the evening every day. Suppose it runs tonight (Friday 07/11/08, it will display 07/11/08 in from and to dates). If it ran yesterday and yesterday was not a holiday according to factory calendar then the from and to dates would be 07/10/08. However when it runs on a Monday or on a holiday then the from date have to be the last business date + 1 (Saturday) and to date would be date run (Monday). I tried doing with the help of the selection variable and D (Dynamic date selection), but could not succeed in this case. I tried using Date -xxx, Date + yyyy (Business days) from dynamic date selection, but the from date is not fixed in case of holiday and Monday. For example. Ideally I would want Date - xxx (Business day) + 1 (to make it Saturday) and to date should be current date.

Thanks

Ram

2 REPLIES 2

naimesh_patel
Active Contributor
0 Kudos

I think the option Date - xxx, Date + yyy (work days) will work for you.

Set :

XXX as 1

YYY as 0

and give your factory calender.

Regards,

Naimesh Patel

Former Member
0 Kudos

Hello Naimesh,

thanks for the reply. But if I do xxx - 1 it will give me the last business date. I need the last business date + 1 day (need not be a business day, example last business day is Friday. I need Saturday to be from day). The to date should be the current date. The problem is the from date is most of the times correct during the week days, except during holidays, for example if Friday is a public holiday and we are currently on a Monday, then the from date should be Friday and to date should be Monday. On a normal Monday, the from date should be Saturday and to date should be a Monday.

Thanks

Ram