01-12-2015 2:43 PM
Hi,
I need to adjust the variant key date to '01.01.current year' (dynamically). I tried different options using Table Variable from TVARC but not able to adjust. I should not write this in the program. Requirement is to update the variant. Please let me know how to achieve this.
Regards
Kishor
01-13-2015 7:44 AM
As this variable "first day of year" does not exist, neither in table of variable nor in dynamic functions, you have to maintain it yourself in TVARVC thru a customer program executed by a periodic job and then use this new variable in your variant.
NB: You can copy code of standard report RVSETDAT to update TVARVC, add your z-report to the background job which currently (should) execute this standard report everyday in your system.
Regards,
Raymond
01-12-2015 4:59 PM
Hi Kishor,
Without using TVARC Table, we have another option called Dynamic date calculation .
When creating variant, In selection variable, use D as shown below. Than lead to assign the dynamic date in variant as shown below.
In this case, I have selected first day of current month.
First date of Current year is not available in this case, I hope normally we schedule the program in background, Some program will run once in a year on January month. In those case, we may need first date value 01.01.2015. In some day it is going to run on January month, it is better to assign the variant (First day of Current Month) as shown above.
If the program is ran on any day in January month, we can use value as 01.01.2015 for this year.. For next year 01.01.2016.
Hope it helps.
Regards
Rajkumar Narasimman
01-13-2015 7:19 AM
Hi Rajkumar,
Thanks for the info. But as per the requirement, I need to set the date as day one of current year (irrespective of month - It should not consider only january month) in the variant. Is there any possibility to create a variable for this in TVARC table.
Regards
Kishor
01-13-2015 7:33 AM
Hi Kishor,
You can use "RS_CREATE_VARIANT" Function module to create a dynamic variant for your program.
Call the function module at initialization event and create a variant based on the year.
Regards.
Praveer.
01-13-2015 8:48 AM
Hi Praveer,
Variant is already available in the system and I need to update the date field with 01.01.current year when the variant is selected.
Regards
Kishro
01-13-2015 8:52 AM
Hi,
Please find the below code, which will create a variant at initialization stage of the program.
In above code, write the logic to set the Date Parameters based on the Current Year.
Low = sy-datum+0(4) && '0101'.
Reagards.
Praveer
01-13-2015 9:02 AM
Hi Kishor,
you can use RS_VARIANT_DELETE function module to delete the existing and then update with New Information by the same coding, what i have provided.
So everytime, user will get the new Variant with same name, only the variant value will be change, as per Date Information.
Regards.
Praveer.
01-13-2015 7:44 AM
As this variable "first day of year" does not exist, neither in table of variable nor in dynamic functions, you have to maintain it yourself in TVARVC thru a customer program executed by a periodic job and then use this new variable in your variant.
NB: You can copy code of standard report RVSETDAT to update TVARVC, add your z-report to the background job which currently (should) execute this standard report everyday in your system.
Regards,
Raymond
01-14-2015 7:18 AM
Thanks for the suggestions. I got the answer.
In Initialization I have added the code to default the key date value to 01.01.Current year and in the variant for this key date I have selected the check box ‘Save field without values’. So the key date value was filled with 01.01.Current year in the given variant.
Regards
Kishor
02-27-2023 8:38 PM
This is an oldie but since it is one of the first hits in Google... After your kindergarden child grew to a teenager, there's a solution to this: https://launchpad.support.sap.com/#/notes/3103263
Cheers
Jens