cancel
Showing results for 
Search instead for 
Did you mean: 

Current fiscal period as default value in drop down box

Former Member
0 Kudos

Hello all,

I have a drop down box on a variable for fiscal year / period. I want the VC model to start with the current fiscal period. How to get this working?

I was trying out the NOW() function however fiscal period is in format 001.2006 while NOW() gives something like 01.01.2006. How to solve this?

Thanks in advance,

Ralph

Points will be awarded !!!

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Ralph,

you need a converter to do this. I think the best would be to write an ABAP RFC.

In most cases the fiscal year is not similar to the calendar year, that's why you have to programm a lookup in the backend.

If the fiscal year is the same as the calender year then you can do this with formula in VC.

DSTR(NOW(),'MM') returns the month DSTR(NOW(),'YYYY') returns the year

and '0' & DSTR(NOW(),'MM') & '.' DSTR(NOW(),'YYYY') returns 005.2007.

Hope that helps,

best Regards,

Marcel

Former Member
0 Kudos

Hi Marcel,

thanks for the quick reply !!!

Your formula seems to work for input fields but not for a drop down box. How can this be?

Best regards,

Ralph

Former Member
0 Kudos

Hi Roy,

this should also work as default value for a dropdown box.

It should select the corresponding values. Maybe your keys in the dropdown box are not correct.

Best Regards,

Marcel

Former Member
0 Kudos

Hi Marcel,

I checked the drop down box. Output field key and value can be filled with three values:

- key

- key ext

- text

In runtime this looks like:

- key = K42006006

- key ext = K4/006.2006

- text = June 2006, but also period 06 2006 (I think this is for a different fiscal variant than K4)

1. How can I change the appearance of the key values? Users would like to see 006.2006?

2. How can I ensure that default values are loaded with current period in format 006.2006?

Thanks in advance,

Ralph

Former Member
0 Kudos

Hi Ralph,

1) for the text of your dropdown you must use a formula to get 006.2006,

e.g. RIGHT(@key_ext,8) should return 006.2006 (8 characters from the right side of @key_ext)

2) You have to enter the formula from my previous post

'0' & DSTR(NOW(),'MM') & '.' DSTR(NOW(),'YYYY')

as default value in your dropdown box.

Best Regards,

marcel

Former Member
0 Kudos

Hi Marcel,

first of all, thanks for your effort !!!

Your suggestion still is not working. I put in place the following:

- Default value = '0' & DSTR(NOW(), 'MM') & DSTR(NOW(),'YYYY')

- Output field value = @KEY

- Output field text = RIGHT(@KEY,'7')

Symptoms:

- The default value is not shown. When the cockpit it loaded the drop down box is empty

- The values in the drop down box appear OK, in format 2006006.

- When selecting a value and pushing submit button the following error message appears: ' Nested Eception.Failure to execute native function. Nested Exception. INVALID_VARIABLE_VALUES '

Hope you have some more ideas,

Ralph

Former Member
0 Kudos

Hi Ralph,

I know the error:

You use:

- Output field value = @KEY

- Output field text = RIGHT(@KEY,'7')

then the keys of your dropdown are like K42006006 and our default value is like 006.2007 so you have to modify the formula:

'K4' & DSTR(NOW(),'YYYY') & '0' & DSTR(NOW(), 'MM')

then it should work.

Best Regards,

Marcel

Former Member
0 Kudos

Hello Marcel,

I changed the formula according to what you descibed but it did not change the problems I have:

1. Default value is not shown in a drop down box. The formula works fine when using an input field.

2. When using a drop down box and changing the output ports in the dynamic entry list the values are not passed on in the right format to the queries. I would like to see 0062006 or 006.2006 in the drop down box, however the query expects K42006006 as a key.

Thanks,

Ralph

Former Member
0 Kudos

Hi Ralpf,

if your query expect K42006006 as key, then you must pass it in this format (use the formula above). Also the default value of your dropdown must be in the same format as the keys in the dropdown from your dynamic entry list of the data service.

Best Regards,

Marcel

Former Member
0 Kudos

Hi Ralph,

Did you ever get passed that INVALID_VARIABLE_VALUES error? I am experiencing this now but only for certain users. If you found the cause and/or solution, please share this with me.

Thank you for your time,

Erin Byrne

Answers (0)