‎2006 Dec 12 12:24 PM
Can anyone help me ,how to use OFFSET in my code ?
REASON : I want to change the current date to the first date of the current month.
example: 2006.12.11(yyyy.mm.dd) to 2006.12.01(yyyy.mm.dd)
‎2006 Dec 12 12:32 PM
try this
REPORT YCHATEST LINE-SIZE 350.
DATA : V_DATE LIKE SY-DATUM,
V_START_DATE(10).
V_DATE = SY-DATUM.
CONCATENATE V_DATE+0(4) V_DATE+4(2) '01' INTO V_START_DATE SEPARATED BY '.'.
WRITE : V_START_DATE.
‎2006 Dec 12 12:26 PM
hi,
a sugestion is.
use this FM.
u will get the start and end date.
data:f_date type sy-datum,
l_date type sydatum.
CALL FUNCTION 'HR_JP_MONTH_BEGIN_END_DATE'
EXPORTING
iv_date = sy-datum
IMPORTING
EV_MONTH_BEGIN_DATE = f_date
EV_MONTH_END_DATE = l_date.or u want to go with offset.
V_DATE_IN = '2006.12.11'.
V_DATE_IN+0(4) "<--for Year
V_DATE_IN+5(2) "<--for month
V_DATE_IN+8(2) "<--for Day
rgds
Anver
‎2006 Dec 12 12:28 PM
Hello,
You can try it as below :
string str.
date1 = 2006.12.11
str = date1.
str+8(2) = '01'.
or you can use some stanrdard functions for this change.
Thanks.
‎2006 Dec 12 12:30 PM
Hello,
You can use the sub-string operation.
data v_date type sy-datum value sy-datum.
here v_date = 20061212
v_date+6(2) = '01'.
here v_date = 20061201
The above code will change 2 characters from the seventh characters onwards. In this case day.
Regards,
Manoj
‎2006 Dec 12 12:32 PM
try this
REPORT YCHATEST LINE-SIZE 350.
DATA : V_DATE LIKE SY-DATUM,
V_START_DATE(10).
V_DATE = SY-DATUM.
CONCATENATE V_DATE+0(4) V_DATE+4(2) '01' INTO V_START_DATE SEPARATED BY '.'.
WRITE : V_START_DATE.
‎2006 Dec 12 12:56 PM
Hi Shashank ,
Since the variable containing date will be of type DATUM and the internal rep of it is YYYYMMDD , so date like 22.12.2006 will be rep as 20061222.
Now if you want to convert it to 01.12.2006 all you have to do it
v_date+6(2) = '01'. where v_date is the variable storing the date.
Regards
Arun