cancel
Showing results for 
Search instead for 
Did you mean: 

Calculate values on a Bex. Variable

Former Member
0 Kudos

I have two variables on my query. 0calmonth and

zdate.

my requirement is after I enter value to ocalmonth variable, value must be calculated and displayed automatically on zdate variable. (Last day of the month from the entered month on 0calmonth).

Tried writing enhancement for this. I am unable to pass the value(month) entered on 0calmonth variable to zdate variable.

Any idea on how to do this, would be of great help.

Thanks

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Anupama,

just some more specific help for your issue...

first of all, remember that step '2' is called only for those variables that are not marked as 'ready for input' and are set to 'mandatory variable entry'.

In this sample I use the variables ZDATE and 0PCALMON (the pop-up variable) and a FM in which is required as input the first day of a month and return as output the last day.

data: va_last like sy-datum,

va_first like sy-datum.

(...)

when 'ZDATE'.

if i_step = 2.

loop at i_t_var_range into loc_var_range

where vnam = '0PCALMON'.

clear: l_s_range, va_last, va_first.

  • finding the last day of the entered month

concatenate loc_var_range-low '01' into va_first.

CALL FUNCTION 'SLS_MISC_GET_LAST_DAY_OF_MONTH'

EXPORTING

DAY_IN = va_first

IMPORTING

LAST_DAY_OF_MONTH = va_last

EXCEPTIONS

DAY_IN_NOT_VALID = 1

OTHERS = 2.

if sy-subrc = 0.

l_s_range-low = va_last.

l_s_range-sign = 'I'.

l_s_range-opt = 'EQ'.

append l_s_range to e_t_range.

endif.

exit.

endloop.

endif.

(...)

when others.

endcase.

Hope it helps (and please don't forget to assign some points by clickin'on the yellow star for each reply to the contributors that help you !!!)

Bye,

Roberto

Former Member
0 Kudos

Thanks for all your help.

Roberto,

Your idea to set this helped me to execute my code correctly.

step '2' is called only for those variables that are not marked as 'ready for input' and are set to 'mandatory variable entry'.

Now it works fine.

Thanks

Former Member
0 Kudos

Hi,

as you will populate a variable (zdate) depending on the user input on another variable (0calmonth) you need to implement the coding in the relevant user exit (include ZXRSRU01) for 'step = 2' (importing variable i_step).

In table e_t_range you will find the input for the variable on 0calmonth.

regards

Siggi