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

default values in TVARV

former_member565266
Participant
2,143

Hello Experts,

Anyone help me on how to set as default the current year and period in variant. I want to do a background job for our program using save variants. But I need the period and year to always be assigned what ever is the current year and period.

Please help me on this.

1 ACCEPTED SOLUTION
Read only

former_member564522
Active Participant
0 Likes
1,817

Hi Satish,

you can use the initialization Event to calculate the year like 2018-3 and assigned to the Parameter/select-options .

Hi Satish,

you can use the initialization Event to calculate the year like 2018-3 and assigned to the Parameter/select-options .

5 REPLIES 5
Read only

rajkumarnarasimman
Active Contributor
0 Likes
1,817

Hi Sathish,

"I need the period and year to always be assigned what ever is the current year and period

If current period is required, instead of using variant concept, you can default the values in program level itself like

"Declaration
PARAMETER: P_PERIOD TYPE PERIOD DEFAULT SY-DATUM+0(6).

"Else assign like below too
p_period = sy-datum+0(6). 

Regards

Rajkumar Narasimman

Read only

0 Likes
1,817

Thanks for quick response.

I want to display current year - 3 years, for ex 2018-3 = 2015.

How can achieve this. Please help me on this.

Read only

0 Likes
1,817
"I want to display current year - 3 years, for ex 2018-3 = 2015.

Please do not share the requirement as it is, always do write the problem which you faced it when you tried the requirement.

Coming to the above issue, for calculation in the year, check whether any period variable is maintained already in TVARVC table, if it is available, use the same. If variable not available, create newly. Also, make sure that the period value in TVARVC table is updated by some background job monthly wise.

Regards

Rajkumar Narasimman

Read only

roberto_forti
Contributor
1,817

Hi Satish,

Following steps to consider setting up it.

1. Fill selection screen data and save the data as variant.

2. Define a Variant name and in "Field attributes" select the check box for "Selection variable".

3. Select 😧 Dynamic date calculation and choose corresponding date calculation (attached print).

Regards,

Read only

former_member564522
Active Participant
0 Likes
1,818

Hi Satish,

you can use the initialization Event to calculate the year like 2018-3 and assigned to the Parameter/select-options .