on 05-11-2010 10:34 AM
Hi experts,
I have the following code to count the number of days from the user selection variable.
DATA: L_S_RANGE TYPE RSR_S_RANGESID,
LOC_VAR_RANGE LIKE RRRANGEEXIT,
d1 type sy-datum,
d2 type sy-datum,
d3 type i.
Read table i_t_var_range INTO loc_var_range with key vnam = 'user input variable'.
d1 = loc_var_range-low.
d2 = loc_var_range-high.
d3 = d2 - d1.
l_s_range-low = d3 .
l_s_range-sign = 'I'.
l_s_range-opt = 'EQ'.
APPEND l_s_range TO e_t_range.
If the ABAP'er debug's the code, it is returning the number of days correctly. But when i display it in the query, it is returning '0' value. Could you please suggest me wht went wrong in this?
Thank you.
DATA: L_S_RANGE TYPE RSR_S_RANGESID,
LOC_VAR_RANGE LIKE RRRANGEEXIT,
d1 type sy-datum,
d2 type sy-datum,
d3 type i.
Read table i_t_var_range INTO loc_var_range with key vnam = 'user input variable'.
d1 = loc_var_range-low.
d2 = loc_var_range-high.
if i_vnam = 'Query Varaible'* "put varaible to which you want to populate
d3 = d2 - d1.
l_s_range-low = d3 .
l_s_range-sign = 'I'.
l_s_range-opt = 'EQ'.
APPEND l_s_range TO e_t_range.
endif.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
CASE i_vnam. " Variablenname
when 'ZVAR_DCOUNT'.
*DATA: L_S_RANGE TYPE RSR_S_RANGESID,
LOC_VAR_RANGE LIKE RRRANGEEXIT,
d1 type sy-datum,
d2 type sy-datum,
d3 type i.
*
*Read table i_t_var_range INTO loc_var_range With key vnam = '0I_DAYS'.
*
*d1 = loc_var_range-low.
*d2 = loc_var_range-high.
*
*d3 = d2 - d1.
l_s_range-low = d3 .
l_s_range-sign = 'I'.
l_s_range-opt = 'EQ'.
APPEND l_s_range to e_t_range.
ENDCASE.
In the above code:
0I_DAYS is the userinput variable of 0calday.
ZVAR_DCOUNT is the formula variable.
Thanks.
Hi,
"d3 = d2 - d1" ...is correct & should be working.
Anyway, why you don't go for function module to get difference between two dates.
Like
CALL FUNCTION 'DAYS_BETWEEN_TWO_DATES'
EXPORTING
i_datum_bis = d1
i_datum_von = d2
IMPORTING
e_tage = d3.
Their are many other 'date difference' function, if above FM is not working .... look for other FMs.
Thanks,
Jitender.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.