Skip to Content
0
Former Member
Jul 11, 2015 at 08:00 AM

Customer exit first day of the month from the user entered date

438 Views

Hi Friends,

I have a requirement where i need to calculate first day of the month from the user entered date. I did this procedure but did not get the desired output.

1) Created a user entry variable on delivery date. Say " ZDEL_DTE"

2) Created a Customer exit on delivery date " ZEXIT_DEL_DATE" and gave intervel to it and disabled user entry.

3) Wrote this code in CMOD:


Data: l_s_range TYPE rrrangesid,
loc_var_range LIKE rrrangeexit,

lv_month TYPE d,
lv_year(4) TYPE n,

lv_data type sy-datum,

lv_data1 type sy-datum.


CASE I_VNAM.


When 'ZEXIT_DEL_DATE'


IF I_STEP = 2.


LOOP AT i_t_var_range into loc_var_range WHERE vnam = 'ZDEL_DTE'.


lv_month = loc_var_range-low+4(2).
lv_year = loc_var_range-low+0(4).


CONCATENATE lv_year lv_month '01' INTO lv_DATA.


lv_data1 = loc_var_range-low.
l_s_range-low = lv_first_day.
l_s_range-sign = 'I'.
l_s_range-opt = 'BT'.

APPEND l_s_range TO e_t_range.
ENDLOOP.


When i am executing say 29th jan 2015, it should get the data from 1st to 29th of jan. But it is getting only 29th of jan. Where have i gone wrong. Please give alight on this.


I used this post as a ref and did that. link :