cancel
Showing results for 
Search instead for 
Did you mean: 

Date range for a variable from number of days enterd

Former Member
0 Kudos

Hi frnds,

I have a requirement like ,

Number of Days should be enterd in the Selection screen ,

If user enters 10 Days in selection screen, then it should bring the records like date from = sy date and date to = ( the date after ten days from today ) for a characteristic( validity ) which holds the dates ,

i believe that i can create one formula variable to enter the number of days and how do i relate this with the other variable in the char ( validity ) ,

Could you please guide and sample code would be a great help ,

thanks ,

sathy

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hello

Create a user input variable for getting no. of days in it

Create a customer exit and do following coding in cmod

WHEN 'CUST EXIT VAR NAME'.

v_beg = sy-datum.

CLEAR l_var_range.

READ TABLE i_t_var_range INTO l_var_range

WITH KEY vnam = 'user input variable'.

v_end = v_beg + l_var_range-low.

l_range-sign = I.

l_range-opt = 'BT'.

l_range-low = l_sales_beg.

l_range-high = l_sales_end.

APPEND l_range TO e_t_range.

Thanks

Tripple k

Former Member
0 Kudos

HI Venkat and Tripple ,

Thank you very much for your help, i will try to implement this now and come back to you ,

Thanks ,

sathy

Former Member
0 Kudos

hi Venkat / Tripple ,

With your code sample i have written a code like this but it does not seems to be working , Could you please help , ( 'ZQUOT_N' = Customer Exit variable and 'ZQUOTE_R' = formula variable to get the number of days )

Please guide me on what mistake i have done here , thanks for your help

WHEN 'ZQUOT_N'.

v_beg = sy-datum.

CLEAR l_var_range.

READ TABLE i_t_var_range INTO l_var_range

WITH KEY vnam = 'ZQUOTE_R'.

v_end = v_beg + l_var_range-low.

l_range-sign = 'I'.

l_range-opt = 'BT'.

l_range-low = v_beg.

l_range-high = v_end.

APPEND l_range TO e_t_range.

Former Member
0 Kudos

Try out the belwo and let me know:

WHEN 'ZQUOT_N'.

v_beg = sy-datum.

CLEAR l_var_range.

READ TABLE i_t_var_range INTO l_var_range

WITH KEY vnam = 'ZQUOTE_R'.

v_end = v_beg + l_var_range-low.

l_s_range-sign = 'I'.

l_s_range-opt = 'BT'.

l_S_range-low = v_beg.

l_s_range-high = v_end.

APPEND l_s_range TO e_t_range.

EXIT.

ENDCASE.

If it is not giving proper results for next month to date when added by the number of days, we just need to make small changes.

Former Member
0 Kudos

hi ,

its not working still, even i have tried with I_STEP = 2 after WHEN 'ZQUOT_N' ,

but it works if hardcode like

v_end = v_beg + 10 . ( instead of l_var_range-low ) , Appreciate your help on this thanks , sathy

WHEN 'ZQUOT_N'.

*I_STEP = 2.

v_beg = sy-datum.

CLEAR l_var_range.

READ TABLE i_t_var_range INTO l_var_range

WITH KEY vnam = 'ZQUOTE_R'.

v_end = v_beg + l_var_range-low.

l_s_range-sign = 'I'.

l_s_range-opt = 'BT'.

l_S_range-low = v_beg.

l_s_range-high = v_end.

APPEND l_s_range TO e_t_range.

EXIT.

ENDCASE.

Former Member
0 Kudos

Sathya,

Can u give the details of the variable where the user enters the number of days.

Former Member
0 Kudos

hi Venkat ,

Thanks a lot , it is working fine now ,

Actually i is working after using

i_step = 2 and by using looping instead of read , thanks a lot ,

hi tripple , thanks a lot for you too ..

sathya

Answers (1)

Answers (1)

Former Member
0 Kudos

Sathya,

Here you can go for another formula variable with processing type customet exit where you will be reading the days entered by the user(other variable with user input) and then populate the from date as sys date and to date as 10 plus. This should be a better solution.