‎2009 May 28 1:07 PM
Hallo,
in the follwoing code I am trying to have the year 2009 and previous year 2008. But it dont function.Can somebody tell me What can I do to get in prvious_year 2008.
DATA: cha TYPE d,
previous_year type d.
cha = sy-datum+0(4).
previous_year = cha - 1.
regards
rana
‎2009 May 28 1:10 PM
Hi,
Try this.
DATA: cha(4) TYPE c,
previous_year(4) type c.
cha = sy-datum+0(4).
previous_year = cha - 1.
write previous_year.
‎2009 May 28 1:10 PM
Hi Rana,
Use this logic.
data:
w_present type d,
w_next type d.
w_next+0(4) = w_present+0(4) - 1.Sy-datum and d are 2 different date types.
Their formats are sometjing like this.
d : 'yyyymmdd'.
sy-datum : 'dd:mm:yyyy'(depends on the settings)
Much Regards,
Amuktha.
‎2009 May 28 1:27 PM
HI Rana,
Try the with the below code.
data : v_date type d.
data : v_temp(4) type c.
data : v_date1 type d.
v_date = sy-datum.
v_temp = v_date+0(4) - 1.
CONCATENATE v_temp v_date+4(4) into v_date1.
write : v_date1 .
‎2009 May 28 1:11 PM
See the below code
Edited by: Swastik Bharati on May 28, 2009 2:12 PM
‎2009 May 28 1:12 PM
DATA: cha(4) TYPE N,
previous_year(4) type N.
cha = sy-datum+0(4).
previous_year = cha - 1.
‎2009 May 28 1:12 PM
Hi,
Data : lv_date type dats,
lv_date = sy-datum.
lv_date0(4) = lv_date0(4) - 1
‎2009 May 28 1:13 PM
you can use ths code I can you are facing fiscal year problem:
l_pdatl = sy-datum+0(4) . " year
l_pprdl = sy-datum+5(2) . "month
CASE l_pprdl .
WHEN 01 .
l_pprdl = 10 .
WHEN 02 .
l_pprdl = 11 .
WHEN 03 .
l_pprdl = 12.
WHEN OTHERS .
l_pprdl = l_pprdl - 3 .
ENDCASE.l_pdatl = sy-datum+0(4) .thanx aryan
Edited by: Aryan@sap on May 28, 2009 2:14 PM
‎2009 May 28 1:14 PM
Hi,
Try like this
DATA: cha TYPE string,
previous_year type string.
cha = sy-datum+0(4).
previous_year = cha - 1.
‎2009 May 28 1:17 PM
‎2009 May 28 1:21 PM
Hi Rana ,
Check the code - -
DATA: cha(4) TYPE c,
previous_year(4) TYPE c.
cha = sy-datum+0(4).
previous_year = cha - 1.
WRITE : previous_year.
‎2009 May 28 1:22 PM
Hello Rana,
Declare the variables as below.
Data: cha(4) type n,
previous_year(4) type n.
cha = sy-datum+0(4).
previous_year = cha - 1.
write : / cha , previous_year.
Regards,
Jyothi